scripts/python/ispublic/ispublic.py
author Sebastian Brannstrom <sebastianb@symbian.org>
Wed, 18 Nov 2009 14:00:16 +0000
changeset 12 d2f4d301e581
permissions -rw-r--r--
Cleanup
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
     1
import sys
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
     2
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
     3
def strip_path(pathname):
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
     4
	pathname = pathname.strip()
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
     5
	while pathname.find('/') != -1:
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
     6
		x=pathname.find('/')
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
     7
		pathname = pathname[x+1:]
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
     8
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
     9
	while pathname.find('\\') != -1:
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    10
		x=pathname.find('\\')
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    11
		pathname = pathname[x+1:]		
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    12
	
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    13
	#print 'strip_path returning %s' % pathname
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    14
	return pathname
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    15
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    16
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    17
res_f = open('symbian_2_public_api_list.txt')
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    18
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    19
pubapis=[]
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    20
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    21
for line in res_f:
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    22
	pathname = line[0:len(line)-1]
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    23
	
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    24
	filename = strip_path(pathname).lower()
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    25
	pubapis.append(filename)
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    26
	
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    27
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    28
	
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    29
def is_public(shortname):
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    30
	fname=strip_path(shortname).lower()
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    31
	#print 'finding %s in public apis' % fname
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    32
	
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    33
	return fname in pubapis
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    34
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    35
if (is_public(sys.argv[1])):
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    36
	print 'Public'
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    37
else:
d2f4d301e581 Cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff changeset
    38
	print 'Platform'