/opt/alt/python27/lib64/python2.7
NameSizeModeActions
bsddb/-0755rm
compiler/-0755rm
config/-0755rm
ctypes/-0755rm
curses/-0755rm
distutils/-0755rm
email/-0755rm
encodings/-0755rm
ensurepip/-0755rm
hotshot/-0755rm
idlelib/-0755rm
importlib/-0755rm
json/-0755rm
lib-dynload/-0755rm
lib2to3/-0755rm
logging/-0755rm
multiprocessing/-0755rm
plat-linux2/-0755rm
pydoc_data/-0755rm
site-packages/-0755rm
sqlite3/-0755rm
test/-0755rm
unittest/-0755rm
wsgiref/-0755rm
xml/-0755rm
abc.py71450644editdlrm
abc.pyc62860644editdlrm
abc.pyo62300644editdlrm
aifc.py345790644editdlrm
aifc.pyc314080644editdlrm
aifc.pyo314080644editdlrm
antigravity.py600644editdlrm
antigravity.pyc2160644editdlrm
antigravity.pyo2160644editdlrm
anydbm.py26630644editdlrm
anydbm.pyc28390644editdlrm
anydbm.pyo28390644editdlrm
argparse.py892280644editdlrm
argparse.pyc663820644editdlrm
argparse.pyo662170644editdlrm
ast.py118050644editdlrm
ast.pyc132500644editdlrm
ast.pyo132500644editdlrm
asynchat.py115810644editdlrm
asynchat.pyc92000644editdlrm
asynchat.pyo92000644editdlrm
asyncore.py209430644editdlrm
asyncore.pyc196600644editdlrm
asyncore.pyo196600644editdlrm
atexit.py17050644editdlrm
atexit.pyc22810644editdlrm
atexit.pyo22810644editdlrm
audiodev.py75970644editdlrm
audiodev.pyc88200644editdlrm
audiodev.pyo88200644editdlrm
base64.py118030755editdlrm
base64.pyc115310644editdlrm
base64.pyo115310644editdlrm
BaseHTTPServer.py227470644editdlrm
BaseHTTPServer.pyc219820644editdlrm
BaseHTTPServer.pyo219820644editdlrm
Bastion.py57440644editdlrm
Bastion.pyc68550644editdlrm
Bastion.pyo68550644editdlrm
bdb.py217140644editdlrm
bdb.pyc198940644editdlrm
bdb.pyo198940644editdlrm
binhex.py146980644editdlrm
binhex.pyc161230644editdlrm
binhex.pyo161230644editdlrm
bisect.py25950644editdlrm
bisect.pyc31360644editdlrm
bisect.pyo31360644editdlrm
calendar.py233840644editdlrm
calendar.pyc289400644editdlrm
calendar.pyo289400644editdlrm
cgi.py357940755editdlrm
cgi.pyc340340644editdlrm
cgi.pyo340340644editdlrm
CGIHTTPServer.py130890644editdlrm
CGIHTTPServer.pyc111870644editdlrm
CGIHTTPServer.pyo111870644editdlrm
cgitb.py121750644editdlrm
cgitb.pyc123720644editdlrm
cgitb.pyo123720644editdlrm
chunk.py54190644editdlrm
chunk.pyc57450644editdlrm
chunk.pyo57450644editdlrm
cmd.py150260644editdlrm
cmd.pyc143120644editdlrm
cmd.pyo143120644editdlrm
code.py101890644editdlrm
code.pyc105420644editdlrm
code.pyo105420644editdlrm
codecs.py361430644editdlrm
codecs.pyc380460644editdlrm
codecs.pyo380460644editdlrm
codeop.py59990644editdlrm
codeop.pyc67270644editdlrm
codeop.pyo67270644editdlrm
collections.py277980644editdlrm
collections.pyc268390644editdlrm
collections.pyo267880644editdlrm
colorsys.py36910644editdlrm
colorsys.pyc40950644editdlrm
colorsys.pyo40950644editdlrm
commands.py25450644editdlrm
commands.pyc25470644editdlrm
commands.pyo25470644editdlrm
compileall.py77630644editdlrm
compileall.pyc70950644editdlrm
compileall.pyo70950644editdlrm
ConfigParser.py277460644editdlrm
ConfigParser.pyc259800644editdlrm
ConfigParser.pyo259800644editdlrm
contextlib.py44240644editdlrm
contextlib.pyc46100644editdlrm
contextlib.pyo46100644editdlrm
Cookie.py265380644editdlrm
Cookie.pyc231520644editdlrm
Cookie.pyo231520644editdlrm
cookielib.py654860644editdlrm
cookielib.pyc559860644editdlrm
cookielib.pyo557980644editdlrm
copy.py115330644editdlrm
copy.pyc125080644editdlrm
copy.pyo124160644editdlrm
copy_reg.py69740644editdlrm
copy_reg.pyc53100644editdlrm
copy_reg.pyo52660644editdlrm
cProfile.py65700755editdlrm
cProfile.pyc65770644editdlrm
cProfile.pyo65770644editdlrm
crypt.py22910644editdlrm
crypt.pyc30250644editdlrm
crypt.pyo30250644editdlrm
csv.py167080644editdlrm
csv.pyc138840644editdlrm
csv.pyo138840644editdlrm
dbhash.py4980644editdlrm
dbhash.pyc7440644editdlrm
dbhash.pyo7440644editdlrm
decimal.py2219330644editdlrm
decimal.pyc1754700644editdlrm
decimal.pyo1754700644editdlrm
difflib.py823250644editdlrm
difflib.pyc626000644editdlrm
difflib.pyo625490644editdlrm
dircache.py11260644editdlrm
dircache.pyc16280644editdlrm
dircache.pyo16280644editdlrm
dis.py64990644editdlrm
dis.pyc63320644editdlrm
dis.pyo63320644editdlrm
doctest.py1050950644editdlrm
doctest.pyc852100644editdlrm
doctest.pyo849230644editdlrm
DocXMLRPCServer.py107680644editdlrm
DocXMLRPCServer.pyc104420644editdlrm
DocXMLRPCServer.pyo103330644editdlrm
dumbdbm.py91410644editdlrm
dumbdbm.pyc69930644editdlrm
dumbdbm.pyo69930644editdlrm
dummy_thread.py44180644editdlrm
dummy_thread.pyc55890644editdlrm
dummy_thread.pyo55890644editdlrm
dummy_threading.py28040644editdlrm
dummy_threading.pyc12980644editdlrm
dummy_threading.pyo12980644editdlrm
filecmp.py95880644editdlrm
filecmp.pyc98820644editdlrm
filecmp.pyo98820644editdlrm
fileinput.py137460644editdlrm
fileinput.pyc148900644editdlrm
fileinput.pyo148900644editdlrm
fnmatch.py33150644editdlrm
fnmatch.pyc36920644editdlrm
fnmatch.pyo36920644editdlrm
formatter.py149110644editdlrm
formatter.pyc201790644editdlrm
formatter.pyo201790644editdlrm
fpformat.py47320644editdlrm
fpformat.pyc48070644editdlrm
fpformat.pyo48070644editdlrm
fractions.py223900644editdlrm
fractions.pyc202180644editdlrm
fractions.pyo202180644editdlrm
ftplib.py381940644editdlrm
ftplib.pyc356520644editdlrm
ftplib.pyo356520644editdlrm
functools.py48060644editdlrm
functools.pyc70190644editdlrm
functools.pyo70190644editdlrm
genericpath.py32010644editdlrm
genericpath.pyc36600644editdlrm
genericpath.pyo36600644editdlrm
getopt.py73190644editdlrm
getopt.pyc67840644editdlrm
getopt.pyo67390644editdlrm
getpass.py55630644editdlrm
getpass.pyc48350644editdlrm
getpass.pyo48350644editdlrm
gettext.py226660644editdlrm
gettext.pyc186020644editdlrm
gettext.pyo186020644editdlrm
glob.py31140644editdlrm
glob.pyc30470644editdlrm
glob.pyo30470644editdlrm
gzip.py190280644editdlrm
gzip.pyc156260644editdlrm
gzip.pyo156260644editdlrm
hashlib.py78420644editdlrm
hashlib.pyc70260644editdlrm
hashlib.pyo70260644editdlrm
heapq.py182950644editdlrm
heapq.pyc147980644editdlrm
heapq.pyo147980644editdlrm
hmac.py45880644editdlrm
hmac.pyc46720644editdlrm
hmac.pyo46720644editdlrm
htmlentitydefs.py180560644editdlrm
htmlentitydefs.pyc63800644editdlrm
htmlentitydefs.pyo63800644editdlrm
htmllib.py128690644editdlrm
htmllib.pyc214920644editdlrm
htmllib.pyo214920644editdlrm
HTMLParser.py171710644editdlrm
HTMLParser.pyc141430644editdlrm
HTMLParser.pyo138380644editdlrm
httplib.py523000644editdlrm
httplib.pyc387930644editdlrm
httplib.pyo386090644editdlrm
ihooks.py189860644editdlrm
ihooks.pyc222690644editdlrm
ihooks.pyo222690644editdlrm
imaplib.py483660644editdlrm
imaplib.pyc462720644editdlrm
imaplib.pyo435060644editdlrm
imghdr.py35410644editdlrm
imghdr.pyc50460644editdlrm
imghdr.pyo50460644editdlrm
imputil.py257640644editdlrm
imputil.pyc161170644editdlrm
imputil.pyo159390644editdlrm
inspect.py430080644editdlrm
inspect.pyc411260644editdlrm
inspect.pyo411260644editdlrm
io.py33220644editdlrm
io.pyc36540644editdlrm
io.pyo36540644editdlrm
keyword.py19920755editdlrm
keyword.pyc21310644editdlrm
keyword.pyo21310644editdlrm
linecache.py40270644editdlrm
linecache.pyc33500644editdlrm
linecache.pyo33500644editdlrm
locale.py1028340644editdlrm
locale.pyc570260644editdlrm
locale.pyo570260644editdlrm
macpath.py62890644editdlrm
macpath.pyc79280644editdlrm
macpath.pyo79280644editdlrm
macurl2path.py27310644editdlrm
macurl2path.pyc22960644editdlrm
macurl2path.pyo22960644editdlrm
mailbox.py812400644editdlrm
mailbox.pyc795640644editdlrm
mailbox.pyo795170644editdlrm
mailcap.py74290644editdlrm
mailcap.pyc72480644editdlrm
mailcap.pyo72480644editdlrm
markupbase.py146430644editdlrm
markupbase.pyc94880644editdlrm
markupbase.pyo92920644editdlrm
md5.py3580644editdlrm
md5.pyc3910644editdlrm
md5.pyo3910644editdlrm
mhlib.py334340644editdlrm
mhlib.pyc347910644editdlrm
mhlib.pyo347910644editdlrm
mimetools.py71680644editdlrm
mimetools.pyc84610644editdlrm
mimetools.pyo84610644editdlrm
mimetypes.py210280644editdlrm
mimetypes.pyc187360644editdlrm
mimetypes.pyo187360644editdlrm
MimeWriter.py64820644editdlrm
MimeWriter.pyc74810644editdlrm
MimeWriter.pyo74810644editdlrm
mimify.py150170755editdlrm
mimify.pyc121960644editdlrm
mimify.pyo121960644editdlrm
modulefinder.py244610644editdlrm
modulefinder.pyc195820644editdlrm
modulefinder.pyo195000644editdlrm
multifile.py48200644editdlrm
multifile.pyc56150644editdlrm
multifile.pyo55730644editdlrm
mutex.py18780644editdlrm
mutex.pyc26070644editdlrm
mutex.pyo26070644editdlrm
netrc.py58880644editdlrm
netrc.pyc48310644editdlrm
netrc.pyo48310644editdlrm
new.py6100644editdlrm
new.pyc8750644editdlrm
new.pyo8750644editdlrm
nntplib.py214700644editdlrm
nntplib.pyc216160644editdlrm
nntplib.pyo216160644editdlrm
ntpath.py194290644editdlrm
ntpath.pyc134150644editdlrm
ntpath.pyo134150644editdlrm
nturl2path.py24190644editdlrm
nturl2path.pyc18540644editdlrm
nturl2path.pyo18540644editdlrm
numbers.py103190644editdlrm
numbers.pyc148180644editdlrm
numbers.pyo148180644editdlrm
opcode.py54740644editdlrm
opcode.pyc62100644editdlrm
opcode.pyo62100644editdlrm
optparse.py612030644editdlrm
optparse.pyc557140644editdlrm
optparse.pyo556310644editdlrm
os.py259100644editdlrm
os.pyc263780644editdlrm
os.pyo263780644editdlrm
os2emxpath.py46350644editdlrm
os2emxpath.pyc46420644editdlrm
os2emxpath.pyo46420644editdlrm
pdb.doc79140644editdlrm
pdb.py460950755editdlrm
pdb.pyc451510644editdlrm
pdb.pyo451510644editdlrm
pickle.py454890644editdlrm
pickle.pyc399120644editdlrm
pickle.pyo397160644editdlrm
pickletools.py745230644editdlrm
pickletools.pyc574480644editdlrm
pickletools.pyo565870644editdlrm
pipes.py95820644editdlrm
pipes.pyc95160644editdlrm
pipes.pyo95160644editdlrm
pkgutil.py202430644editdlrm
pkgutil.pyc193880644editdlrm
pkgutil.pyo193880644editdlrm
platform.py527850755editdlrm
platform.pyc386020644editdlrm
platform.pyo386020644editdlrm
plistlib.py151850644editdlrm
plistlib.pyc200080644editdlrm
plistlib.pyo199220644editdlrm
popen2.py84160644editdlrm
popen2.pyc92330644editdlrm
popen2.pyo91910644editdlrm
poplib.py128240644editdlrm
poplib.pyc137740644editdlrm
poplib.pyo137740644editdlrm
posixfile.py80030644editdlrm
posixfile.pyc78080644editdlrm
posixfile.pyo78080644editdlrm
posixpath.py142930644editdlrm
posixpath.pyc117610644editdlrm
posixpath.pyo117610644editdlrm
pprint.py117770644editdlrm
pprint.pyc104410644editdlrm
pprint.pyo102640644editdlrm
profile.py227780755editdlrm
profile.pyc169630644editdlrm
profile.pyo167160644editdlrm
pstats.py267120644editdlrm
pstats.pyc257930644editdlrm
pstats.pyo257930644editdlrm
pty.py50580644editdlrm
pty.pyc50960644editdlrm
pty.pyo50960644editdlrm
pyclbr.py133880644editdlrm
pyclbr.pyc98200644editdlrm
pyclbr.pyo98200644editdlrm
pydoc.py956630755editdlrm
pydoc.pyc949140644editdlrm
pydoc.pyo948500644editdlrm
py_compile.py59360644editdlrm
py_compile.pyc65190644editdlrm
py_compile.pyo65190644editdlrm
Queue.py85770644editdlrm
Queue.pyc97880644editdlrm
Queue.pyo97880644editdlrm
quopri.py69650755editdlrm
quopri.pyc67170644editdlrm
quopri.pyo67170644editdlrm
random.py324570644editdlrm
random.pyc262630644editdlrm
random.pyo262630644editdlrm
re.py134230644editdlrm
re.pyc136860644editdlrm
re.pyo136860644editdlrm
repr.py42960644editdlrm
repr.pyc56060644editdlrm
repr.pyo56060644editdlrm
rexec.py201480644editdlrm
rexec.pyc245740644editdlrm
rexec.pyo245740644editdlrm
rfc822.py335420644editdlrm
rfc822.pyc325930644editdlrm
rfc822.pyo325930644editdlrm
rlcompleter.py59910644editdlrm
rlcompleter.pyc61820644editdlrm
rlcompleter.pyo61820644editdlrm
robotparser.py76950644editdlrm
robotparser.pyc83150644editdlrm
robotparser.pyo83150644editdlrm
runpy.py110810644editdlrm
runpy.pyc90630644editdlrm
runpy.pyo90630644editdlrm
sched.py50880644editdlrm
sched.pyc51110644editdlrm
sched.pyo51110644editdlrm
sets.py190500644editdlrm
sets.pyc176230644editdlrm
sets.pyo176230644editdlrm
sgmllib.py178840644editdlrm
sgmllib.pyc160470644editdlrm
sgmllib.pyo160470644editdlrm
sha.py3930644editdlrm
sha.pyc4340644editdlrm
sha.pyo4340644editdlrm
shelve.py81780644editdlrm
shelve.pyc106070644editdlrm
shelve.pyo106070644editdlrm
shlex.py111640644editdlrm
shlex.pyc77270644editdlrm
shlex.pyo77270644editdlrm
shutil.py198710644editdlrm
shutil.pyc196490644editdlrm
shutil.pyo196490644editdlrm
SimpleHTTPServer.py79970644editdlrm
SimpleHTTPServer.pyc81530644editdlrm
SimpleHTTPServer.pyo81530644editdlrm
SimpleXMLRPCServer.py258120644editdlrm
SimpleXMLRPCServer.pyc233310644editdlrm
SimpleXMLRPCServer.pyo233310644editdlrm
site.py196370644editdlrm
site.pyc198190644editdlrm
site.pyo198190644editdlrm
smtpd.py185390755editdlrm
smtpd.pyc162860644editdlrm
smtpd.pyo162860644editdlrm
smtplib.py321310755editdlrm
smtplib.pyc310190644editdlrm
smtplib.pyo310190644editdlrm
sndhdr.py59730644editdlrm
sndhdr.pyc75820644editdlrm
sndhdr.pyo75820644editdlrm
socket.py206150644editdlrm
socket.pyc165420644editdlrm
socket.pyo164560644editdlrm
SocketServer.py239480644editdlrm
SocketServer.pyc248280644editdlrm
SocketServer.pyo248280644editdlrm
sre.py3840644editdlrm
sre.pyc5320644editdlrm
sre.pyo5320644editdlrm
sre_compile.py198230644editdlrm
sre_compile.pyc127550644editdlrm
sre_compile.pyo125990644editdlrm
sre_constants.py71970644editdlrm
sre_constants.pyc62600644editdlrm
sre_constants.pyo62600644editdlrm
sre_parse.py307000644editdlrm
sre_parse.pyc216240644editdlrm
sre_parse.pyo216240644editdlrm
ssl.py374550644editdlrm
ssl.pyc330150644editdlrm
ssl.pyo330150644editdlrm
stat.py18420644editdlrm
stat.pyc28810644editdlrm
stat.pyo28810644editdlrm
statvfs.py8980644editdlrm
statvfs.pyc6330644editdlrm
statvfs.pyo6330644editdlrm
string.py215480644editdlrm
string.pyc211220644editdlrm
string.pyo211220644editdlrm
StringIO.py106620644editdlrm
StringIO.pyc117270644editdlrm
StringIO.pyo117270644editdlrm
stringold.py124490644editdlrm
stringold.pyc129000644editdlrm
stringold.pyo129000644editdlrm
stringprep.py135220644editdlrm
stringprep.pyc147470644editdlrm
stringprep.pyo146750644editdlrm
struct.py820644editdlrm
struct.pyc2520644editdlrm
struct.pyo2520644editdlrm
subprocess.py505200644editdlrm
subprocess.pyc331000644editdlrm
subprocess.pyo331000644editdlrm
sunau.py172220644editdlrm
sunau.pyc190180644editdlrm
sunau.pyo190180644editdlrm
sunaudio.py13990644editdlrm
sunaudio.pyc20520644editdlrm
sunaudio.pyo20520644editdlrm
symbol.py20540755editdlrm
symbol.pyc30520644editdlrm
symbol.pyo30520644editdlrm
symtable.py74370644editdlrm
symtable.pyc124360644editdlrm
symtable.pyo123050644editdlrm
sysconfig.py228520644editdlrm
sysconfig.pyc181560644editdlrm
sysconfig.pyo181530644editdlrm
tabnanny.py113360755editdlrm
tabnanny.pyc85070644editdlrm
tabnanny.pyo85070644editdlrm
tarfile.py905680644editdlrm
tarfile.pyc783740644editdlrm
tarfile.pyo783740644editdlrm
telnetlib.py270360644editdlrm
telnetlib.pyc235830644editdlrm
telnetlib.pyo235830644editdlrm
tempfile.py195470644editdlrm
tempfile.pyc210460644editdlrm
tempfile.pyo210460644editdlrm
textwrap.py172800644editdlrm
textwrap.pyc122790644editdlrm
textwrap.pyo121870644editdlrm
this.py10020644editdlrm
this.pyc12330644editdlrm
this.pyo12330644editdlrm
threading.py472820644editdlrm
threading.pyc439990644editdlrm
threading.pyo418250644editdlrm
timeit.py127880755editdlrm
timeit.pyc123520644editdlrm
timeit.pyo123520644editdlrm
toaiff.py31420644editdlrm
toaiff.pyc31580644editdlrm
toaiff.pyo31580644editdlrm
token.py29220644editdlrm
token.pyc38810644editdlrm
token.pyo38810644editdlrm
tokenize.py174830644editdlrm
tokenize.pyc147130644editdlrm
tokenize.pyo146570644editdlrm
trace.py298880755editdlrm
trace.pyc232350644editdlrm
trace.pyo231720644editdlrm
traceback.py112850644editdlrm
traceback.pyc119390644editdlrm
traceback.pyo119390644editdlrm
tty.py8790644editdlrm
tty.pyc13560644editdlrm
tty.pyo13560644editdlrm
types.py20940644editdlrm
types.pyc28160644editdlrm
types.pyo28160644editdlrm
urllib.py602280644editdlrm
urllib.pyc525800644editdlrm
urllib.pyo524850644editdlrm
urllib2.py525370644editdlrm
urllib2.pyc489490644editdlrm
urllib2.pyo488540644editdlrm
urlparse.py166780644editdlrm
urlparse.pyc158860644editdlrm
urlparse.pyo158860644editdlrm
user.py16270644editdlrm
user.pyc17370644editdlrm
user.pyo17370644editdlrm
UserDict.py70600644editdlrm
UserDict.pyc102960644editdlrm
UserDict.pyo102960644editdlrm
UserList.py36440644editdlrm
UserList.pyc70190644editdlrm
UserList.pyo70190644editdlrm
UserString.py96840755editdlrm
UserString.pyc157480644editdlrm
UserString.pyo157480644editdlrm
uu.py66940755editdlrm
uu.pyc44550644editdlrm
uu.pyo44550644editdlrm
uuid.py231750644editdlrm
uuid.pyc237780644editdlrm
uuid.pyo236620644editdlrm
warnings.py148230644editdlrm
warnings.pyc138090644editdlrm
warnings.pyo130200644editdlrm
wave.py185820644editdlrm
wave.pyc206760644editdlrm
wave.pyo205320644editdlrm
weakref.py148300644editdlrm
weakref.pyc171300644editdlrm
weakref.pyo171300644editdlrm
webbrowser.py227220755editdlrm
webbrowser.pyc203350644editdlrm
webbrowser.pyo202900644editdlrm
whichdb.py33880644editdlrm
whichdb.pyc22670644editdlrm
whichdb.pyo22670644editdlrm
wsgiref.egg-info1870644editdlrm
xdrlib.py60690644editdlrm
xdrlib.pyc104480644editdlrm
xdrlib.pyo104480644editdlrm
xmllib.py348650644editdlrm
xmllib.pyc275500644editdlrm
xmllib.pyo275500644editdlrm
xmlrpclib.py521360644editdlrm
xmlrpclib.pyc458870644editdlrm
xmlrpclib.pyo457030644editdlrm
zipfile.py594770644editdlrm
zipfile.pyc429300644editdlrm
zipfile.pyo429300644editdlrm
_abcoll.py186190644editdlrm
_abcoll.pyc270340644editdlrm
_abcoll.pyo270340644editdlrm
_LWPCookieJar.py65530644editdlrm
_LWPCookieJar.pyc55120644editdlrm
_LWPCookieJar.pyo55120644editdlrm
_MozillaCookieJar.py57970644editdlrm
_MozillaCookieJar.pyc45130644editdlrm
_MozillaCookieJar.pyo44740644editdlrm
_osx_support.py191000644editdlrm
_osx_support.pyc120050644editdlrm
_osx_support.pyo120050644editdlrm
_pyio.py696300644editdlrm
_pyio.pyc669760644editdlrm
_pyio.pyo669760644editdlrm
_strptime.py207280644editdlrm
_strptime.pyc154320644editdlrm
_strptime.pyo154320644editdlrm
_sysconfigdata.py191820644editdlrm
_sysconfigdata.pyc223610644editdlrm
_sysconfigdata.pyo223610644editdlrm
_threading_local.py72600644editdlrm
_threading_local.pyc64900644editdlrm
_threading_local.pyo64900644editdlrm
_weakrefset.py59110644editdlrm
_weakrefset.pyc103020644editdlrm
_weakrefset.pyo103020644editdlrm
__future__.py43800644editdlrm
__future__.pyc43010644editdlrm
__future__.pyo43010644editdlrm
__phello__.foo.py640644editdlrm
__phello__.foo.pyc1380644editdlrm
__phello__.foo.pyo1380644editdlrm
Edit: /opt/alt/python27/lib64/python2.7/platform.py (52785B)
#! /bin/env python """ This module tries to retrieve as much platform-identifying data as possible. It makes this information available via function APIs. If called from the command line, it prints the platform information concatenated as single string to stdout. The output format is useable as part of a filename. """ # This module is maintained by Marc-Andre Lemburg . # If you find problems, please submit bug reports/patches via the # Python bug tracker (http://bugs.python.org) and assign them to "lemburg". # # Note: Please keep this module compatible to Python 1.5.2. # # Still needed: # * more support for WinCE # * support for MS-DOS (PythonDX ?) # * support for Amiga and other still unsupported platforms running Python # * support for additional Linux distributions # # Many thanks to all those who helped adding platform-specific # checks (in no particular order): # # Charles G Waldman, David Arnold, Gordon McMillan, Ben Darnell, # Jeff Bauer, Cliff Crawford, Ivan Van Laningham, Josef # Betancourt, Randall Hopper, Karl Putland, John Farrell, Greg # Andruk, Just van Rossum, Thomas Heller, Mark R. Levinson, Mark # Hammond, Bill Tutt, Hans Nowak, Uwe Zessin (OpenVMS support), # Colin Kong, Trent Mick, Guido van Rossum, Anthony Baxter, Steve # Dower # # History: # # # # 1.0.8 - changed Windows support to read version from kernel32.dll # 1.0.7 - added DEV_NULL # 1.0.6 - added linux_distribution() # 1.0.5 - fixed Java support to allow running the module on Jython # 1.0.4 - added IronPython support # 1.0.3 - added normalization of Windows system name # 1.0.2 - added more Windows support # 1.0.1 - reformatted to make doc.py happy # 1.0.0 - reformatted a bit and checked into Python CVS # 0.8.0 - added sys.version parser and various new access # APIs (python_version(), python_compiler(), etc.) # 0.7.2 - fixed architecture() to use sizeof(pointer) where available # 0.7.1 - added support for Caldera OpenLinux # 0.7.0 - some fixes for WinCE; untabified the source file # 0.6.2 - support for OpenVMS - requires version 1.5.2-V006 or higher and # vms_lib.getsyi() configured # 0.6.1 - added code to prevent 'uname -p' on platforms which are # known not to support it # 0.6.0 - fixed win32_ver() to hopefully work on Win95,98,NT and Win2k; # did some cleanup of the interfaces - some APIs have changed # 0.5.5 - fixed another type in the MacOS code... should have # used more coffee today ;-) # 0.5.4 - fixed a few typos in the MacOS code # 0.5.3 - added experimental MacOS support; added better popen() # workarounds in _syscmd_ver() -- still not 100% elegant # though # 0.5.2 - fixed uname() to return '' instead of 'unknown' in all # return values (the system uname command tends to return # 'unknown' instead of just leaving the field empty) # 0.5.1 - included code for slackware dist; added exception handlers # to cover up situations where platforms don't have os.popen # (e.g. Mac) or fail on socket.gethostname(); fixed libc # detection RE # 0.5.0 - changed the API names referring to system commands to *syscmd*; # added java_ver(); made syscmd_ver() a private # API (was system_ver() in previous versions) -- use uname() # instead; extended the win32_ver() to also return processor # type information # 0.4.0 - added win32_ver() and modified the platform() output for WinXX # 0.3.4 - fixed a bug in _follow_symlinks() # 0.3.3 - fixed popen() and "file" command invokation bugs # 0.3.2 - added architecture() API and support for it in platform() # 0.3.1 - fixed syscmd_ver() RE to support Windows NT # 0.3.0 - added system alias support # 0.2.3 - removed 'wince' again... oh well. # 0.2.2 - added 'wince' to syscmd_ver() supported platforms # 0.2.1 - added cache logic and changed the platform string format # 0.2.0 - changed the API to use functions instead of module globals # since some action take too long to be run on module import # 0.1.0 - first release # # You can always get the latest version of this module at: # # http://www.egenix.com/files/python/platform.py # # If that URL should fail, try contacting the author. __copyright__ = """ Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee or royalty is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation or portions thereof, including modifications, that you make. EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! """ __version__ = '1.0.7' import sys,string,os,re ### Globals & Constants # Determine the platform's /dev/null device try: DEV_NULL = os.devnull except AttributeError: # os.devnull was added in Python 2.4, so emulate it for earlier # Python versions if sys.platform in ('dos','win32','win16','os2'): # Use the old CP/M NUL as device name DEV_NULL = 'NUL' else: # Standard Unix uses /dev/null DEV_NULL = '/dev/null' # Helper for comparing two version number strings. # Based on the description of the PHP's version_compare(): # http://php.net/manual/en/function.version-compare.php _ver_stages = { # any string not found in this dict, will get 0 assigned 'dev': 10, 'alpha': 20, 'a': 20, 'beta': 30, 'b': 30, 'c': 40, 'RC': 50, 'rc': 50, # number, will get 100 assigned 'pl': 200, 'p': 200, } _component_re = re.compile(r'([0-9]+|[._+-])') def _comparable_version(version): result = [] for v in _component_re.split(version): if v not in '._+-': try: v = int(v, 10) t = 100 except ValueError: t = _ver_stages.get(v, 0) result.extend((t, v)) return result ### Platform specific APIs _libc_search = re.compile(r'(__libc_init)' '|' '(GLIBC_([0-9.]+))' '|' '(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)') def libc_ver(executable=sys.executable,lib='',version='', chunksize=2048): """ Tries to determine the libc version that the file executable (which defaults to the Python interpreter) is linked against. Returns a tuple of strings (lib,version) which default to the given parameters in case the lookup fails. Note that the function has intimate knowledge of how different libc versions add symbols to the executable and thus is probably only useable for executables compiled using gcc. The file is read and scanned in chunks of chunksize bytes. """ V = _comparable_version if hasattr(os.path, 'realpath'): # Python 2.2 introduced os.path.realpath(); it is used # here to work around problems with Cygwin not being # able to open symlinks for reading executable = os.path.realpath(executable) with open(executable, 'rb') as f: binary = f.read(chunksize) pos = 0 while pos < len(binary): if 'libc' in binary or 'GLIBC' in binary: m = _libc_search.search(binary, pos) else: m = None if not m or m.end() == len(binary): chunk = f.read(chunksize) if chunk: binary = binary[max(pos, len(binary) - 1000):] + chunk pos = 0 continue if not m: break libcinit,glibc,glibcversion,so,threads,soversion = m.groups() if libcinit and not lib: lib = 'libc' elif glibc: if lib != 'glibc': lib = 'glibc' version = glibcversion elif V(glibcversion) > V(version): version = glibcversion elif so: if lib != 'glibc': lib = 'libc' if soversion and (not version or V(soversion) > V(version)): version = soversion if threads and version[-len(threads):] != threads: version = version + threads pos = m.end() return lib,version def _dist_try_harder(distname,version,id): """ Tries some special tricks to get the distribution information in case the default method fails. Currently supports older SuSE Linux, Caldera OpenLinux and Slackware Linux distributions. """ if os.path.exists('/var/adm/inst-log/info'): # SuSE Linux stores distribution information in that file info = open('/var/adm/inst-log/info').readlines() distname = 'SuSE' for line in info: tv = string.split(line) if len(tv) == 2: tag,value = tv else: continue if tag == 'MIN_DIST_VERSION': version = string.strip(value) elif tag == 'DIST_IDENT': values = string.split(value,'-') id = values[2] return distname,version,id if os.path.exists('/etc/.installed'): # Caldera OpenLinux has some infos in that file (thanks to Colin Kong) info = open('/etc/.installed').readlines() for line in info: pkg = string.split(line,'-') if len(pkg) >= 2 and pkg[0] == 'OpenLinux': # XXX does Caldera support non Intel platforms ? If yes, # where can we find the needed id ? return 'OpenLinux',pkg[1],id if os.path.isdir('/usr/lib/setup'): # Check for slackware version tag file (thanks to Greg Andruk) verfiles = os.listdir('/usr/lib/setup') for n in range(len(verfiles)-1, -1, -1): if verfiles[n][:14] != 'slack-version-': del verfiles[n] if verfiles: verfiles.sort() distname = 'slackware' version = verfiles[-1][14:] return distname,version,id return distname,version,id _release_filename = re.compile(r'(\w+)[-_](release|version)') _lsb_release_version = re.compile(r'(.+)' ' release ' '([\d.]+)' '[^(]*(?:\((.+)\))?') _release_version = re.compile(r'([^0-9]+)' '(?: release )?' '([\d.]+)' '[^(]*(?:\((.+)\))?') # See also http://www.novell.com/coolsolutions/feature/11251.html # and http://linuxmafia.com/faq/Admin/release-files.html # and http://data.linux-ntfs.org/rpm/whichrpm # and http://www.die.net/doc/linux/man/man1/lsb_release.1.html _supported_dists = ( 'SuSE', 'debian', 'fedora', 'redhat', 'centos', 'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo', 'UnitedLinux', 'turbolinux') def _parse_release_file(firstline): # Default to empty 'version' and 'id' strings. Both defaults are used # when 'firstline' is empty. 'id' defaults to empty when an id can not # be deduced. version = '' id = '' # Parse the first line m = _lsb_release_version.match(firstline) if m is not None: # LSB format: "distro release x.x (codename)" return tuple(m.groups()) # Pre-LSB format: "distro x.x (codename)" m = _release_version.match(firstline) if m is not None: return tuple(m.groups()) # Unknown format... take the first two words l = string.split(string.strip(firstline)) if l: version = l[0] if len(l) > 1: id = l[1] return '', version, id def linux_distribution(distname='', version='', id='', supported_dists=_supported_dists, full_distribution_name=1): """ Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. supported_dists may be given to define the set of Linux distributions to look for. It defaults to a list of currently supported Linux distributions identified by their release file name. If full_distribution_name is true (default), the full distribution read from the OS is returned. Otherwise the short name taken from supported_dists is used. Returns a tuple (distname,version,id) which default to the args given as parameters. """ try: etc = os.listdir('/etc') except os.error: # Probably not a Unix system return distname,version,id etc.sort() for file in etc: m = _release_filename.match(file) if m is not None: _distname,dummy = m.groups() if _distname in supported_dists: distname = _distname break else: return _dist_try_harder(distname,version,id) # Read the first line f = open('/etc/'+file, 'r') firstline = f.readline() f.close() _distname, _version, _id = _parse_release_file(firstline) if _distname and full_distribution_name: distname = _distname if _version: version = _version if _id: id = _id return distname, version, id # To maintain backwards compatibility: def dist(distname='',version='',id='', supported_dists=_supported_dists): """ Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. Returns a tuple (distname,version,id) which default to the args given as parameters. """ return linux_distribution(distname, version, id, supported_dists=supported_dists, full_distribution_name=0) class _popen: """ Fairly portable (alternative) popen implementation. This is mostly needed in case os.popen() is not available, or doesn't work as advertised, e.g. in Win9X GUI programs like PythonWin or IDLE. Writing to the pipe is currently not supported. """ tmpfile = '' pipe = None bufsize = None mode = 'r' def __init__(self,cmd,mode='r',bufsize=None): if mode != 'r': raise ValueError,'popen()-emulation only supports read mode' import tempfile self.tmpfile = tmpfile = tempfile.mktemp() os.system(cmd + ' > %s' % tmpfile) self.pipe = open(tmpfile,'rb') self.bufsize = bufsize self.mode = mode def read(self): return self.pipe.read() def readlines(self): if self.bufsize is not None: return self.pipe.readlines() def close(self, remove=os.unlink,error=os.error): if self.pipe: rc = self.pipe.close() else: rc = 255 if self.tmpfile: try: remove(self.tmpfile) except error: pass return rc # Alias __del__ = close def popen(cmd, mode='r', bufsize=None): """ Portable popen() interface. """ # Find a working popen implementation preferring win32pipe.popen # over os.popen over _popen popen = None if os.environ.get('OS','') == 'Windows_NT': # On NT win32pipe should work; on Win9x it hangs due to bugs # in the MS C lib (see MS KnowledgeBase article Q150956) try: import win32pipe except ImportError: pass else: popen = win32pipe.popen if popen is None: if hasattr(os,'popen'): popen = os.popen # Check whether it works... it doesn't in GUI programs # on Windows platforms if sys.platform == 'win32': # XXX Others too ? try: popen('') except os.error: popen = _popen else: popen = _popen if bufsize is None: return popen(cmd,mode) else: return popen(cmd,mode,bufsize) def _norm_version(version, build=''): """ Normalize the version and build strings and return a single version string using the format major.minor.build (or patchlevel). """ l = string.split(version,'.') if build: l.append(build) try: ints = map(int,l) except ValueError: strings = l else: strings = map(str,ints) version = string.join(strings[:3],'.') return version _ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) ' '.*' '\[.* ([\d.]+)\])') # Examples of VER command output: # # Windows 2000: Microsoft Windows 2000 [Version 5.00.2195] # Windows XP: Microsoft Windows XP [Version 5.1.2600] # Windows Vista: Microsoft Windows [Version 6.0.6002] # # Note that the "Version" string gets localized on different # Windows versions. def _syscmd_ver(system='', release='', version='', supported_platforms=('win32','win16','dos','os2')): """ Tries to figure out the OS version used and returns a tuple (system,release,version). It uses the "ver" shell command for this which is known to exists on Windows, DOS and OS/2. XXX Others too ? In case this fails, the given parameters are used as defaults. """ if sys.platform not in supported_platforms: return system,release,version # Try some common cmd strings for cmd in ('ver','command /c ver','cmd /c ver'): try: pipe = popen(cmd) info = pipe.read() if pipe.close(): raise os.error,'command failed' # XXX How can I suppress shell errors from being written # to stderr ? except os.error,why: #print 'Command %s failed: %s' % (cmd,why) continue except IOError,why: #print 'Command %s failed: %s' % (cmd,why) continue else: break else: return system,release,version # Parse the output info = string.strip(info) m = _ver_output.match(info) if m is not None: system,release,version = m.groups() # Strip trailing dots from version and release if release[-1] == '.': release = release[:-1] if version[-1] == '.': version = version[:-1] # Normalize the version and build strings (eliminating additional # zeros) version = _norm_version(version) return system,release,version _WIN32_CLIENT_RELEASES = { (5, 0): "2000", (5, 1): "XP", # Strictly, 5.2 client is XP 64-bit, but platform.py historically # has always called it 2003 Server (5, 2): "2003Server", (5, None): "post2003", (6, 0): "Vista", (6, 1): "7", (6, 2): "8", (6, 3): "8.1", (6, None): "post8.1", (10, 0): "10", (10, None): "post10", } # Server release name lookup will default to client names if necessary _WIN32_SERVER_RELEASES = { (5, 2): "2003Server", (6, 0): "2008Server", (6, 1): "2008ServerR2", (6, 2): "2012Server", (6, 3): "2012ServerR2", (6, None): "post2012ServerR2", } def _get_real_winver(maj, min, build): if maj < 6 or (maj == 6 and min < 2): return maj, min, build from ctypes import (c_buffer, POINTER, byref, create_unicode_buffer, Structure, WinDLL, _Pointer) from ctypes.wintypes import DWORD, HANDLE class VS_FIXEDFILEINFO(Structure): _fields_ = [ ("dwSignature", DWORD), ("dwStrucVersion", DWORD), ("dwFileVersionMS", DWORD), ("dwFileVersionLS", DWORD), ("dwProductVersionMS", DWORD), ("dwProductVersionLS", DWORD), ("dwFileFlagsMask", DWORD), ("dwFileFlags", DWORD), ("dwFileOS", DWORD), ("dwFileType", DWORD), ("dwFileSubtype", DWORD), ("dwFileDateMS", DWORD), ("dwFileDateLS", DWORD), ] class PVS_FIXEDFILEINFO(_Pointer): _type_ = VS_FIXEDFILEINFO kernel32 = WinDLL('kernel32') version = WinDLL('version') # We will immediately double the length up to MAX_PATH, but the # path may be longer, so we retry until the returned string is # shorter than our buffer. name_len = actual_len = 130 while actual_len == name_len: name_len *= 2 name = create_unicode_buffer(name_len) actual_len = kernel32.GetModuleFileNameW(HANDLE(kernel32._handle), name, len(name)) if not actual_len: return maj, min, build size = version.GetFileVersionInfoSizeW(name, None) if not size: return maj, min, build ver_block = c_buffer(size) if (not version.GetFileVersionInfoW(name, None, size, ver_block) or not ver_block): return maj, min, build pvi = PVS_FIXEDFILEINFO() if not version.VerQueryValueW(ver_block, "", byref(pvi), byref(DWORD())): return maj, min, build maj = pvi.contents.dwProductVersionMS >> 16 min = pvi.contents.dwProductVersionMS & 0xFFFF build = pvi.contents.dwProductVersionLS >> 16 return maj, min, build def win32_ver(release='', version='', csd='', ptype=''): try: from sys import getwindowsversion except ImportError: return release, version, csd, ptype try: from winreg import OpenKeyEx, QueryValueEx, CloseKey, HKEY_LOCAL_MACHINE except ImportError: from _winreg import OpenKeyEx, QueryValueEx, CloseKey, HKEY_LOCAL_MACHINE winver = getwindowsversion() maj, min, build = _get_real_winver(*winver[:3]) version = '{0}.{1}.{2}'.format(maj, min, build) release = (_WIN32_CLIENT_RELEASES.get((maj, min)) or _WIN32_CLIENT_RELEASES.get((maj, None)) or release) # getwindowsversion() reflect the compatibility mode Python is # running under, and so the service pack value is only going to be # valid if the versions match. if winver[:2] == (maj, min): try: csd = 'SP{}'.format(winver.service_pack_major) except AttributeError: if csd[:13] == 'Service Pack ': csd = 'SP' + csd[13:] # VER_NT_SERVER = 3 if getattr(winver, 'product_type', None) == 3: release = (_WIN32_SERVER_RELEASES.get((maj, min)) or _WIN32_SERVER_RELEASES.get((maj, None)) or release) key = None try: key = OpenKeyEx(HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows NT\CurrentVersion') ptype = QueryValueEx(key, 'CurrentType')[0] except: pass finally: if key: CloseKey(key) return release, version, csd, ptype def _mac_ver_lookup(selectors,default=None): from gestalt import gestalt import MacOS l = [] append = l.append for selector in selectors: try: append(gestalt(selector)) except (RuntimeError, MacOS.Error): append(default) return l def _bcd2str(bcd): return hex(bcd)[2:] def _mac_ver_gestalt(): """ Thanks to Mark R. Levinson for mailing documentation links and code examples for this function. Documentation for the gestalt() API is available online at: http://www.rgaros.nl/gestalt/ """ # Check whether the version info module is available try: import gestalt import MacOS except ImportError: return None # Get the infos sysv,sysa = _mac_ver_lookup(('sysv','sysa')) # Decode the infos if sysv: major = (sysv & 0xFF00) >> 8 minor = (sysv & 0x00F0) >> 4 patch = (sysv & 0x000F) if (major, minor) >= (10, 4): # the 'sysv' gestald cannot return patchlevels # higher than 9. Apple introduced 3 new # gestalt codes in 10.4 to deal with this # issue (needed because patch levels can # run higher than 9, such as 10.4.11) major,minor,patch = _mac_ver_lookup(('sys1','sys2','sys3')) release = '%i.%i.%i' %(major, minor, patch) else: release = '%s.%i.%i' % (_bcd2str(major),minor,patch) if sysa: machine = {0x1: '68k', 0x2: 'PowerPC', 0xa: 'i386'}.get(sysa,'') versioninfo=('', '', '') return release,versioninfo,machine def _mac_ver_xml(): fn = '/System/Library/CoreServices/SystemVersion.plist' if not os.path.exists(fn): return None try: import plistlib except ImportError: return None pl = plistlib.readPlist(fn) release = pl['ProductVersion'] versioninfo=('', '', '') machine = os.uname()[4] if machine in ('ppc', 'Power Macintosh'): # for compatibility with the gestalt based code machine = 'PowerPC' return release,versioninfo,machine def mac_ver(release='',versioninfo=('','',''),machine=''): """ Get MacOS version information and return it as tuple (release, versioninfo, machine) with versioninfo being a tuple (version, dev_stage, non_release_version). Entries which cannot be determined are set to the parameter values which default to ''. All tuple entries are strings. """ # First try reading the information from an XML file which should # always be present info = _mac_ver_xml() if info is not None: return info # If that doesn't work for some reason fall back to reading the # information using gestalt calls. info = _mac_ver_gestalt() if info is not None: return info # If that also doesn't work return the default values return release,versioninfo,machine def _java_getprop(name,default): from java.lang import System try: value = System.getProperty(name) if value is None: return default return value except AttributeError: return default def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')): """ Version interface for Jython. Returns a tuple (release,vendor,vminfo,osinfo) with vminfo being a tuple (vm_name,vm_release,vm_vendor) and osinfo being a tuple (os_name,os_version,os_arch). Values which cannot be determined are set to the defaults given as parameters (which all default to ''). """ # Import the needed APIs try: import java.lang except ImportError: return release,vendor,vminfo,osinfo vendor = _java_getprop('java.vendor', vendor) release = _java_getprop('java.version', release) vm_name, vm_release, vm_vendor = vminfo vm_name = _java_getprop('java.vm.name', vm_name) vm_vendor = _java_getprop('java.vm.vendor', vm_vendor) vm_release = _java_getprop('java.vm.version', vm_release) vminfo = vm_name, vm_release, vm_vendor os_name, os_version, os_arch = osinfo os_arch = _java_getprop('java.os.arch', os_arch) os_name = _java_getprop('java.os.name', os_name) os_version = _java_getprop('java.os.version', os_version) osinfo = os_name, os_version, os_arch return release, vendor, vminfo, osinfo ### System name aliasing def system_alias(system,release,version): """ Returns (system,release,version) aliased to common marketing names used for some systems. It also does some reordering of the information in some cases where it would otherwise cause confusion. """ if system == 'Rhapsody': # Apple's BSD derivative # XXX How can we determine the marketing release number ? return 'MacOS X Server',system+release,version elif system == 'SunOS': # Sun's OS if release < '5': # These releases use the old name SunOS return system,release,version # Modify release (marketing release = SunOS release - 3) l = string.split(release,'.') if l: try: major = int(l[0]) except ValueError: pass else: major = major - 3 l[0] = str(major) release = string.join(l,'.') if release < '6': system = 'Solaris' else: # XXX Whatever the new SunOS marketing name is... system = 'Solaris' elif system == 'IRIX64': # IRIX reports IRIX64 on platforms with 64-bit support; yet it # is really a version and not a different platform, since 32-bit # apps are also supported.. system = 'IRIX' if version: version = version + ' (64bit)' else: version = '64bit' elif system in ('win32','win16'): # In case one of the other tricks system = 'Windows' return system,release,version ### Various internal helpers def _platform(*args): """ Helper to format the platform string in a filename compatible format e.g. "system-version-machine". """ # Format the platform string platform = string.join( map(string.strip, filter(len, args)), '-') # Cleanup some possible filename obstacles... replace = string.replace platform = replace(platform,' ','_') platform = replace(platform,'/','-') platform = replace(platform,'\\','-') platform = replace(platform,':','-') platform = replace(platform,';','-') platform = replace(platform,'"','-') platform = replace(platform,'(','-') platform = replace(platform,')','-') # No need to report 'unknown' information... platform = replace(platform,'unknown','') # Fold '--'s and remove trailing '-' while 1: cleaned = replace(platform,'--','-') if cleaned == platform: break platform = cleaned while platform[-1] == '-': platform = platform[:-1] return platform def _node(default=''): """ Helper to determine the node name of this machine. """ try: import socket except ImportError: # No sockets... return default try: return socket.gethostname() except socket.error: # Still not working... return default # os.path.abspath is new in Python 1.5.2: if not hasattr(os.path,'abspath'): def _abspath(path, isabs=os.path.isabs,join=os.path.join,getcwd=os.getcwd, normpath=os.path.normpath): if not isabs(path): path = join(getcwd(), path) return normpath(path) else: _abspath = os.path.abspath def _follow_symlinks(filepath): """ In case filepath is a symlink, follow it until a real file is reached. """ filepath = _abspath(filepath) while os.path.islink(filepath): filepath = os.path.normpath( os.path.join(os.path.dirname(filepath),os.readlink(filepath))) return filepath def _syscmd_uname(option,default=''): """ Interface to the system's uname command. """ if sys.platform in ('dos','win32','win16','os2'): # XXX Others too ? return default try: f = os.popen('uname %s 2> %s' % (option, DEV_NULL)) except (AttributeError,os.error): return default output = string.strip(f.read()) rc = f.close() if not output or rc: return default else: return output def _syscmd_file(target,default=''): """ Interface to the system's file command. The function uses the -b option of the file command to have it ommit the filename in its output and if possible the -L option to have the command follow symlinks. It returns default in case the command should fail. """ # We do the import here to avoid a bootstrap issue. # See c73b90b6dadd changeset. # # [..] # ranlib libpython2.7.a # gcc -o python \ # Modules/python.o \ # libpython2.7.a -lsocket -lnsl -ldl -lm # Traceback (most recent call last): # File "./setup.py", line 8, in # from platform import machine as platform_machine # File "[..]/build/Lib/platform.py", line 116, in # import sys,string,os,re,subprocess # File "[..]/build/Lib/subprocess.py", line 429, in # import select # ImportError: No module named select import subprocess if sys.platform in ('dos','win32','win16','os2'): # XXX Others too ? return default target = _follow_symlinks(target) try: proc = subprocess.Popen(['file', target], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) except (AttributeError,os.error): return default output = proc.communicate()[0] rc = proc.wait() if not output or rc: return default else: return output ### Information about the used architecture # Default values for architecture; non-empty strings override the # defaults given as parameters _default_architecture = { 'win32': ('','WindowsPE'), 'win16': ('','Windows'), 'dos': ('','MSDOS'), } _architecture_split = re.compile(r'[\s,]').split def architecture(executable=sys.executable,bits='',linkage=''): """ Queries the given executable (defaults to the Python interpreter binary) for various architecture information. Returns a tuple (bits,linkage) which contains information about the bit architecture and the linkage format used for the executable. Both values are returned as strings. Values that cannot be determined are returned as given by the parameter presets. If bits is given as '', the sizeof(pointer) (or sizeof(long) on Python version < 1.5.2) is used as indicator for the supported pointer size. The function relies on the system's "file" command to do the actual work. This is available on most if not all Unix platforms. On some non-Unix platforms where the "file" command does not exist and the executable is set to the Python interpreter binary defaults from _default_architecture are used. """ # Use the sizeof(pointer) as default number of bits if nothing # else is given as default. if not bits: import struct try: size = struct.calcsize('P') except struct.error: # Older installations can only query longs size = struct.calcsize('l') bits = str(size*8) + 'bit' # Get data from the 'file' system command if executable: output = _syscmd_file(executable, '') else: output = '' if not output and \ executable == sys.executable: # "file" command did not return anything; we'll try to provide # some sensible defaults then... if sys.platform in _default_architecture: b, l = _default_architecture[sys.platform] if b: bits = b if l: linkage = l return bits, linkage # Split the output into a list of strings omitting the filename fileout = _architecture_split(output)[1:] if 'executable' not in fileout: # Format not supported return bits,linkage # Bits if '32-bit' in fileout: bits = '32bit' elif 'N32' in fileout: # On Irix only bits = 'n32bit' elif '64-bit' in fileout: bits = '64bit' # Linkage if 'ELF' in fileout: linkage = 'ELF' elif 'PE' in fileout: # E.g. Windows uses this format if 'Windows' in fileout: linkage = 'WindowsPE' else: linkage = 'PE' elif 'COFF' in fileout: linkage = 'COFF' elif 'MS-DOS' in fileout: linkage = 'MSDOS' else: # XXX the A.OUT format also falls under this class... pass return bits,linkage ### Portable uname() interface _uname_cache = None def uname(): """ Fairly portable uname interface. Returns a tuple of strings (system,node,release,version,machine,processor) identifying the underlying platform. Note that unlike the os.uname function this also returns possible processor information as an additional tuple entry. Entries which cannot be determined are set to ''. """ global _uname_cache no_os_uname = 0 if _uname_cache is not None: return _uname_cache processor = '' # Get some infos from the builtin os.uname API... try: system,node,release,version,machine = os.uname() except AttributeError: no_os_uname = 1 if no_os_uname or not filter(None, (system, node, release, version, machine)): # Hmm, no there is either no uname or uname has returned #'unknowns'... we'll have to poke around the system then. if no_os_uname: system = sys.platform release = '' version = '' node = _node() machine = '' use_syscmd_ver = 1 # Try win32_ver() on win32 platforms if system == 'win32': release,version,csd,ptype = win32_ver() if release and version: use_syscmd_ver = 0 # Try to use the PROCESSOR_* environment variables # available on Win XP and later; see # http://support.microsoft.com/kb/888731 and # http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM if not machine: # WOW64 processes mask the native architecture if "PROCESSOR_ARCHITEW6432" in os.environ: machine = os.environ.get("PROCESSOR_ARCHITEW6432", '') else: machine = os.environ.get('PROCESSOR_ARCHITECTURE', '') if not processor: processor = os.environ.get('PROCESSOR_IDENTIFIER', machine) # Try the 'ver' system command available on some # platforms if use_syscmd_ver: system,release,version = _syscmd_ver(system) # Normalize system to what win32_ver() normally returns # (_syscmd_ver() tends to return the vendor name as well) if system == 'Microsoft Windows': system = 'Windows' elif system == 'Microsoft' and release == 'Windows': # Under Windows Vista and Windows Server 2008, # Microsoft changed the output of the ver command. The # release is no longer printed. This causes the # system and release to be misidentified. system = 'Windows' if '6.0' == version[:3]: release = 'Vista' else: release = '' # In case we still don't know anything useful, we'll try to # help ourselves if system in ('win32','win16'): if not version: if system == 'win32': version = '32bit' else: version = '16bit' system = 'Windows' elif system[:4] == 'java': release,vendor,vminfo,osinfo = java_ver() system = 'Java' version = string.join(vminfo,', ') if not version: version = vendor # System specific extensions if system == 'OpenVMS': # OpenVMS seems to have release and version mixed up if not release or release == '0': release = version version = '' # Get processor information try: import vms_lib except ImportError: pass else: csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0) if (cpu_number >= 128): processor = 'Alpha' else: processor = 'VAX' if not processor: # Get processor information from the uname system command processor = _syscmd_uname('-p','') #If any unknowns still exist, replace them with ''s, which are more portable if system == 'unknown': system = '' if node == 'unknown': node = '' if release == 'unknown': release = '' if version == 'unknown': version = '' if machine == 'unknown': machine = '' if processor == 'unknown': processor = '' # normalize name if system == 'Microsoft' and release == 'Windows': system = 'Windows' release = 'Vista' _uname_cache = system,node,release,version,machine,processor return _uname_cache ### Direct interfaces to some of the uname() return values def system(): """ Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'. An empty string is returned if the value cannot be determined. """ return uname()[0] def node(): """ Returns the computer's network name (which may not be fully qualified) An empty string is returned if the value cannot be determined. """ return uname()[1] def release(): """ Returns the system's release, e.g. '2.2.0' or 'NT' An empty string is returned if the value cannot be determined. """ return uname()[2] def version(): """ Returns the system's release version, e.g. '#3 on degas' An empty string is returned if the value cannot be determined. """ return uname()[3] def machine(): """ Returns the machine type, e.g. 'i386' An empty string is returned if the value cannot be determined. """ return uname()[4] def processor(): """ Returns the (true) processor name, e.g. 'amdk6' An empty string is returned if the value cannot be determined. Note that many platforms do not provide this information or simply return the same value as for machine(), e.g. NetBSD does this. """ return uname()[5] ### Various APIs for extracting information from sys.version _sys_version_parser = re.compile( r'([\w.+]+)\s*' # "version" r'\(#?([^,]+)' # "(#buildno" r'(?:,\s*([\w ]*)' # ", builddate" r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)" r'\[([^\]]+)\]?') # "[compiler]" _ironpython_sys_version_parser = re.compile( r'IronPython\s*' '([\d\.]+)' '(?: \(([\d\.]+)\))?' ' on (.NET [\d\.]+)') # IronPython covering 2.6 and 2.7 _ironpython26_sys_version_parser = re.compile( r'([\d.]+)\s*' '\(IronPython\s*' '[\d.]+\s*' '\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)' ) _pypy_sys_version_parser = re.compile( r'([\w.+]+)\s*' '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*' '\[PyPy [^\]]+\]?') _sys_version_cache = {} def _sys_version(sys_version=None): """ Returns a parsed version of Python's sys.version as tuple (name, version, branch, revision, buildno, builddate, compiler) referring to the Python implementation name, version, branch, revision, build number, build date/time as string and the compiler identification string. Note that unlike the Python sys.version, the returned value for the Python version will always include the patchlevel (it defaults to '.0'). The function returns empty strings for tuple entries that cannot be determined. sys_version may be given to parse an alternative version string, e.g. if the version was read from a different Python interpreter. """ # Get the Python version if sys_version is None: sys_version = sys.version # Try the cache first result = _sys_version_cache.get(sys_version, None) if result is not None: return result # Parse it if 'IronPython' in sys_version: # IronPython name = 'IronPython' if sys_version.startswith('IronPython'): match = _ironpython_sys_version_parser.match(sys_version) else: match = _ironpython26_sys_version_parser.match(sys_version) if match is None: raise ValueError( 'failed to parse IronPython sys.version: %s' % repr(sys_version)) version, alt_version, compiler = match.groups() buildno = '' builddate = '' elif sys.platform.startswith('java'): # Jython name = 'Jython' match = _sys_version_parser.match(sys_version) if match is None: raise ValueError( 'failed to parse Jython sys.version: %s' % repr(sys_version)) version, buildno, builddate, buildtime, _ = match.groups() if builddate is None: builddate = '' compiler = sys.platform elif "PyPy" in sys_version: # PyPy name = "PyPy" match = _pypy_sys_version_parser.match(sys_version) if match is None: raise ValueError("failed to parse PyPy sys.version: %s" % repr(sys_version)) version, buildno, builddate, buildtime = match.groups() compiler = "" else: # CPython match = _sys_version_parser.match(sys_version) if match is None: raise ValueError( 'failed to parse CPython sys.version: %s' % repr(sys_version)) version, buildno, builddate, buildtime, compiler = \ match.groups() name = 'CPython' if builddate is None: builddate = '' elif buildtime: builddate = builddate + ' ' + buildtime if hasattr(sys, 'subversion'): # sys.subversion was added in Python 2.5 _, branch, revision = sys.subversion else: branch = '' revision = '' # Add the patchlevel version if missing l = string.split(version, '.') if len(l) == 2: l.append('0') version = string.join(l, '.') # Build and cache the result result = (name, version, branch, revision, buildno, builddate, compiler) _sys_version_cache[sys_version] = result return result def python_implementation(): """ Returns a string identifying the Python implementation. Currently, the following implementations are identified: 'CPython' (C implementation of Python), 'IronPython' (.NET implementation of Python), 'Jython' (Java implementation of Python), 'PyPy' (Python implementation of Python). """ return _sys_version()[0] def python_version(): """ Returns the Python version as string 'major.minor.patchlevel' Note that unlike the Python sys.version, the returned value will always include the patchlevel (it defaults to 0). """ return _sys_version()[1] def python_version_tuple(): """ Returns the Python version as tuple (major, minor, patchlevel) of strings. Note that unlike the Python sys.version, the returned value will always include the patchlevel (it defaults to 0). """ return tuple(string.split(_sys_version()[1], '.')) def python_branch(): """ Returns a string identifying the Python implementation branch. For CPython this is the Subversion branch from which the Python binary was built. If not available, an empty string is returned. """ return _sys_version()[2] def python_revision(): """ Returns a string identifying the Python implementation revision. For CPython this is the Subversion revision from which the Python binary was built. If not available, an empty string is returned. """ return _sys_version()[3] def python_build(): """ Returns a tuple (buildno, builddate) stating the Python build number and date as strings. """ return _sys_version()[4:6] def python_compiler(): """ Returns a string identifying the compiler used for compiling Python. """ return _sys_version()[6] ### The Opus Magnum of platform strings :-) _platform_cache = {} def platform(aliased=0, terse=0): """ Returns a single string identifying the underlying platform with as much useful information as possible (but no more :). The output is intended to be human readable rather than machine parseable. It may look different on different platforms and this is intended. If "aliased" is true, the function will use aliases for various platforms that report system names which differ from their common names, e.g. SunOS will be reported as Solaris. The system_alias() function is used to implement this. Setting terse to true causes the function to return only the absolute minimum information needed to identify the platform. """ result = _platform_cache.get((aliased, terse), None) if result is not None: return result # Get uname information and then apply platform specific cosmetics # to it... system,node,release,version,machine,processor = uname() if machine == processor: processor = '' if aliased: system,release,version = system_alias(system,release,version) if system == 'Windows': # MS platforms rel,vers,csd,ptype = win32_ver(version) if terse: platform = _platform(system,release) else: platform = _platform(system,release,version,csd) elif system in ('Linux',): # Linux based systems distname,distversion,distid = dist('') if distname and not terse: platform = _platform(system,release,machine,processor, 'with', distname,distversion,distid) else: # If the distribution name is unknown check for libc vs. glibc libcname,libcversion = libc_ver(sys.executable) platform = _platform(system,release,machine,processor, 'with', libcname+libcversion) elif system == 'Java': # Java platforms r,v,vminfo,(os_name,os_version,os_arch) = java_ver() if terse or not os_name: platform = _platform(system,release,version) else: platform = _platform(system,release,version, 'on', os_name,os_version,os_arch) elif system == 'MacOS': # MacOS platforms if terse: platform = _platform(system,release) else: platform = _platform(system,release,machine) else: # Generic handler if terse: platform = _platform(system,release) else: bits,linkage = architecture(sys.executable) platform = _platform(system,release,machine,processor,bits,linkage) _platform_cache[(aliased, terse)] = platform return platform ### Command line interface if __name__ == '__main__': # Default is to print the aliased verbose platform string terse = ('terse' in sys.argv or '--terse' in sys.argv) aliased = (not 'nonaliased' in sys.argv and not '--nonaliased' in sys.argv) print platform(aliased,terse) sys.exit(0)