diff options
author | Ronald Oussoren <ronaldoussoren@mac.com> | 2010-05-05 19:09:31 (GMT) |
---|---|---|
committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2010-05-05 19:09:31 (GMT) |
commit | 9545a23c7ffb35417d451d24cc3b0339627965a7 (patch) | |
tree | 5e22fd30c1c6936970b4d87ca3e91f8428c74983 /Lib | |
parent | a8157183b89c08cf47c969185d40973ec21a81c5 (diff) | |
download | cpython-9545a23c7ffb35417d451d24cc3b0339627965a7.zip cpython-9545a23c7ffb35417d451d24cc3b0339627965a7.tar.gz cpython-9545a23c7ffb35417d451d24cc3b0339627965a7.tar.bz2 |
In a number of places code still revers
to "sys.platform == 'mac'" and that is
dead code because it refers to a platform
that is no longer supported (and hasn't been
supported for several releases).
Fixes issue #7908 for the trunk.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/binhex.py | 13 | ||||
-rw-r--r-- | Lib/distutils/command/install.py | 14 | ||||
-rw-r--r-- | Lib/distutils/file_util.py | 11 | ||||
-rw-r--r-- | Lib/distutils/sysconfig.py | 17 | ||||
-rw-r--r-- | Lib/distutils/util.py | 9 | ||||
-rw-r--r-- | Lib/imputil.py | 10 | ||||
-rw-r--r-- | Lib/plat-mac/EasyDialogs.py | 17 | ||||
-rwxr-xr-x | Lib/plat-mac/bundlebuilder.py | 2 | ||||
-rwxr-xr-x | Lib/platform.py | 4 | ||||
-rwxr-xr-x | Lib/profile.py | 9 | ||||
-rwxr-xr-x | Lib/pydoc.py | 6 | ||||
-rw-r--r-- | Lib/tarfile.py | 7 | ||||
-rwxr-xr-x | Lib/test/regrtest.py | 37 | ||||
-rw-r--r-- | Lib/test/test_frozen.py | 13 | ||||
-rw-r--r-- | Lib/test/test_repr.py | 3 | ||||
-rw-r--r-- | Lib/test/test_select.py | 2 | ||||
-rw-r--r-- | Lib/test/test_socket.py | 5 | ||||
-rw-r--r-- | Lib/test/test_strptime.py | 5 | ||||
-rw-r--r-- | Lib/test/test_tempfile.py | 8 | ||||
-rw-r--r-- | Lib/test/test_urllib2.py | 4 | ||||
-rw-r--r-- | Lib/urllib.py | 4 |
21 files changed, 26 insertions, 174 deletions
diff --git a/Lib/binhex.py b/Lib/binhex.py index bd4e8b3..8abc9f3 100644 --- a/Lib/binhex.py +++ b/Lib/binhex.py @@ -175,9 +175,6 @@ class BinHex: if type(ofp) == type(''): ofname = ofp ofp = open(ofname, 'w') - if os.name == 'mac': - fss = FSSpec(ofname) - fss.SetCreatorType('BnHq', 'TEXT') ofp.write('(This file must be converted with BinHex 4.0)\n\n:') hqxer = _Hqxcoderengine(ofp) self.ofp = _Rlecoderengine(hqxer) @@ -478,9 +475,6 @@ def hexbin(inp, out): finfo = ifp.FInfo if not out: out = ifp.FName - if os.name == 'mac': - ofss = FSSpec(out) - out = ofss.as_pathname() ofp = open(out, 'wb') # XXXX Do translation on non-mac systems @@ -501,13 +495,6 @@ def hexbin(inp, out): ofp.write(d) ofp.close() - if os.name == 'mac': - nfinfo = ofss.GetFInfo() - nfinfo.Creator = finfo.Creator - nfinfo.Type = finfo.Type - nfinfo.Flags = finfo.Flags - ofss.SetFInfo(nfinfo) - ifp.close() def _test(): diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py index 44c7692..f1f3bd5 100644 --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -69,20 +69,6 @@ INSTALL_SCHEMES = { 'scripts': '$userbase/Scripts', 'data' : '$userbase', }, - 'mac': { - 'purelib': '$base/Lib/site-packages', - 'platlib': '$base/Lib/site-packages', - 'headers': '$base/Include/$dist_name', - 'scripts': '$base/Scripts', - 'data' : '$base', - }, - 'mac_user': { - 'purelib': '$usersite', - 'platlib': '$usersite', - 'headers': '$userbase/$py_version_short/include/$dist_name', - 'scripts': '$userbase/bin', - 'data' : '$userbase', - }, 'os2': { 'purelib': '$base/Lib/site-packages', 'platlib': '$base/Lib/site-packages', diff --git a/Lib/distutils/file_util.py b/Lib/distutils/file_util.py index d8e8fd5..b3d9d54 100644 --- a/Lib/distutils/file_util.py +++ b/Lib/distutils/file_util.py @@ -133,18 +133,9 @@ def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0, if dry_run: return (dst, 1) - # On Mac OS, use the native file copy routine - if os.name == 'mac': - import macostools - try: - macostools.copy(src, dst, 0, preserve_times) - except os.error, exc: - raise DistutilsFileError( - "could not copy '%s' to '%s': %s" % (src, dst, exc[-1])) - # If linking (hard or symbolic), use the appropriate system call # (Unix only, of course, but that's the caller's responsibility) - elif link == 'hard': + if link == 'hard': if not (os.path.exists(dst) and os.path.samefile(src, dst)): os.link(src, dst) elif link == 'sym': diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index bb53315..4d16b26 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -88,11 +88,6 @@ def get_python_inc(plat_specific=0, prefix=None): return os.path.join(prefix, "include", "python" + get_python_version()) elif os.name == "nt": return os.path.join(prefix, "include") - elif os.name == "mac": - if plat_specific: - return os.path.join(prefix, "Mac", "Include") - else: - return os.path.join(prefix, "Include") elif os.name == "os2": return os.path.join(prefix, "Include") else: @@ -135,18 +130,6 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): else: return os.path.join(prefix, "Lib", "site-packages") - elif os.name == "mac": - if plat_specific: - if standard_lib: - return os.path.join(prefix, "Lib", "lib-dynload") - else: - return os.path.join(prefix, "Lib", "site-packages") - else: - if standard_lib: - return os.path.join(prefix, "Lib") - else: - return os.path.join(prefix, "Lib", "site-packages") - elif os.name == "os2": if standard_lib: return os.path.join(prefix, "Lib") diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index 994dd21..b3ec6e9 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -235,15 +235,6 @@ def change_root (new_root, pathname): path = path[1:] return os.path.join(new_root, path) - elif os.name == 'mac': - if not os.path.isabs(pathname): - return os.path.join(new_root, pathname) - else: - # Chop off volume name from start of path - elements = string.split(pathname, ":", 1) - pathname = ":" + elements[1] - return os.path.join(new_root, pathname) - else: raise DistutilsPlatformError, \ "nothing known about platform '%s'" % os.name diff --git a/Lib/imputil.py b/Lib/imputil.py index 600cfa5..a5fa6ea 100644 --- a/Lib/imputil.py +++ b/Lib/imputil.py @@ -462,16 +462,6 @@ def _os_bootstrap(): elif 'os2' in names: sep = '\\' from os2 import stat - elif 'mac' in names: - from mac import stat - def join(a, b): - if a == '': - return b - if ':' not in a: - a = ':' + a - if a[-1:] != ':': - a = a + ':' - return a + b else: raise ImportError, 'no os specific module found' diff --git a/Lib/plat-mac/EasyDialogs.py b/Lib/plat-mac/EasyDialogs.py index 785fd3b..129cf2c 100644 --- a/Lib/plat-mac/EasyDialogs.py +++ b/Lib/plat-mac/EasyDialogs.py @@ -721,16 +721,13 @@ def AskFileForSave( if issubclass(tpwanted, Carbon.File.FSSpec): return tpwanted(rr.selection[0]) if issubclass(tpwanted, (str, unicode)): - if sys.platform == 'mac': - fullpath = rr.selection[0].as_pathname() - else: - # This is gross, and probably incorrect too - vrefnum, dirid, name = rr.selection[0].as_tuple() - pardir_fss = Carbon.File.FSSpec((vrefnum, dirid, '')) - pardir_fsr = Carbon.File.FSRef(pardir_fss) - pardir_path = pardir_fsr.FSRefMakePath() # This is utf-8 - name_utf8 = unicode(name, 'macroman').encode('utf8') - fullpath = os.path.join(pardir_path, name_utf8) + # This is gross, and probably incorrect too + vrefnum, dirid, name = rr.selection[0].as_tuple() + pardir_fss = Carbon.File.FSSpec((vrefnum, dirid, '')) + pardir_fsr = Carbon.File.FSRef(pardir_fss) + pardir_path = pardir_fsr.FSRefMakePath() # This is utf-8 + name_utf8 = unicode(name, 'macroman').encode('utf8') + fullpath = os.path.join(pardir_path, name_utf8) if issubclass(tpwanted, unicode): return unicode(fullpath, 'utf8') return tpwanted(fullpath) diff --git a/Lib/plat-mac/bundlebuilder.py b/Lib/plat-mac/bundlebuilder.py index ce7ce45..4339913 100755 --- a/Lib/plat-mac/bundlebuilder.py +++ b/Lib/plat-mac/bundlebuilder.py @@ -273,7 +273,7 @@ __load() del __load """ -MAYMISS_MODULES = ['mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath', +MAYMISS_MODULES = ['os2', 'nt', 'ntpath', 'dos', 'dospath', 'win32api', 'ce', '_winreg', 'nturl2path', 'sitecustomize', 'org.python.core', 'riscos', 'riscosenviron', 'riscospath' ] diff --git a/Lib/platform.py b/Lib/platform.py index 79695ba..6676436 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -1171,10 +1171,6 @@ def uname(): if not version: version = vendor - elif os.name == 'mac': - release,(version,stage,nonrel),machine = mac_ver() - system = 'MacOS' - # System specific extensions if system == 'OpenVMS': # OpenVMS seems to have release and version mixed up diff --git a/Lib/profile.py b/Lib/profile.py index 3af8427..9a4336e 100755 --- a/Lib/profile.py +++ b/Lib/profile.py @@ -97,11 +97,6 @@ def help(): print "Documentation for the profile module can be found " print "in the Python Library Reference, section 'The Python Profiler'." -if os.name == "mac": - import MacOS - def _get_time_mac(timer=MacOS.GetTicks): - return timer() / 60.0 - if hasattr(os, "times"): def _get_time_times(timer=os.times): t = timer() @@ -178,10 +173,6 @@ class Profile: self.timer = resgetrusage self.dispatcher = self.trace_dispatch self.get_time = _get_time_resource - elif os.name == 'mac': - self.timer = MacOS.GetTicks - self.dispatcher = self.trace_dispatch_mac - self.get_time = _get_time_mac elif hasattr(time, 'clock'): self.timer = self.get_time = time.clock self.dispatcher = self.trace_dispatch_i diff --git a/Lib/pydoc.py b/Lib/pydoc.py index dd7eb38..4d60436 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -2028,7 +2028,7 @@ pydoc</strong> by Ka-Ping Yee <ping@lfw.org></font>''' class DocServer(BaseHTTPServer.HTTPServer): def __init__(self, port, callback): - host = (sys.platform == 'mac') and '127.0.0.1' or 'localhost' + host = 'localhost' self.address = ('', port) self.url = 'http://%s:%d/' % (host, port) self.callback = callback @@ -2145,10 +2145,6 @@ def gui(): except ImportError: # pre-webbrowser.py compatibility if sys.platform == 'win32': os.system('start "%s"' % url) - elif sys.platform == 'mac': - try: import ic - except ImportError: pass - else: ic.launchurl(url) else: rc = os.system('netscape -remote "openURL(%s)" &' % url) if rc: os.system('netscape "%s" &' % url) diff --git a/Lib/tarfile.py b/Lib/tarfile.py index b0af5b1..4b03c28 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -53,13 +53,6 @@ import copy import re import operator -if sys.platform == 'mac': - # This module needs work for MacOS9, especially in the area of pathname - # handling. In many places it is assumed a simple substitution of / by the - # local os.path.sep is good enough to convert pathnames, but this does not - # work with the mac rooted:path:name versus :nonrooted:path:name syntax - raise ImportError, "tarfile does not work for platform==mac" - try: import grp, pwd except ImportError: diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 545e0ea..a4139d3 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -1156,41 +1156,6 @@ _expectations = { test_kqueue test_ossaudiodev """, - 'mac': - """ - test_atexit - test_bsddb - test_bsddb185 - test_bsddb3 - test_bz2 - test_commands - test_crypt - test_curses - test_dbm - test_dl - test_fcntl - test_fork1 - test_epoll - test_grp - test_ioctl - test_largefile - test_locale - test_kqueue - test_mmap - test_openpty - test_ossaudiodev - test_poll - test_popen - test_popen2 - test_posix - test_pty - test_pwd - test_resource - test_signal - test_sundry - test_tarfile - test_timing - """, 'unixware7': """ test_bsddb @@ -1477,7 +1442,7 @@ class _ExpectedSkips: if sys.maxint == 9223372036854775807L: self.expected.add('test_imageop') - if not sys.platform in ("mac", "darwin"): + if sys.platform != "darwin": MAC_ONLY = ["test_macos", "test_macostools", "test_aepack", "test_plistlib", "test_scriptpackages", "test_applesingle"] diff --git a/Lib/test/test_frozen.py b/Lib/test/test_frozen.py index 5f72a92..7fb53a4 100644 --- a/Lib/test/test_frozen.py +++ b/Lib/test/test_frozen.py @@ -23,13 +23,12 @@ class FrozenTests(unittest.TestCase): except ImportError, x: self.fail("import __phello__.spam failed:" + str(x)) - if sys.platform != "mac": # On the Mac this import does succeed. - try: - import __phello__.foo - except ImportError: - pass - else: - self.fail("import __phello__.foo should have failed") + try: + import __phello__.foo + except ImportError: + pass + else: + self.fail("import __phello__.foo should have failed") self.assertEquals(stdout.getvalue(), 'Hello world...\nHello world...\nHello world...\n') diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py index 26300d3..a8202ee 100644 --- a/Lib/test/test_repr.py +++ b/Lib/test/test_repr.py @@ -320,8 +320,7 @@ class ClassWithFailingRepr: def test_main(): run_unittest(ReprTests) - if os.name != 'mac': - run_unittest(LongReprTest) + run_unittest(LongReprTest) if __name__ == "__main__": diff --git a/Lib/test/test_select.py b/Lib/test/test_select.py index 647d71e..79b249b 100644 --- a/Lib/test/test_select.py +++ b/Lib/test/test_select.py @@ -4,7 +4,7 @@ import select import os import sys -@unittest.skipIf(sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'), +@unittest.skipIf(sys.platform[:3] in ('win', 'os2', 'riscos'), "can't easily test on this system") class SelectTestCase(unittest.TestCase): diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 0ce329f..430a647 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -1383,9 +1383,8 @@ class TIPCThreadableTest (unittest.TestCase, ThreadableTest): def test_main(): tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest, - TestExceptions, BufferIOTest, BasicTCPTest2] - if sys.platform != 'mac': - tests.extend([ BasicUDPTest, UDPTimeoutTest ]) + TestExceptions, BufferIOTest, BasicTCPTest2, BasicUDPTest, + UDPTimeoutTest ] tests.extend([ NonBlockingTCPTests, diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index d2868e9..a233b1c 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -298,9 +298,6 @@ class StrptimeTests(unittest.TestCase): self.assertEqual(strp_output.tm_isdst, 0) strp_output = _strptime._strptime_time("GMT", "%Z") self.assertEqual(strp_output.tm_isdst, 0) - if sys.platform == "mac": - # Timezones don't really work on MacOS9 - return time_tuple = time.localtime() strf_output = time.strftime("%Z") #UTC does not have a timezone strp_output = _strptime._strptime_time(strf_output, "%Z") @@ -317,8 +314,6 @@ class StrptimeTests(unittest.TestCase): def test_bad_timezone(self): # Explicitly test possibility of bad timezone; # when time.tzname[0] == time.tzname[1] and time.daylight - if sys.platform == "mac": - return #MacOS9 has severely broken timezone support. tz_name = time.tzname[0] if tz_name.upper() in ("UTC", "GMT"): return diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py index e534d62..27068e3 100644 --- a/Lib/test/test_tempfile.py +++ b/Lib/test/test_tempfile.py @@ -23,9 +23,7 @@ has_spawnl = hasattr(os, 'spawnl') # TEST_FILES may need to be tweaked for systems depending on the maximum # number of files that can be opened at one time (see ulimit -n) -if sys.platform == 'mac': - TEST_FILES = 32 -elif sys.platform in ('openbsd3', 'openbsd4'): +if sys.platform in ('openbsd3', 'openbsd4'): TEST_FILES = 48 else: TEST_FILES = 100 @@ -257,7 +255,7 @@ class test__mkstemp_inner(TC): file = self.do_create() mode = stat.S_IMODE(os.stat(file.name).st_mode) expected = 0600 - if sys.platform in ('win32', 'os2emx', 'mac'): + if sys.platform in ('win32', 'os2emx'): # There's no distinction among 'user', 'group' and 'world'; # replicate the 'user' bits. user = expected >> 6 @@ -476,7 +474,7 @@ class test_mkdtemp(TC): mode = stat.S_IMODE(os.stat(dir).st_mode) mode &= 0777 # Mask off sticky bits inherited from /tmp expected = 0700 - if sys.platform in ('win32', 'os2emx', 'mac'): + if sys.platform in ('win32', 'os2emx'): # There's no distinction among 'user', 'group' and 'world'; # replicate the 'user' bits. user = expected >> 6 diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index c0366dd..01a06fb 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -24,9 +24,7 @@ class TrivialTests(unittest.TestCase): # And more hacking to get it to work on MacOS. This assumes # urllib.pathname2url works, unfortunately... - if os.name == 'mac': - fname = '/' + fname.replace(':', '/') - elif os.name == 'riscos': + if os.name == 'riscos': import string fname = os.expand(fname) fname = fname.translate(string.maketrans("/.", "./")) diff --git a/Lib/urllib.py b/Lib/urllib.py index 652be75..6cb95f3 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -42,9 +42,7 @@ __version__ = '1.17' # XXX This version is not always updated :-( MAXFTPCACHE = 10 # Trim the ftp cache beyond this size # Helper for non-unix systems -if os.name == 'mac': - from macurl2path import url2pathname, pathname2url -elif os.name == 'nt': +if os.name == 'nt': from nturl2path import url2pathname, pathname2url elif os.name == 'riscos': from rourl2path import url2pathname, pathname2url |