From: "Andrey Vul" <andrey.vul@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] A question about emerge --info
Date: Wed, 29 Oct 2008 19:51:44 -0400 [thread overview]
Message-ID: <e38d12ff0810291651y245cba2k89b9cb2b8ee39dd9@mail.gmail.com> (raw)
In-Reply-To: <e38d12ff0810291641t7bb26b6fo1ea6ecc2aa4ef19c@mail.gmail.com>
Found the code, and it's actually part of python (as of 2.4).
Gentoo sets aliased to 1 when printing the system uname.
/usr/lib/python2.{4,5,6}/platform.py:
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 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:
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
Proof: run /usr/lib/python2.{4,5,6}/platform.py
aliased and terse have no effect wrt output (kernel_version-with-libc_version)
--
Andrey Vul
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
next prev parent reply other threads:[~2008-10-29 23:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-29 22:53 [gentoo-user] A question about emerge --info Paul Hartman
2008-10-29 23:06 ` Andrey Vul
2008-10-29 23:09 ` Andrey Falko
2008-10-29 23:13 ` Andrey Vul
2008-10-29 23:23 ` Andrey Falko
2008-10-29 23:32 ` Andrey Vul
2008-10-29 23:41 ` Andrey Vul
2008-10-29 23:51 ` Andrey Vul [this message]
2008-10-29 23:57 ` Andrey Falko
2008-10-30 0:03 ` Andrey Vul
2008-10-30 0:15 ` Andrey Falko
2008-10-30 0:26 ` Andrey Vul
2008-10-30 2:02 ` Andrey Vul
2008-10-30 10:37 ` Geralt
2008-10-30 1:49 ` Paul Hartman
2008-10-30 0:47 ` Joshua Murphy
2008-10-30 1:30 ` Andrey Vul
2008-10-30 1:31 ` Andrey Vul
2008-10-30 12:26 ` Albert Hopkins
2008-10-30 12:43 ` Heiko Wundram
2008-10-30 13:44 ` Albert Hopkins
2008-10-29 23:21 ` Paul Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e38d12ff0810291651y245cba2k89b9cb2b8ee39dd9@mail.gmail.com \
--to=andrey.vul@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox