aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/platform.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/platform.py')
-rwxr-xr-xLib/platform.py307
1 files changed, 122 insertions, 185 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index 030ef2a3a4b..48b81ac7e50 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -122,7 +122,7 @@ try:
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'):
+ if sys.platform in ('dos', 'win32', 'win16'):
# Use the old CP/M NUL as device name
DEV_NULL = 'NUL'
else:
@@ -141,7 +141,7 @@ _libc_search = re.compile(b'(__libc_init)'
b'|'
br'(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)', re.ASCII)
-def libc_ver(executable=sys.executable,lib='',version='',
+def libc_ver(executable=sys.executable, lib='', version='',
chunksize=16384):
@@ -163,12 +163,12 @@ def libc_ver(executable=sys.executable,lib='',version='',
# here to work around problems with Cygwin not being
# able to open symlinks for reading
executable = os.path.realpath(executable)
- f = open(executable,'rb')
+ f = open(executable, 'rb')
binary = f.read(chunksize)
pos = 0
while 1:
if b'libc' in binary or b'GLIBC' in binary:
- m = _libc_search.search(binary,pos)
+ m = _libc_search.search(binary, pos)
else:
m = None
if not m:
@@ -177,7 +177,7 @@ def libc_ver(executable=sys.executable,lib='',version='',
break
pos = 0
continue
- libcinit,glibc,glibcversion,so,threads,soversion = [
+ libcinit, glibc, glibcversion, so, threads, soversion = [
s.decode('latin1') if s is not None else s
for s in m.groups()]
if libcinit and not lib:
@@ -197,9 +197,9 @@ def libc_ver(executable=sys.executable,lib='',version='',
version = version + threads
pos = m.end()
f.close()
- return lib,version
+ return lib, version
-def _dist_try_harder(distname,version,id):
+def _dist_try_harder(distname, version, id):
""" Tries some special tricks to get the distribution
information in case the default method fails.
@@ -214,7 +214,7 @@ def _dist_try_harder(distname,version,id):
for line in open('/var/adm/inst-log/info'):
tv = line.split()
if len(tv) == 2:
- tag,value = tv
+ tag, value = tv
else:
continue
if tag == 'MIN_DIST_VERSION':
@@ -222,7 +222,7 @@ def _dist_try_harder(distname,version,id):
elif tag == 'DIST_IDENT':
values = value.split('-')
id = values[2]
- return distname,version,id
+ return distname, version, id
if os.path.exists('/etc/.installed'):
# Caldera OpenLinux has some infos in that file (thanks to Colin Kong)
@@ -231,7 +231,7 @@ def _dist_try_harder(distname,version,id):
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
+ return 'OpenLinux', pkg[1], id
if os.path.isdir('/usr/lib/setup'):
# Check for slackware version tag file (thanks to Greg Andruk)
@@ -243,9 +243,9 @@ def _dist_try_harder(distname,version,id):
verfiles.sort()
distname = 'slackware'
version = verfiles[-1][14:]
- return distname,version,id
+ return distname, version, id
- return distname,version,id
+ return distname, version, id
_release_filename = re.compile(r'(\w+)[-_](release|version)', re.ASCII)
_lsb_release_version = re.compile(r'(.+)'
@@ -314,25 +314,25 @@ def linux_distribution(distname='', version='', id='',
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
+ Returns a tuple (distname, version, id) which default to the
args given as parameters.
"""
try:
etc = os.listdir(_UNIXCONFDIR)
- except os.error:
+ except OSError:
# Probably not a Unix system
- return distname,version,id
+ return distname, version, id
etc.sort()
for file in etc:
m = _release_filename.match(file)
if m is not None:
- _distname,dummy = m.groups()
+ _distname, dummy = m.groups()
if _distname in supported_dists:
distname = _distname
break
else:
- return _dist_try_harder(distname,version,id)
+ return _dist_try_harder(distname, version, id)
# Read the first line
with open(os.path.join(_UNIXCONFDIR, file), 'r',
@@ -350,7 +350,7 @@ def linux_distribution(distname='', version='', id='',
# To maintain backwards compatibility:
-def dist(distname='',version='',id='',
+def dist(distname='', version='', id='',
supported_dists=_supported_dists):
@@ -360,7 +360,7 @@ def dist(distname='',version='',id='',
/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
+ Returns a tuple (distname, version, id) which default to the
args given as parameters.
"""
@@ -385,11 +385,11 @@ def _norm_version(version, build=''):
if build:
l.append(build)
try:
- ints = map(int,l)
+ ints = map(int, l)
except ValueError:
strings = l
else:
- strings = list(map(str,ints))
+ strings = list(map(str, ints))
version = '.'.join(strings[:3])
return version
@@ -408,46 +408,43 @@ _ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) '
def _syscmd_ver(system='', release='', version='',
- supported_platforms=('win32','win16','dos','os2')):
+ supported_platforms=('win32', 'win16', 'dos')):
""" Tries to figure out the OS version used and returns
- a tuple (system,release,version).
+ 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 ?
+ to exists on Windows, DOS. 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
+ return system, release, version
# Try some common cmd strings
- for cmd in ('ver','command /c ver','cmd /c ver'):
+ 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')
+ raise OSError('command failed')
# XXX How can I suppress shell errors from being written
# to stderr ?
- except os.error as why:
- #print 'Command %s failed: %s' % (cmd,why)
- continue
- except IOError as why:
- #print 'Command %s failed: %s' % (cmd,why)
+ except OSError as why:
+ #print 'Command %s failed: %s' % (cmd, why)
continue
else:
break
else:
- return system,release,version
+ return system, release, version
# Parse the output
info = info.strip()
m = _ver_output.match(info)
if m is not None:
- system,release,version = m.groups()
+ system, release, version = m.groups()
# Strip trailing dots from version and release
if release[-1] == '.':
release = release[:-1]
@@ -456,9 +453,9 @@ def _syscmd_ver(system='', release='', version='',
# Normalize the version and build strings (eliminating additional
# zeros)
version = _norm_version(version)
- return system,release,version
+ return system, release, version
-def _win32_getvalue(key,name,default=''):
+def _win32_getvalue(key, name, default=''):
""" Read a value for name from the registry key.
@@ -473,14 +470,14 @@ def _win32_getvalue(key,name,default=''):
import winreg
RegQueryValueEx = winreg.QueryValueEx
try:
- return RegQueryValueEx(key,name)
+ return RegQueryValueEx(key, name)
except:
return default
-def win32_ver(release='',version='',csd='',ptype=''):
+def win32_ver(release='', version='', csd='', ptype=''):
""" Get additional version information from the Windows Registry
- and return a tuple (version,csd,ptype) referring to version
+ and return a tuple (version, csd, ptype) referring to version
number, CSD level (service pack), and OS type (multi/single
processor).
@@ -517,7 +514,7 @@ def win32_ver(release='',version='',csd='',ptype=''):
sys.getwindowsversion
except AttributeError:
# No emulation possible, so return the defaults...
- return release,version,csd,ptype
+ return release, version, csd, ptype
else:
# Emulation using winreg (added in Python 2.0) and
# sys.getwindowsversion() (added in Python 2.3)
@@ -535,8 +532,8 @@ def win32_ver(release='',version='',csd='',ptype=''):
# Find out the registry key and some general version infos
winver = GetVersionEx()
- maj,min,buildno,plat,csd = winver
- version = '%i.%i.%i' % (maj,min,buildno & 0xFFFF)
+ maj, min, buildno, plat, csd = winver
+ version = '%i.%i.%i' % (maj, min, buildno & 0xFFFF)
if hasattr(winver, "service_pack"):
if winver.service_pack != "":
csd = 'SP%s' % winver.service_pack_major
@@ -586,7 +583,7 @@ def win32_ver(release='',version='',csd='',ptype=''):
# Discard any type that isn't REG_SZ
if type == REG_SZ and name.find("Server") != -1:
product_type = VER_NT_SERVER
- except WindowsError:
+ except OSError:
# Use default of VER_NT_WORKSTATION
pass
@@ -611,8 +608,8 @@ def win32_ver(release='',version='',csd='',ptype=''):
else:
if not release:
# E.g. Win3.1 with win32s
- release = '%i.%i' % (maj,min)
- return release,version,csd,ptype
+ release = '%i.%i' % (maj, min)
+ return release, version, csd, ptype
# Open the registry key
try:
@@ -620,7 +617,7 @@ def win32_ver(release='',version='',csd='',ptype=''):
# Get a value to make sure the key exists...
RegQueryValueEx(keyCurVer, 'SystemRoot')
except:
- return release,version,csd,ptype
+ return release, version, csd, ptype
# Parse values
#subversion = _win32_getvalue(keyCurVer,
@@ -630,73 +627,17 @@ def win32_ver(release='',version='',csd='',ptype=''):
# release = release + subversion # 95a, 95b, etc.
build = _win32_getvalue(keyCurVer,
'CurrentBuildNumber',
- ('',1))[0]
+ ('', 1))[0]
ptype = _win32_getvalue(keyCurVer,
'CurrentType',
- (ptype,1))[0]
+ (ptype, 1))[0]
# Normalize version
- version = _norm_version(version,build)
+ version = _norm_version(version, build)
# Close key
RegCloseKey(keyCurVer)
- return release,version,csd,ptype
-
-def _mac_ver_lookup(selectors,default=None):
-
- from _gestalt import gestalt
- l = []
- append = l.append
- for selector in selectors:
- try:
- append(gestalt(selector))
- except (RuntimeError, OSError):
- 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
- 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
+ return release, version, csd, ptype
def _mac_ver_xml():
fn = '/System/Library/CoreServices/SystemVersion.plist'
@@ -710,16 +651,16 @@ def _mac_ver_xml():
pl = plistlib.readPlist(fn)
release = pl['ProductVersion']
- versioninfo=('', '', '')
+ versioninfo = ('', '', '')
machine = os.uname().machine
if machine in ('ppc', 'Power Macintosh'):
- # for compatibility with the gestalt based code
+ # Canonical name
machine = 'PowerPC'
- return release,versioninfo,machine
+ return release, versioninfo, machine
-def mac_ver(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,
@@ -735,16 +676,10 @@ def mac_ver(release='',versioninfo=('','',''),machine=''):
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
+ return release, versioninfo, machine
-def _java_getprop(name,default):
+def _java_getprop(name, default):
from java.lang import System
try:
@@ -755,13 +690,13 @@ def _java_getprop(name,default):
except AttributeError:
return default
-def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')):
+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).
+ 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 '').
@@ -771,7 +706,7 @@ def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')):
try:
import java.lang
except ImportError:
- return release,vendor,vminfo,osinfo
+ return release, vendor, vminfo, osinfo
vendor = _java_getprop('java.vendor', vendor)
release = _java_getprop('java.version', release)
@@ -790,9 +725,9 @@ def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')):
### System name aliasing
-def system_alias(system,release,version):
+def system_alias(system, release, version):
- """ Returns (system,release,version) aliased to common
+ """ Returns (system, release, version) aliased to common
marketing names used for some systems.
It also does some reordering of the information in some cases
@@ -802,13 +737,13 @@ def system_alias(system,release,version):
if system == 'Rhapsody':
# Apple's BSD derivative
# XXX How can we determine the marketing release number ?
- return 'MacOS X Server',system+release,version
+ 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
+ return system, release, version
# Modify release (marketing release = SunOS release - 3)
l = release.split('.')
if l:
@@ -836,11 +771,11 @@ def system_alias(system,release,version):
else:
version = '64bit'
- elif system in ('win32','win16'):
+ elif system in ('win32', 'win16'):
# In case one of the other tricks
system = 'Windows'
- return system,release,version
+ return system, release, version
### Various internal helpers
@@ -853,21 +788,21 @@ def _platform(*args):
platform = '-'.join(x.strip() for x in filter(len, args))
# Cleanup some possible filename obstacles...
- platform = platform.replace(' ','_')
- platform = platform.replace('/','-')
- platform = platform.replace('\\','-')
- platform = platform.replace(':','-')
- platform = platform.replace(';','-')
- platform = platform.replace('"','-')
- platform = platform.replace('(','-')
- platform = platform.replace(')','-')
+ platform = platform.replace(' ', '_')
+ platform = platform.replace('/', '-')
+ platform = platform.replace('\\', '-')
+ platform = platform.replace(':', '-')
+ platform = platform.replace(';', '-')
+ platform = platform.replace('"', '-')
+ platform = platform.replace('(', '-')
+ platform = platform.replace(')', '-')
# No need to report 'unknown' information...
- platform = platform.replace('unknown','')
+ platform = platform.replace('unknown', '')
# Fold '--'s and remove trailing '-'
while 1:
- cleaned = platform.replace('--','-')
+ cleaned = platform.replace('--', '-')
if cleaned == platform:
break
platform = cleaned
@@ -887,7 +822,7 @@ def _node(default=''):
return default
try:
return socket.gethostname()
- except socket.error:
+ except OSError:
# Still not working...
return default
@@ -899,19 +834,19 @@ def _follow_symlinks(filepath):
filepath = os.path.abspath(filepath)
while os.path.islink(filepath):
filepath = os.path.normpath(
- os.path.join(os.path.dirname(filepath),os.readlink(filepath)))
+ os.path.join(os.path.dirname(filepath), os.readlink(filepath)))
return filepath
-def _syscmd_uname(option,default=''):
+def _syscmd_uname(option, default=''):
""" Interface to the system's uname command.
"""
- if sys.platform in ('dos','win32','win16','os2'):
+ if sys.platform in ('dos', 'win32', 'win16'):
# XXX Others too ?
return default
try:
f = os.popen('uname %s 2> %s' % (option, DEV_NULL))
- except (AttributeError,os.error):
+ except (AttributeError, OSError):
return default
output = f.read().strip()
rc = f.close()
@@ -920,7 +855,7 @@ def _syscmd_uname(option,default=''):
else:
return output
-def _syscmd_file(target,default=''):
+def _syscmd_file(target, default=''):
""" Interface to the system's file command.
@@ -929,7 +864,7 @@ def _syscmd_file(target,default=''):
default in case the command should fail.
"""
- if sys.platform in ('dos','win32','win16','os2'):
+ if sys.platform in ('dos', 'win32', 'win16'):
# XXX Others too ?
return default
target = _follow_symlinks(target)
@@ -937,7 +872,7 @@ def _syscmd_file(target,default=''):
proc = subprocess.Popen(['file', target],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- except (AttributeError,os.error):
+ except (AttributeError, OSError):
return default
output = proc.communicate()[0].decode('latin-1')
rc = proc.wait()
@@ -951,17 +886,17 @@ def _syscmd_file(target,default=''):
# Default values for architecture; non-empty strings override the
# defaults given as parameters
_default_architecture = {
- 'win32': ('','WindowsPE'),
- 'win16': ('','Windows'),
- 'dos': ('','MSDOS'),
+ 'win32': ('', 'WindowsPE'),
+ 'win16': ('', 'Windows'),
+ 'dos': ('', 'MSDOS'),
}
-def architecture(executable=sys.executable,bits='',linkage=''):
+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
+ 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.
@@ -999,16 +934,16 @@ def architecture(executable=sys.executable,bits='',linkage=''):
# "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]
+ b, l = _default_architecture[sys.platform]
if b:
bits = b
if l:
linkage = l
- return bits,linkage
+ return bits, linkage
if 'executable' not in fileout:
# Format not supported
- return bits,linkage
+ return bits, linkage
# Bits
if '32-bit' in fileout:
@@ -1036,7 +971,7 @@ def architecture(executable=sys.executable,bits='',linkage=''):
# XXX the A.OUT format also falls under this class...
pass
- return bits,linkage
+ return bits, linkage
### Portable uname() interface
@@ -1048,7 +983,7 @@ _uname_cache = None
def uname():
""" Fairly portable uname interface. Returns a tuple
- of strings (system,node,release,version,machine,processor)
+ of strings (system, node, release, version, machine, processor)
identifying the underlying platform.
Note that unlike the os.uname function this also returns
@@ -1067,7 +1002,7 @@ def uname():
# Get some infos from the builtin os.uname API...
try:
- system,node,release,version,machine = os.uname()
+ system, node, release, version, machine = os.uname()
except AttributeError:
no_os_uname = 1
@@ -1085,7 +1020,7 @@ def uname():
# Try win32_ver() on win32 platforms
if system == 'win32':
- release,version,csd,ptype = win32_ver()
+ release, version, csd, ptype = win32_ver()
if release and version:
use_syscmd_ver = 0
# Try to use the PROCESSOR_* environment variables
@@ -1104,7 +1039,7 @@ def uname():
# Try the 'ver' system command available on some
# platforms
if use_syscmd_ver:
- system,release,version = _syscmd_ver(system)
+ 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':
@@ -1122,7 +1057,7 @@ def uname():
# In case we still don't know anything useful, we'll try to
# help ourselves
- if system in ('win32','win16'):
+ if system in ('win32', 'win16'):
if not version:
if system == 'win32':
version = '32bit'
@@ -1131,7 +1066,7 @@ def uname():
system = 'Windows'
elif system[:4] == 'java':
- release,vendor,vminfo,osinfo = java_ver()
+ release, vendor, vminfo, osinfo = java_ver()
system = 'Java'
version = ', '.join(vminfo)
if not version:
@@ -1149,14 +1084,14 @@ def uname():
except ImportError:
pass
else:
- csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0)
+ 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','')
+ processor = _syscmd_uname('-p', '')
#If any unknowns still exist, replace them with ''s, which are more portable
if system == 'unknown':
@@ -1177,7 +1112,8 @@ def uname():
system = 'Windows'
release = 'Vista'
- _uname_cache = uname_result(system,node,release,version,machine,processor)
+ _uname_cache = uname_result(system, node, release, version,
+ machine, processor)
return _uname_cache
### Direct interfaces to some of the uname() return values
@@ -1474,57 +1410,58 @@ def platform(aliased=0, terse=0):
# Get uname information and then apply platform specific cosmetics
# to it...
- system,node,release,version,machine,processor = uname()
+ system, node, release, version, machine, processor = uname()
if machine == processor:
processor = ''
if aliased:
- system,release,version = system_alias(system,release,version)
+ system, release, version = system_alias(system, release, version)
if system == 'Windows':
# MS platforms
- rel,vers,csd,ptype = win32_ver(version)
+ rel, vers, csd, ptype = win32_ver(version)
if terse:
- platform = _platform(system,release)
+ platform = _platform(system, release)
else:
- platform = _platform(system,release,version,csd)
+ platform = _platform(system, release, version, csd)
elif system in ('Linux',):
# Linux based systems
- distname,distversion,distid = dist('')
+ distname, distversion, distid = dist('')
if distname and not terse:
- platform = _platform(system,release,machine,processor,
+ platform = _platform(system, release, machine, processor,
'with',
- distname,distversion,distid)
+ 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,
+ 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()
+ r, v, vminfo, (os_name, os_version, os_arch) = java_ver()
if terse or not os_name:
- platform = _platform(system,release,version)
+ platform = _platform(system, release, version)
else:
- platform = _platform(system,release,version,
+ platform = _platform(system, release, version,
'on',
- os_name,os_version,os_arch)
+ os_name, os_version, os_arch)
elif system == 'MacOS':
# MacOS platforms
if terse:
- platform = _platform(system,release)
+ platform = _platform(system, release)
else:
- platform = _platform(system,release,machine)
+ platform = _platform(system, release, machine)
else:
# Generic handler
if terse:
- platform = _platform(system,release)
+ platform = _platform(system, release)
else:
- bits,linkage = architecture(sys.executable)
- platform = _platform(system,release,machine,processor,bits,linkage)
+ bits, linkage = architecture(sys.executable)
+ platform = _platform(system, release, machine,
+ processor, bits, linkage)
_platform_cache[(aliased, terse)] = platform
return platform
@@ -1535,5 +1472,5 @@ 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))
+ print(platform(aliased, terse))
sys.exit(0)