diff --git a/Lib/distutils/tests/test_bdist_rpm.py b/Lib/distutils/tests/test_bdist_rpm.py --- a/Lib/distutils/tests/test_bdist_rpm.py +++ b/Lib/distutils/tests/test_bdist_rpm.py @@ -1,10 +1,11 @@ """Tests for distutils.command.bdist_rpm.""" +import os +import platform +import shutil +import sys +import tempfile import unittest -import sys -import os -import tempfile -import shutil from test.support import run_unittest from distutils.core import Distribution @@ -42,7 +43,7 @@ class BuildRpmTestCase(support.TempdirMa # XXX I am unable yet to make this test work without # spurious sdtout/stderr output under Mac OS X - if sys.platform != 'linux2': + if platform.system() != 'Linux': return # this test will run only if the rpm commands are found @@ -82,7 +83,7 @@ class BuildRpmTestCase(support.TempdirMa # XXX I am unable yet to make this test work without # spurious sdtout/stderr output under Mac OS X - if sys.platform != 'linux2': + if platform.system() != 'Linux': return # http://bugs.python.org/issue1533164 diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -1473,6 +1473,7 @@ _expectations['freebsd5'] = _expectation _expectations['freebsd6'] = _expectations['freebsd4'] _expectations['freebsd7'] = _expectations['freebsd4'] _expectations['freebsd8'] = _expectations['freebsd4'] +_expectations['linux3'] = _expectations['linux2'] class _ExpectedSkips: def __init__(self): diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -2056,7 +2056,7 @@ def test_main(): ]) if hasattr(socket, "socketpair"): tests.append(BasicSocketPairTest) - if sys.platform == 'linux2': + if platform.system() != 'Linux': tests.append(TestLinuxAbstractNamespace) if isTipcAvailable(): tests.append(TIPCTest) diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -1,14 +1,12 @@ +import errno +import io +import os +import platform +import shutil import sys -import os -import io -import shutil -import io +import tarfile +import unittest from hashlib import md5 -import errno - -import unittest -import tarfile - from test import support # Check for our compression modules. @@ -703,7 +701,7 @@ class GNUReadTest(LongnameTest): # Return True if the platform knows the st_blocks stat attribute and # uses st_blocks units of 512 bytes, and if the filesystem is able to # store holes in files. - if sys.platform == "linux2": + if platform.system() == "Linux": # Linux evidentially has 512 byte st_blocks units. name = os.path.join(TEMPDIR, "sparse-test") with open(name, "wb") as fobj: diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1375,9 +1375,7 @@ class PyBuildExt(build_ext): # End multiprocessing # Platform-specific libraries - if (platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6', - 'freebsd7', 'freebsd8') - or platform.startswith("gnukfreebsd")): + if os.uname()[0] in ('Linux', 'FreeBSD'): exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) else: missing.append('ossaudiodev')