[Python-checkins] r80805 - in python/branches/py3k: Demo/pdist/FSProxy.py Lib/distutils/command/install.py Lib/distutils/file_util.py Lib/distutils/util.py Lib/platform.py Lib/profile.py Lib/pydoc.py Lib/tarfile.py Lib/test/regrtest.py Lib/test/test_frozen.py Lib/test/test_reprlib.py Lib/test/test_select.py Lib/test/test_socket.py Lib/test/test_strptime.py Lib/test/test_tempfile.py Lib/test/test_urllib2.py Lib/urllib/request.py Tools/webchecker/wcgui.py Tools/webchecker/websucker.py setup.py

ronald.oussoren python-checkins at python.org
Wed May 5 21:11:21 CEST 2010


Author: ronald.oussoren
Date: Wed May  5 21:11:21 2010
New Revision: 80805

Log:
Remove traces of MacOS9 support.

Fix for issue #7908


Modified:
   python/branches/py3k/Demo/pdist/FSProxy.py
   python/branches/py3k/Lib/distutils/command/install.py
   python/branches/py3k/Lib/distutils/file_util.py
   python/branches/py3k/Lib/distutils/util.py
   python/branches/py3k/Lib/platform.py
   python/branches/py3k/Lib/profile.py
   python/branches/py3k/Lib/pydoc.py
   python/branches/py3k/Lib/tarfile.py
   python/branches/py3k/Lib/test/regrtest.py
   python/branches/py3k/Lib/test/test_frozen.py
   python/branches/py3k/Lib/test/test_reprlib.py
   python/branches/py3k/Lib/test/test_select.py
   python/branches/py3k/Lib/test/test_socket.py
   python/branches/py3k/Lib/test/test_strptime.py
   python/branches/py3k/Lib/test/test_tempfile.py
   python/branches/py3k/Lib/test/test_urllib2.py
   python/branches/py3k/Lib/urllib/request.py
   python/branches/py3k/Tools/webchecker/wcgui.py
   python/branches/py3k/Tools/webchecker/websucker.py
   python/branches/py3k/setup.py

Modified: python/branches/py3k/Demo/pdist/FSProxy.py
==============================================================================
--- python/branches/py3k/Demo/pdist/FSProxy.py	(original)
+++ python/branches/py3k/Demo/pdist/FSProxy.py	Wed May  5 21:11:21 2010
@@ -23,12 +23,7 @@
 import time
 import fnmatch
 
-if os.name == 'mac':
-    import macfs
-    maxnamelen = 31
-else:
-    macfs = None
-    maxnamelen = 255
+maxnamelen = 255
 
 skipnames = (os.curdir, os.pardir)
 
@@ -63,16 +58,10 @@
         return ignore
 
     def _hidden(self, name):
-        if os.name == 'mac':
-            return name[0] == '(' and name[-1] == ')'
-        else:
-            return name[0] == '.'
+        return name[0] == '.'
 
     def _hide(self, name):
-        if os.name == 'mac':
-            return '(%s)' % name
-        else:
-            return '.%s' % name
+        return '.%s' % name
 
     def visible(self, name):
         if len(name) > maxnamelen: return 0
@@ -81,18 +70,8 @@
         if self._hidden(name): return 0
         head, tail = os.path.split(name)
         if head or not tail: return 0
-        if macfs:
-            if os.path.exists(name) and not os.path.isdir(name):
-                try:
-                    fs = macfs.FSSpec(name)
-                    c, t = fs.GetCreatorType()
-                    if t != 'TEXT': return 0
-                except macfs.error as msg:
-                    print("***", name, msg)
-                    return 0
-        else:
-            if os.path.islink(name): return 0
-            if '\0' in open(name, 'rb').read(512): return 0
+        if os.path.islink(name): return 0
+        if '\0' in open(name, 'rb').read(512): return 0
         for ign in self._ignore:
             if fnmatch.fnmatch(name, ign): return 0
         return 1

Modified: python/branches/py3k/Lib/distutils/command/install.py
==============================================================================
--- python/branches/py3k/Lib/distutils/command/install.py	(original)
+++ python/branches/py3k/Lib/distutils/command/install.py	Wed May  5 21:11:21 2010
@@ -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',

Modified: python/branches/py3k/Lib/distutils/file_util.py
==============================================================================
--- python/branches/py3k/Lib/distutils/file_util.py	(original)
+++ python/branches/py3k/Lib/distutils/file_util.py	Wed May  5 21:11:21 2010
@@ -132,15 +132,6 @@
     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 as exc:
-            raise DistutilsFileError(
-                  "could not copy '%s' to '%s': %s" % (src, dst, exc.args[-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':

Modified: python/branches/py3k/Lib/distutils/util.py
==============================================================================
--- python/branches/py3k/Lib/distutils/util.py	(original)
+++ python/branches/py3k/Lib/distutils/util.py	Wed May  5 21:11:21 2010
@@ -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)

Modified: python/branches/py3k/Lib/platform.py
==============================================================================
--- python/branches/py3k/Lib/platform.py	(original)
+++ python/branches/py3k/Lib/platform.py	Wed May  5 21:11:21 2010
@@ -1147,10 +1147,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

Modified: python/branches/py3k/Lib/profile.py
==============================================================================
--- python/branches/py3k/Lib/profile.py	(original)
+++ python/branches/py3k/Lib/profile.py	Wed May  5 21:11:21 2010
@@ -92,11 +92,6 @@
     else:
         return prof.print_stats()
 
-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()
@@ -173,10 +168,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

Modified: python/branches/py3k/Lib/pydoc.py
==============================================================================
--- python/branches/py3k/Lib/pydoc.py	(original)
+++ python/branches/py3k/Lib/pydoc.py	Wed May  5 21:11:21 2010
@@ -2024,7 +2024,7 @@
 
     class DocServer(http.server.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
@@ -2141,10 +2141,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)

Modified: python/branches/py3k/Lib/tarfile.py
==============================================================================
--- python/branches/py3k/Lib/tarfile.py	(original)
+++ python/branches/py3k/Lib/tarfile.py	Wed May  5 21:11:21 2010
@@ -50,13 +50,6 @@
 import copy
 import re
 
-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:

Modified: python/branches/py3k/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k/Lib/test/regrtest.py	(original)
+++ python/branches/py3k/Lib/test/regrtest.py	Wed May  5 21:11:21 2010
@@ -1209,34 +1209,6 @@
         test_kqueue
         test_ossaudiodev
         """,
-   'mac':
-        """
-        test_atexit
-        test_bz2
-        test_crypt
-        test_curses
-        test_dbm
-        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_posix
-        test_pty
-        test_pwd
-        test_resource
-        test_signal
-        test_sundry
-        test_tarfile
-        """,
     'unixware7':
         """
         test_epoll

Modified: python/branches/py3k/Lib/test/test_frozen.py
==============================================================================
--- python/branches/py3k/Lib/test/test_frozen.py	(original)
+++ python/branches/py3k/Lib/test/test_frozen.py	Wed May  5 21:11:21 2010
@@ -39,13 +39,12 @@
         else:
             self.fail("import __phello__.foo should have failed")
 
-            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")
 
         del sys.modules['__hello__']
         del sys.modules['__phello__']

Modified: python/branches/py3k/Lib/test/test_reprlib.py
==============================================================================
--- python/branches/py3k/Lib/test/test_reprlib.py	(original)
+++ python/branches/py3k/Lib/test/test_reprlib.py	Wed May  5 21:11:21 2010
@@ -304,8 +304,7 @@
 
 def test_main():
     run_unittest(ReprTests)
-    if os.name != 'mac':
-        run_unittest(LongReprTest)
+    run_unittest(LongReprTest)
 
 
 if __name__ == "__main__":

Modified: python/branches/py3k/Lib/test/test_select.py
==============================================================================
--- python/branches/py3k/Lib/test/test_select.py	(original)
+++ python/branches/py3k/Lib/test/test_select.py	Wed May  5 21:11:21 2010
@@ -4,7 +4,7 @@
 import os
 import sys
 
- at unittest.skipIf(sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'),
+ at unittest.skipIf(sys.platform[:3] in ('win', 'os2', 'riscos'),
                  "can't easily test on this system")
 class SelectTestCase(unittest.TestCase):
 

Modified: python/branches/py3k/Lib/test/test_socket.py
==============================================================================
--- python/branches/py3k/Lib/test/test_socket.py	(original)
+++ python/branches/py3k/Lib/test/test_socket.py	Wed May  5 21:11:21 2010
@@ -1465,9 +1465,7 @@
 
 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,

Modified: python/branches/py3k/Lib/test/test_strptime.py
==============================================================================
--- python/branches/py3k/Lib/test/test_strptime.py	(original)
+++ python/branches/py3k/Lib/test/test_strptime.py	Wed May  5 21:11:21 2010
@@ -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

Modified: python/branches/py3k/Lib/test/test_tempfile.py
==============================================================================
--- python/branches/py3k/Lib/test/test_tempfile.py	(original)
+++ python/branches/py3k/Lib/test/test_tempfile.py	Wed May  5 21:11:21 2010
@@ -20,9 +20,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
@@ -265,7 +263,7 @@
         file = self.do_create()
         mode = stat.S_IMODE(os.stat(file.name).st_mode)
         expected = 0o600
-        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
@@ -488,7 +486,7 @@
             mode = stat.S_IMODE(os.stat(dir).st_mode)
             mode &= 0o777 # Mask off sticky bits inherited from /tmp
             expected = 0o700
-            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

Modified: python/branches/py3k/Lib/test/test_urllib2.py
==============================================================================
--- python/branches/py3k/Lib/test/test_urllib2.py	(original)
+++ python/branches/py3k/Lib/test/test_urllib2.py	Wed May  5 21:11:21 2010
@@ -22,11 +22,6 @@
         # XXX Name hacking to get this to work on Windows.
         fname = os.path.abspath(urllib.request.__file__).replace('\\', '/')
 
-        # And more hacking to get it to work on MacOS. This assumes
-        # urllib.pathname2url works, unfortunately...
-        if os.name == 'mac':
-            fname = '/' + fname.replace(':', '/')
-
         if os.name == 'nt':
             file_url = "file:///%s" % fname
         else:

Modified: python/branches/py3k/Lib/urllib/request.py
==============================================================================
--- python/branches/py3k/Lib/urllib/request.py	(original)
+++ python/branches/py3k/Lib/urllib/request.py	Wed May  5 21:11:21 2010
@@ -1338,9 +1338,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
 else:
     def url2pathname(pathname):

Modified: python/branches/py3k/Tools/webchecker/wcgui.py
==============================================================================
--- python/branches/py3k/Tools/webchecker/wcgui.py	(original)
+++ python/branches/py3k/Tools/webchecker/wcgui.py	Wed May  5 21:11:21 2010
@@ -64,12 +64,6 @@
 import tktools
 import webchecker
 
-# Override some for a weaker platform
-if sys.platform == 'mac':
-    webchecker.DEFROOT = "http://grail.cnri.reston.va.us/"
-    webchecker.MAXPAGE = 50000
-    webchecker.verbose = 4
-
 def main():
     try:
         opts, args = getopt.getopt(sys.argv[1:], 't:m:qva')

Modified: python/branches/py3k/Tools/webchecker/websucker.py
==============================================================================
--- python/branches/py3k/Tools/webchecker/websucker.py	(original)
+++ python/branches/py3k/Tools/webchecker/websucker.py	Wed May  5 21:11:21 2010
@@ -97,8 +97,6 @@
             path = path + "index.html"
         if os.sep != "/":
             path = os.sep.join(path.split("/"))
-            if os.name == "mac":
-                path = os.sep + path
         path = os.path.join(host, path)
         return path
 

Modified: python/branches/py3k/setup.py
==============================================================================
--- python/branches/py3k/setup.py	(original)
+++ python/branches/py3k/setup.py	Wed May  5 21:11:21 2010
@@ -150,22 +150,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()
-
-            for ext in self.extensions[:]:
-                if ext.name in remove_modules:
-                    self.extensions.remove(ext)
+        # 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)
 
         # When you run "make CC=altcc" or something similar, you really want
         # those environment variables passed into the setup.py phase.  Here's
@@ -381,7 +380,7 @@
 
         # Check for MacOS X, which doesn't need libm.a at all
         math_libs = ['m']
-        if platform in ['darwin', 'mac']:
+        if platform == 'darwin':
             math_libs = []
 
         # XXX Omitted modules: gl, pure, dl, SGI-specific modules
@@ -441,19 +440,16 @@
 
         # fcntl(2) and ioctl(2)
         exts.append( Extension('fcntl', ['fcntlmodule.c']) )
-        if platform not in ['mac']:
-            # pwd(3)
-            exts.append( Extension('pwd', ['pwdmodule.c']) )
-            # grp(3)
-            exts.append( Extension('grp', ['grpmodule.c']) )
-            # spwd, shadow passwords
-            if (config_h_vars.get('HAVE_GETSPNAM', False) or
-                    config_h_vars.get('HAVE_GETSPENT', False)):
-                exts.append( Extension('spwd', ['spwdmodule.c']) )
-            else:
-                missing.append('spwd')
+        # pwd(3)
+        exts.append( Extension('pwd', ['pwdmodule.c']) )
+        # grp(3)
+        exts.append( Extension('grp', ['grpmodule.c']) )
+        # spwd, shadow passwords
+        if (config_h_vars.get('HAVE_GETSPNAM', False) or
+                config_h_vars.get('HAVE_GETSPENT', False)):
+            exts.append( Extension('spwd', ['spwdmodule.c']) )
         else:
-            missing.extend(['pwd', 'grp', 'spwd'])
+            missing.append('spwd')
 
         # select(2); not on ancient System V
         exts.append( Extension('select', ['selectmodule.c']) )
@@ -462,17 +458,11 @@
         exts.append( Extension('parser', ['parsermodule.c']) )
 
         # Memory-mapped files (also works on Win32).
-        if platform not in ['mac']:
-            exts.append( Extension('mmap', ['mmapmodule.c']) )
-        else:
-            missing.append('mmap')
+        exts.append( Extension('mmap', ['mmapmodule.c']) )
 
         # Lance Ellinghaus's syslog module
-        if platform not in ['mac']:
-            # syslog daemon interface
-            exts.append( Extension('syslog', ['syslogmodule.c']) )
-        else:
-            missing.append('syslog')
+        # syslog daemon interface
+        exts.append( Extension('syslog', ['syslogmodule.c']) )
 
         #
         # Here ends the simple stuff.  From here on, modules need certain
@@ -532,16 +522,13 @@
         else:
             missing.append('readline')
 
-        if platform not in ['mac']:
-            # crypt module.
+        # crypt module.
 
-            if self.compiler_obj.find_library_file(lib_dirs, 'crypt'):
-                libs = ['crypt']
-            else:
-                libs = []
-            exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) )
+        if self.compiler_obj.find_library_file(lib_dirs, 'crypt'):
+            libs = ['crypt']
         else:
-            missing.append('crypt')
+            libs = []
+        exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) )
 
         # CSV files
         exts.append( Extension('_csv', ['_csv.c']) )
@@ -986,7 +973,7 @@
             missing.append('_gdbm')
 
         # Unix-only modules
-        if platform not in ['mac', 'win32']:
+        if platform != 'win32':
             # Steen Lumholt's termios module
             exts.append( Extension('termios', ['termios.c']) )
             # Jeremy Hylton's rlimit interface


More information about the Python-checkins mailing list