Index: setup.py =================================================================== --- setup.py (revision 78096) +++ setup.py (working copy) @@ -127,7 +127,7 @@ # Platform-dependent module source and include directories incdirlist = [] platform = self.get_platform() - if platform in ('darwin', 'mac') and ("--disable-toolbox-glue" not in + if platform == 'darwin' and ("--disable-toolbox-glue" not in sysconfig.get_config_var("CONFIG_ARGS")): # Mac OS X also includes some mac-specific modules macmoddir = os.path.join(srcdir, 'Mac/Modules') @@ -160,22 +160,21 @@ if ext.name in sys.builtin_module_names: self.extensions.remove(ext) - if platform != 'mac': - # Parse Modules/Setup and Modules/Setup.local to figure out which - # modules are turned on in the file. - remove_modules = [] - for filename in ('Modules/Setup', 'Modules/Setup.local'): - input = text_file.TextFile(filename, join_lines=1) - while 1: - line = input.readline() - if not line: break - line = line.split() - remove_modules.append(line[0]) - input.close() + # Parse Modules/Setup and Modules/Setup.local to figure out which + # modules are turned on in the file. + remove_modules = [] + for filename in ('Modules/Setup', 'Modules/Setup.local'): + input = text_file.TextFile(filename, join_lines=1) + while 1: + line = input.readline() + if not line: break + line = line.split() + remove_modules.append(line[0]) + input.close() - for ext in self.extensions[:]: - if ext.name in remove_modules: - self.extensions.remove(ext) + for ext in self.extensions[:]: + if ext.name in remove_modules: + self.extensions.remove(ext) # When you run "make CC=altcc" or something similar, you really want # those environment variables passed into the setup.py phase. Here's @@ -397,7 +396,7 @@ # Check for MacOS X, which doesn't need libm.a at all math_libs = ['m'] - if platform in ['darwin', 'beos', 'mac']: + if platform in ['darwin', 'beos']: math_libs = [] # XXX Omitted modules: gl, pure, dl, SGI-specific modules @@ -485,7 +484,7 @@ # fcntl(2) and ioctl(2) exts.append( Extension('fcntl', ['fcntlmodule.c']) ) - if platform not in ['mac']: + if platform not in []: # pwd(3) exts.append( Extension('pwd', ['pwdmodule.c']) ) # grp(3) @@ -510,13 +509,13 @@ exts.append( Extension('cPickle', ['cPickle.c']) ) # Memory-mapped files (also works on Win32). - if platform not in ['atheos', 'mac']: + if platform not in ['atheos']: exts.append( Extension('mmap', ['mmapmodule.c']) ) else: missing.append('mmap') # Lance Ellinghaus's syslog module - if platform not in ['mac']: + if platform not in []: # syslog daemon interface exts.append( Extension('syslog', ['syslogmodule.c']) ) else: @@ -589,7 +588,7 @@ else: missing.append('readline') - if platform not in ['mac']: + if platform not in []: # crypt module. if self.compiler_obj.find_library_file(lib_dirs, 'crypt'): @@ -1088,7 +1087,7 @@ missing.append('gdbm') # Unix-only modules - if platform not in ['mac', 'win32']: + if platform not in ['win32']: # Steen Lumholt's termios module exts.append( Extension('termios', ['termios.c']) ) # Jeremy Hylton's rlimit interface Index: Lib/py_compile.py =================================================================== --- Lib/py_compile.py (revision 78096) +++ Lib/py_compile.py (working copy) @@ -61,15 +61,6 @@ return self.msg -# Define an internal helper according to the platform -if os.name == "mac": - import MacOS - def set_creator_type(file): - MacOS.SetCreatorAndType(file, 'Pyth', 'PYC ') -else: - def set_creator_type(file): - pass - def wr_long(f, x): """Internal; write a 32-bit int to a file in little-endian order.""" f.write(chr( x & 0xff)) @@ -140,7 +131,6 @@ fc.seek(0, 0) fc.write(MAGIC) fc.close() - set_creator_type(cfile) def main(args=None): """Compile several source files. Index: Lib/distutils/util.py =================================================================== --- Lib/distutils/util.py (revision 78096) +++ Lib/distutils/util.py (working copy) @@ -91,15 +91,6 @@ 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 = pathname.split(":", 1) - pathname = ":" + elements[1] - return os.path.join(new_root, pathname) - else: raise DistutilsPlatformError("nothing known about " "platform '%s'" % os.name) Index: Lib/distutils/command/install.py =================================================================== --- Lib/distutils/command/install.py (revision 78096) +++ Lib/distutils/command/install.py (working copy) @@ -65,20 +65,6 @@ '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', Index: Lib/distutils/file_util.py =================================================================== --- Lib/distutils/file_util.py (revision 78096) +++ Lib/distutils/file_util.py (working copy) @@ -133,18 +133,9 @@ 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': Index: Lib/pydoc.py =================================================================== --- Lib/pydoc.py (revision 78096) +++ Lib/pydoc.py (working copy) @@ -2029,7 +2029,7 @@ 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 @@ -2146,10 +2146,6 @@ 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) Index: Lib/urllib.py =================================================================== --- Lib/urllib.py (revision 78096) +++ Lib/urllib.py (working copy) @@ -42,9 +42,7 @@ 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 Index: Lib/profile.py =================================================================== --- Lib/profile.py (revision 78096) +++ Lib/profile.py (working copy) @@ -97,11 +97,6 @@ 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 @@ 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 Index: Lib/platform.py =================================================================== --- Lib/platform.py (revision 78096) +++ Lib/platform.py (working copy) @@ -1167,10 +1167,6 @@ 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 Index: Lib/tarfile.py =================================================================== --- Lib/tarfile.py (revision 78096) +++ Lib/tarfile.py (working copy) @@ -53,13 +53,6 @@ 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: Index: Lib/test/regrtest.py =================================================================== --- Lib/test/regrtest.py (revision 78096) +++ Lib/test/regrtest.py (working copy) @@ -1122,41 +1122,6 @@ 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 @@ -1441,7 +1406,7 @@ 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"] Index: Lib/test/test_repr.py =================================================================== --- Lib/test/test_repr.py (revision 78096) +++ Lib/test/test_repr.py (working copy) @@ -319,8 +319,6 @@ def test_main(): run_unittest(ReprTests) - if os.name != 'mac': - run_unittest(LongReprTest) if __name__ == "__main__": Index: Lib/test/test_frozen.py =================================================================== --- Lib/test/test_frozen.py (revision 78096) +++ Lib/test/test_frozen.py (working copy) @@ -23,13 +23,12 @@ 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') Index: Lib/test/test_socket.py =================================================================== --- Lib/test/test_socket.py (revision 78096) +++ Lib/test/test_socket.py (working copy) @@ -1330,8 +1330,7 @@ def test_main(): tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest, TestExceptions, BufferIOTest, BasicTCPTest2] - if sys.platform != 'mac': - tests.extend([ BasicUDPTest, UDPTimeoutTest ]) + tests.extend([ BasicUDPTest, UDPTimeoutTest ]) tests.extend([ NonBlockingTCPTests, Index: Lib/test/test_strptime.py =================================================================== --- Lib/test/test_strptime.py (revision 78096) +++ Lib/test/test_strptime.py (working copy) @@ -298,9 +298,6 @@ 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 @@ 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 Index: Lib/test/test_tempfile.py =================================================================== --- Lib/test/test_tempfile.py (revision 78096) +++ Lib/test/test_tempfile.py (working copy) @@ -23,9 +23,7 @@ # 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 @@ 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 @@ 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 Index: Lib/test/test_select.py =================================================================== --- Lib/test/test_select.py (revision 78096) +++ Lib/test/test_select.py (working copy) @@ -20,7 +20,7 @@ self.assertRaises(TypeError, select.select, [], [], [], "not a number") def test_select(self): - if sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'): + if sys.platform[:3] in ('win', 'os2', 'riscos'): if test_support.verbose: print "Can't test select easily on", sys.platform return Index: Lib/test/test_urllib2.py =================================================================== --- Lib/test/test_urllib2.py (revision 78096) +++ Lib/test/test_urllib2.py (working copy) @@ -24,9 +24,7 @@ # 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("/.", "./")) Index: Lib/plat-mac/EasyDialogs.py =================================================================== --- Lib/plat-mac/EasyDialogs.py (revision 78096) +++ Lib/plat-mac/EasyDialogs.py (working copy) @@ -721,16 +721,13 @@ 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) Index: Lib/plat-mac/bundlebuilder.py =================================================================== --- Lib/plat-mac/bundlebuilder.py (revision 78096) +++ Lib/plat-mac/bundlebuilder.py (working copy) @@ -273,7 +273,7 @@ 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' ] Index: Lib/imputil.py =================================================================== --- Lib/imputil.py (revision 78096) +++ Lib/imputil.py (working copy) @@ -462,16 +462,6 @@ 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'