diff options
author | Larry Hastings <larry@hastings.org> | 2012-06-24 11:33:36 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2012-06-24 11:33:36 (GMT) |
commit | 605a62ddb1c19978ee194a40a458f072e3242a31 (patch) | |
tree | 68e0896556044c0b2d7e9db9a08fc8e449011f18 /Lib | |
parent | f62445ad30145e5e50c5b0ec9d979099b630039f (diff) | |
download | cpython-605a62ddb1c19978ee194a40a458f072e3242a31.zip cpython-605a62ddb1c19978ee194a40a458f072e3242a31.tar.gz cpython-605a62ddb1c19978ee194a40a458f072e3242a31.tar.bz2 |
Issue #15118: Change return value of os.uname() and os.times() from
plain tuples to immutable iterable objects with named attributes
(structseq objects).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ctypes/__init__.py | 2 | ||||
-rw-r--r-- | Lib/ctypes/util.py | 4 | ||||
-rwxr-xr-x | Lib/platform.py | 2 | ||||
-rw-r--r-- | Lib/test/test__locale.py | 2 | ||||
-rw-r--r-- | Lib/test/test_locale.py | 2 | ||||
-rw-r--r-- | Lib/test/test_sysconfig.py | 5 | ||||
-rw-r--r-- | Lib/uuid.py | 2 |
7 files changed, 9 insertions, 10 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py index 111209a..f0bd66a 100644 --- a/Lib/ctypes/__init__.py +++ b/Lib/ctypes/__init__.py @@ -26,7 +26,7 @@ if _os.name == "posix" and _sys.platform == "darwin": # libraries. OS X 10.3 is Darwin 7, so we check for # that. - if int(_os.uname()[2].split('.')[0]) < 8: + if int(_os.uname().release.split('.')[0]) < 8: DEFAULT_MODE = RTLD_GLOBAL from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \ diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py index 61eb094..5555b2e 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -171,9 +171,9 @@ elif os.name == "posix": def _findSoname_ldconfig(name): import struct if struct.calcsize('l') == 4: - machine = os.uname()[4] + '-32' + machine = os.uname().machine + '-32' else: - machine = os.uname()[4] + '-64' + machine = os.uname().machine + '-64' mach_map = { 'x86_64-64': 'libc6,x86-64', 'ppc64-64': 'libc6,64bit', diff --git a/Lib/platform.py b/Lib/platform.py index 4554659..b7dbcca 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -700,7 +700,7 @@ def _mac_ver_xml(): pl = plistlib.readPlist(fn) release = pl['ProductVersion'] versioninfo=('', '', '') - machine = os.uname()[4] + machine = os.uname().machine if machine in ('ppc', 'Power Macintosh'): # for compatibility with the gestalt based code machine = 'PowerPC' diff --git a/Lib/test/test__locale.py b/Lib/test/test__locale.py index f7f1abd..dab1565 100644 --- a/Lib/test/test__locale.py +++ b/Lib/test/test__locale.py @@ -12,7 +12,7 @@ from platform import uname from test.support import run_unittest if uname()[0] == "Darwin": - maj, min, mic = [int(part) for part in uname()[2].split(".")] + maj, min, mic = [int(part) for part in uname().release.split(".")] if (maj, min, mic) < (8, 0, 0): raise unittest.SkipTest("locale support broken for OS X < 10.4") diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py index 7fdb6da..51a7bca 100644 --- a/Lib/test/test_locale.py +++ b/Lib/test/test_locale.py @@ -11,7 +11,7 @@ def get_enUS_locale(): if sys.platform == 'darwin': import os tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US") - if int(os.uname()[2].split('.')[0]) < 10: + if int(os.uname().release.split('.')[0]) < 10: # The locale test work fine on OSX 10.6, I (ronaldoussoren) # haven't had time yet to verify if tests work on OSX 10.5 # (10.4 is known to be bad) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 3cb63ed..aa5d582 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -14,7 +14,6 @@ from sysconfig import (get_paths, get_platform, get_config_vars, _get_default_scheme, _expand_vars, get_scheme_names, get_config_var, _main) - class TestSysConfig(unittest.TestCase): def setUp(self): @@ -26,7 +25,7 @@ class TestSysConfig(unittest.TestCase): self._uname = os.uname() else: self.uname = None - self._uname = None + self._set_uname(('',)*5) os.uname = self._get_uname # saving the environment self.name = os.name @@ -70,7 +69,7 @@ class TestSysConfig(unittest.TestCase): super(TestSysConfig, self).tearDown() def _set_uname(self, uname): - self._uname = uname + self._uname = os.uname_result(uname) def _get_uname(self): return self._uname diff --git a/Lib/uuid.py b/Lib/uuid.py index 5684ad7..0df0743 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -440,7 +440,7 @@ try: import sys if sys.platform == 'darwin': import os - if int(os.uname()[2].split('.')[0]) >= 9: + if int(os.uname().release.split('.')[0]) >= 9: _uuid_generate_random = _uuid_generate_time = None # On Windows prior to 2000, UuidCreate gives a UUID containing the |