mirror of
https://github.com/python/cpython.git
synced 2025-09-12 11:46:52 +00:00
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.
This commit is contained in:
parent
a8157183b8
commit
9545a23c7f
30 changed files with 70 additions and 267 deletions
|
@ -23,11 +23,6 @@ from stat import *
|
||||||
import time
|
import time
|
||||||
import fnmatch
|
import fnmatch
|
||||||
|
|
||||||
if os.name == 'mac':
|
|
||||||
import macfs
|
|
||||||
maxnamelen = 31
|
|
||||||
else:
|
|
||||||
macfs = None
|
|
||||||
maxnamelen = 255
|
maxnamelen = 255
|
||||||
|
|
||||||
skipnames = (os.curdir, os.pardir)
|
skipnames = (os.curdir, os.pardir)
|
||||||
|
@ -63,15 +58,9 @@ class FSProxyLocal:
|
||||||
return ignore
|
return ignore
|
||||||
|
|
||||||
def _hidden(self, name):
|
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):
|
def _hide(self, name):
|
||||||
if os.name == 'mac':
|
|
||||||
return '(%s)' % name
|
|
||||||
else:
|
|
||||||
return '.%s' % name
|
return '.%s' % name
|
||||||
|
|
||||||
def visible(self, name):
|
def visible(self, name):
|
||||||
|
@ -81,16 +70,6 @@ class FSProxyLocal:
|
||||||
if self._hidden(name): return 0
|
if self._hidden(name): return 0
|
||||||
head, tail = os.path.split(name)
|
head, tail = os.path.split(name)
|
||||||
if head or not tail: return 0
|
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, msg:
|
|
||||||
print "***", name, msg
|
|
||||||
return 0
|
|
||||||
else:
|
|
||||||
if os.path.islink(name): return 0
|
if os.path.islink(name): return 0
|
||||||
if '\0' in open(name, 'rb').read(512): return 0
|
if '\0' in open(name, 'rb').read(512): return 0
|
||||||
for ign in self._ignore:
|
for ign in self._ignore:
|
||||||
|
|
|
@ -47,7 +47,7 @@ Notes on the availability of these functions:
|
||||||
.. data:: name
|
.. data:: name
|
||||||
|
|
||||||
The name of the operating system dependent module imported. The following
|
The name of the operating system dependent module imported. The following
|
||||||
names have currently been registered: ``'posix'``, ``'nt'``, ``'mac'``,
|
names have currently been registered: ``'posix'``, ``'nt'``,
|
||||||
``'os2'``, ``'ce'``, ``'java'``, ``'riscos'``.
|
``'os2'``, ``'ce'``, ``'java'``, ``'riscos'``.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -175,9 +175,6 @@ class BinHex:
|
||||||
if type(ofp) == type(''):
|
if type(ofp) == type(''):
|
||||||
ofname = ofp
|
ofname = ofp
|
||||||
ofp = open(ofname, 'w')
|
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:')
|
ofp.write('(This file must be converted with BinHex 4.0)\n\n:')
|
||||||
hqxer = _Hqxcoderengine(ofp)
|
hqxer = _Hqxcoderengine(ofp)
|
||||||
self.ofp = _Rlecoderengine(hqxer)
|
self.ofp = _Rlecoderengine(hqxer)
|
||||||
|
@ -478,9 +475,6 @@ def hexbin(inp, out):
|
||||||
finfo = ifp.FInfo
|
finfo = ifp.FInfo
|
||||||
if not out:
|
if not out:
|
||||||
out = ifp.FName
|
out = ifp.FName
|
||||||
if os.name == 'mac':
|
|
||||||
ofss = FSSpec(out)
|
|
||||||
out = ofss.as_pathname()
|
|
||||||
|
|
||||||
ofp = open(out, 'wb')
|
ofp = open(out, 'wb')
|
||||||
# XXXX Do translation on non-mac systems
|
# XXXX Do translation on non-mac systems
|
||||||
|
@ -501,13 +495,6 @@ def hexbin(inp, out):
|
||||||
ofp.write(d)
|
ofp.write(d)
|
||||||
ofp.close()
|
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()
|
ifp.close()
|
||||||
|
|
||||||
def _test():
|
def _test():
|
||||||
|
|
|
@ -69,20 +69,6 @@ INSTALL_SCHEMES = {
|
||||||
'scripts': '$userbase/Scripts',
|
'scripts': '$userbase/Scripts',
|
||||||
'data' : '$userbase',
|
'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': {
|
'os2': {
|
||||||
'purelib': '$base/Lib/site-packages',
|
'purelib': '$base/Lib/site-packages',
|
||||||
'platlib': '$base/Lib/site-packages',
|
'platlib': '$base/Lib/site-packages',
|
||||||
|
|
|
@ -133,18 +133,9 @@ def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0,
|
||||||
if dry_run:
|
if dry_run:
|
||||||
return (dst, 1)
|
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
|
# If linking (hard or symbolic), use the appropriate system call
|
||||||
# (Unix only, of course, but that's the caller's responsibility)
|
# (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)):
|
if not (os.path.exists(dst) and os.path.samefile(src, dst)):
|
||||||
os.link(src, dst)
|
os.link(src, dst)
|
||||||
elif link == 'sym':
|
elif link == 'sym':
|
||||||
|
|
|
@ -88,11 +88,6 @@ def get_python_inc(plat_specific=0, prefix=None):
|
||||||
return os.path.join(prefix, "include", "python" + get_python_version())
|
return os.path.join(prefix, "include", "python" + get_python_version())
|
||||||
elif os.name == "nt":
|
elif os.name == "nt":
|
||||||
return os.path.join(prefix, "include")
|
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":
|
elif os.name == "os2":
|
||||||
return os.path.join(prefix, "Include")
|
return os.path.join(prefix, "Include")
|
||||||
else:
|
else:
|
||||||
|
@ -135,18 +130,6 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
|
||||||
else:
|
else:
|
||||||
return os.path.join(prefix, "Lib", "site-packages")
|
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":
|
elif os.name == "os2":
|
||||||
if standard_lib:
|
if standard_lib:
|
||||||
return os.path.join(prefix, "Lib")
|
return os.path.join(prefix, "Lib")
|
||||||
|
|
|
@ -235,15 +235,6 @@ def change_root (new_root, pathname):
|
||||||
path = path[1:]
|
path = path[1:]
|
||||||
return os.path.join(new_root, path)
|
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:
|
else:
|
||||||
raise DistutilsPlatformError, \
|
raise DistutilsPlatformError, \
|
||||||
"nothing known about platform '%s'" % os.name
|
"nothing known about platform '%s'" % os.name
|
||||||
|
|
|
@ -462,16 +462,6 @@ def _os_bootstrap():
|
||||||
elif 'os2' in names:
|
elif 'os2' in names:
|
||||||
sep = '\\'
|
sep = '\\'
|
||||||
from os2 import stat
|
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:
|
else:
|
||||||
raise ImportError, 'no os specific module found'
|
raise ImportError, 'no os specific module found'
|
||||||
|
|
||||||
|
|
|
@ -721,9 +721,6 @@ def AskFileForSave(
|
||||||
if issubclass(tpwanted, Carbon.File.FSSpec):
|
if issubclass(tpwanted, Carbon.File.FSSpec):
|
||||||
return tpwanted(rr.selection[0])
|
return tpwanted(rr.selection[0])
|
||||||
if issubclass(tpwanted, (str, unicode)):
|
if issubclass(tpwanted, (str, unicode)):
|
||||||
if sys.platform == 'mac':
|
|
||||||
fullpath = rr.selection[0].as_pathname()
|
|
||||||
else:
|
|
||||||
# This is gross, and probably incorrect too
|
# This is gross, and probably incorrect too
|
||||||
vrefnum, dirid, name = rr.selection[0].as_tuple()
|
vrefnum, dirid, name = rr.selection[0].as_tuple()
|
||||||
pardir_fss = Carbon.File.FSSpec((vrefnum, dirid, ''))
|
pardir_fss = Carbon.File.FSSpec((vrefnum, dirid, ''))
|
||||||
|
|
|
@ -273,7 +273,7 @@ __load()
|
||||||
del __load
|
del __load
|
||||||
"""
|
"""
|
||||||
|
|
||||||
MAYMISS_MODULES = ['mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath',
|
MAYMISS_MODULES = ['os2', 'nt', 'ntpath', 'dos', 'dospath',
|
||||||
'win32api', 'ce', '_winreg', 'nturl2path', 'sitecustomize',
|
'win32api', 'ce', '_winreg', 'nturl2path', 'sitecustomize',
|
||||||
'org.python.core', 'riscos', 'riscosenviron', 'riscospath'
|
'org.python.core', 'riscos', 'riscosenviron', 'riscospath'
|
||||||
]
|
]
|
||||||
|
|
|
@ -1171,10 +1171,6 @@ def uname():
|
||||||
if not version:
|
if not version:
|
||||||
version = vendor
|
version = vendor
|
||||||
|
|
||||||
elif os.name == 'mac':
|
|
||||||
release,(version,stage,nonrel),machine = mac_ver()
|
|
||||||
system = 'MacOS'
|
|
||||||
|
|
||||||
# System specific extensions
|
# System specific extensions
|
||||||
if system == 'OpenVMS':
|
if system == 'OpenVMS':
|
||||||
# OpenVMS seems to have release and version mixed up
|
# OpenVMS seems to have release and version mixed up
|
||||||
|
|
|
@ -97,11 +97,6 @@ def help():
|
||||||
print "Documentation for the profile module can be found "
|
print "Documentation for the profile module can be found "
|
||||||
print "in the Python Library Reference, section 'The Python Profiler'."
|
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"):
|
if hasattr(os, "times"):
|
||||||
def _get_time_times(timer=os.times):
|
def _get_time_times(timer=os.times):
|
||||||
t = timer()
|
t = timer()
|
||||||
|
@ -178,10 +173,6 @@ class Profile:
|
||||||
self.timer = resgetrusage
|
self.timer = resgetrusage
|
||||||
self.dispatcher = self.trace_dispatch
|
self.dispatcher = self.trace_dispatch
|
||||||
self.get_time = _get_time_resource
|
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'):
|
elif hasattr(time, 'clock'):
|
||||||
self.timer = self.get_time = time.clock
|
self.timer = self.get_time = time.clock
|
||||||
self.dispatcher = self.trace_dispatch_i
|
self.dispatcher = self.trace_dispatch_i
|
||||||
|
|
|
@ -2028,7 +2028,7 @@ pydoc</strong> by Ka-Ping Yee <ping@lfw.org></font>'''
|
||||||
|
|
||||||
class DocServer(BaseHTTPServer.HTTPServer):
|
class DocServer(BaseHTTPServer.HTTPServer):
|
||||||
def __init__(self, port, callback):
|
def __init__(self, port, callback):
|
||||||
host = (sys.platform == 'mac') and '127.0.0.1' or 'localhost'
|
host = 'localhost'
|
||||||
self.address = ('', port)
|
self.address = ('', port)
|
||||||
self.url = 'http://%s:%d/' % (host, port)
|
self.url = 'http://%s:%d/' % (host, port)
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
|
@ -2145,10 +2145,6 @@ def gui():
|
||||||
except ImportError: # pre-webbrowser.py compatibility
|
except ImportError: # pre-webbrowser.py compatibility
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
os.system('start "%s"' % url)
|
os.system('start "%s"' % url)
|
||||||
elif sys.platform == 'mac':
|
|
||||||
try: import ic
|
|
||||||
except ImportError: pass
|
|
||||||
else: ic.launchurl(url)
|
|
||||||
else:
|
else:
|
||||||
rc = os.system('netscape -remote "openURL(%s)" &' % url)
|
rc = os.system('netscape -remote "openURL(%s)" &' % url)
|
||||||
if rc: os.system('netscape "%s" &' % url)
|
if rc: os.system('netscape "%s" &' % url)
|
||||||
|
|
|
@ -53,13 +53,6 @@ import copy
|
||||||
import re
|
import re
|
||||||
import operator
|
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:
|
try:
|
||||||
import grp, pwd
|
import grp, pwd
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -1156,41 +1156,6 @@ _expectations = {
|
||||||
test_kqueue
|
test_kqueue
|
||||||
test_ossaudiodev
|
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':
|
'unixware7':
|
||||||
"""
|
"""
|
||||||
test_bsddb
|
test_bsddb
|
||||||
|
@ -1477,7 +1442,7 @@ class _ExpectedSkips:
|
||||||
if sys.maxint == 9223372036854775807L:
|
if sys.maxint == 9223372036854775807L:
|
||||||
self.expected.add('test_imageop')
|
self.expected.add('test_imageop')
|
||||||
|
|
||||||
if not sys.platform in ("mac", "darwin"):
|
if sys.platform != "darwin":
|
||||||
MAC_ONLY = ["test_macos", "test_macostools", "test_aepack",
|
MAC_ONLY = ["test_macos", "test_macostools", "test_aepack",
|
||||||
"test_plistlib", "test_scriptpackages",
|
"test_plistlib", "test_scriptpackages",
|
||||||
"test_applesingle"]
|
"test_applesingle"]
|
||||||
|
|
|
@ -23,7 +23,6 @@ class FrozenTests(unittest.TestCase):
|
||||||
except ImportError, x:
|
except ImportError, x:
|
||||||
self.fail("import __phello__.spam failed:" + str(x))
|
self.fail("import __phello__.spam failed:" + str(x))
|
||||||
|
|
||||||
if sys.platform != "mac": # On the Mac this import does succeed.
|
|
||||||
try:
|
try:
|
||||||
import __phello__.foo
|
import __phello__.foo
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -320,7 +320,6 @@ class ClassWithFailingRepr:
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
run_unittest(ReprTests)
|
run_unittest(ReprTests)
|
||||||
if os.name != 'mac':
|
|
||||||
run_unittest(LongReprTest)
|
run_unittest(LongReprTest)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import select
|
||||||
import os
|
import os
|
||||||
import sys
|
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")
|
"can't easily test on this system")
|
||||||
class SelectTestCase(unittest.TestCase):
|
class SelectTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
|
|
@ -1383,9 +1383,8 @@ class TIPCThreadableTest (unittest.TestCase, ThreadableTest):
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest,
|
tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest,
|
||||||
TestExceptions, BufferIOTest, BasicTCPTest2]
|
TestExceptions, BufferIOTest, BasicTCPTest2, BasicUDPTest,
|
||||||
if sys.platform != 'mac':
|
UDPTimeoutTest ]
|
||||||
tests.extend([ BasicUDPTest, UDPTimeoutTest ])
|
|
||||||
|
|
||||||
tests.extend([
|
tests.extend([
|
||||||
NonBlockingTCPTests,
|
NonBlockingTCPTests,
|
||||||
|
|
|
@ -298,9 +298,6 @@ class StrptimeTests(unittest.TestCase):
|
||||||
self.assertEqual(strp_output.tm_isdst, 0)
|
self.assertEqual(strp_output.tm_isdst, 0)
|
||||||
strp_output = _strptime._strptime_time("GMT", "%Z")
|
strp_output = _strptime._strptime_time("GMT", "%Z")
|
||||||
self.assertEqual(strp_output.tm_isdst, 0)
|
self.assertEqual(strp_output.tm_isdst, 0)
|
||||||
if sys.platform == "mac":
|
|
||||||
# Timezones don't really work on MacOS9
|
|
||||||
return
|
|
||||||
time_tuple = time.localtime()
|
time_tuple = time.localtime()
|
||||||
strf_output = time.strftime("%Z") #UTC does not have a timezone
|
strf_output = time.strftime("%Z") #UTC does not have a timezone
|
||||||
strp_output = _strptime._strptime_time(strf_output, "%Z")
|
strp_output = _strptime._strptime_time(strf_output, "%Z")
|
||||||
|
@ -317,8 +314,6 @@ class StrptimeTests(unittest.TestCase):
|
||||||
def test_bad_timezone(self):
|
def test_bad_timezone(self):
|
||||||
# Explicitly test possibility of bad timezone;
|
# Explicitly test possibility of bad timezone;
|
||||||
# when time.tzname[0] == time.tzname[1] and time.daylight
|
# 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]
|
tz_name = time.tzname[0]
|
||||||
if tz_name.upper() in ("UTC", "GMT"):
|
if tz_name.upper() in ("UTC", "GMT"):
|
||||||
return
|
return
|
||||||
|
|
|
@ -23,9 +23,7 @@ has_spawnl = hasattr(os, 'spawnl')
|
||||||
|
|
||||||
# TEST_FILES may need to be tweaked for systems depending on the maximum
|
# 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)
|
# number of files that can be opened at one time (see ulimit -n)
|
||||||
if sys.platform == 'mac':
|
if sys.platform in ('openbsd3', 'openbsd4'):
|
||||||
TEST_FILES = 32
|
|
||||||
elif sys.platform in ('openbsd3', 'openbsd4'):
|
|
||||||
TEST_FILES = 48
|
TEST_FILES = 48
|
||||||
else:
|
else:
|
||||||
TEST_FILES = 100
|
TEST_FILES = 100
|
||||||
|
@ -257,7 +255,7 @@ class test__mkstemp_inner(TC):
|
||||||
file = self.do_create()
|
file = self.do_create()
|
||||||
mode = stat.S_IMODE(os.stat(file.name).st_mode)
|
mode = stat.S_IMODE(os.stat(file.name).st_mode)
|
||||||
expected = 0600
|
expected = 0600
|
||||||
if sys.platform in ('win32', 'os2emx', 'mac'):
|
if sys.platform in ('win32', 'os2emx'):
|
||||||
# There's no distinction among 'user', 'group' and 'world';
|
# There's no distinction among 'user', 'group' and 'world';
|
||||||
# replicate the 'user' bits.
|
# replicate the 'user' bits.
|
||||||
user = expected >> 6
|
user = expected >> 6
|
||||||
|
@ -476,7 +474,7 @@ class test_mkdtemp(TC):
|
||||||
mode = stat.S_IMODE(os.stat(dir).st_mode)
|
mode = stat.S_IMODE(os.stat(dir).st_mode)
|
||||||
mode &= 0777 # Mask off sticky bits inherited from /tmp
|
mode &= 0777 # Mask off sticky bits inherited from /tmp
|
||||||
expected = 0700
|
expected = 0700
|
||||||
if sys.platform in ('win32', 'os2emx', 'mac'):
|
if sys.platform in ('win32', 'os2emx'):
|
||||||
# There's no distinction among 'user', 'group' and 'world';
|
# There's no distinction among 'user', 'group' and 'world';
|
||||||
# replicate the 'user' bits.
|
# replicate the 'user' bits.
|
||||||
user = expected >> 6
|
user = expected >> 6
|
||||||
|
|
|
@ -24,9 +24,7 @@ class TrivialTests(unittest.TestCase):
|
||||||
|
|
||||||
# And more hacking to get it to work on MacOS. This assumes
|
# And more hacking to get it to work on MacOS. This assumes
|
||||||
# urllib.pathname2url works, unfortunately...
|
# urllib.pathname2url works, unfortunately...
|
||||||
if os.name == 'mac':
|
if os.name == 'riscos':
|
||||||
fname = '/' + fname.replace(':', '/')
|
|
||||||
elif os.name == 'riscos':
|
|
||||||
import string
|
import string
|
||||||
fname = os.expand(fname)
|
fname = os.expand(fname)
|
||||||
fname = fname.translate(string.maketrans("/.", "./"))
|
fname = fname.translate(string.maketrans("/.", "./"))
|
||||||
|
|
|
@ -42,9 +42,7 @@ __version__ = '1.17' # XXX This version is not always updated :-(
|
||||||
MAXFTPCACHE = 10 # Trim the ftp cache beyond this size
|
MAXFTPCACHE = 10 # Trim the ftp cache beyond this size
|
||||||
|
|
||||||
# Helper for non-unix systems
|
# Helper for non-unix systems
|
||||||
if os.name == 'mac':
|
if os.name == 'nt':
|
||||||
from macurl2path import url2pathname, pathname2url
|
|
||||||
elif os.name == 'nt':
|
|
||||||
from nturl2path import url2pathname, pathname2url
|
from nturl2path import url2pathname, pathname2url
|
||||||
elif os.name == 'riscos':
|
elif os.name == 'riscos':
|
||||||
from rourl2path import url2pathname, pathname2url
|
from rourl2path import url2pathname, pathname2url
|
||||||
|
|
|
@ -112,9 +112,6 @@ def buildapplet():
|
||||||
usage()
|
usage()
|
||||||
elif opt in ('-d', '--destroot'):
|
elif opt in ('-d', '--destroot'):
|
||||||
destroot = arg
|
destroot = arg
|
||||||
# On OS9 always be verbose
|
|
||||||
if sys.platform == 'mac' and not verbose:
|
|
||||||
verbose = 'default'
|
|
||||||
# Loop over all files to be processed
|
# Loop over all files to be processed
|
||||||
for filename in args:
|
for filename in args:
|
||||||
cr, tp = MacOS.GetCreatorAndType(filename)
|
cr, tp = MacOS.GetCreatorAndType(filename)
|
||||||
|
|
|
@ -9,13 +9,6 @@ doit = 1
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if not sys.argv[1:]:
|
if not sys.argv[1:]:
|
||||||
if os.name == 'mac':
|
|
||||||
import EasyDialogs
|
|
||||||
dir = EasyDialogs.AskFolder(message='Directory to zap pyc files in')
|
|
||||||
if not dir:
|
|
||||||
sys.exit(0)
|
|
||||||
zappyc(dir)
|
|
||||||
else:
|
|
||||||
print 'Usage: zappyc dir ...'
|
print 'Usage: zappyc dir ...'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
for dir in sys.argv[1:]:
|
for dir in sys.argv[1:]:
|
||||||
|
|
|
@ -356,7 +356,7 @@ class PyBuildExt(build_ext):
|
||||||
libraries = dblib) )
|
libraries = dblib) )
|
||||||
|
|
||||||
# Unix-only modules
|
# Unix-only modules
|
||||||
if platform not in ['mac', 'win32']:
|
if platform == 'win32':
|
||||||
# Steen Lumholt's termios module
|
# Steen Lumholt's termios module
|
||||||
exts.append( Extension('termios', ['termios.c']) )
|
exts.append( Extension('termios', ['termios.c']) )
|
||||||
# Jeremy Hylton's rlimit interface
|
# Jeremy Hylton's rlimit interface
|
||||||
|
|
|
@ -1390,7 +1390,7 @@ platform.py)
|
||||||
|
|
||||||
Some os variables
|
Some os variables
|
||||||
Variable Meaning
|
Variable Meaning
|
||||||
name name of O/S-specific module (e.g. "posix", "mac", "nt")
|
name name of O/S-specific module (e.g. "posix", "nt")
|
||||||
path O/S-specific module for path manipulations.
|
path O/S-specific module for path manipulations.
|
||||||
On Unix, os.path.split() <=> posixpath.split()
|
On Unix, os.path.split() <=> posixpath.split()
|
||||||
curdir string used to represent current directory ('.')
|
curdir string used to represent current directory ('.')
|
||||||
|
|
|
@ -64,12 +64,6 @@ from Tkinter import *
|
||||||
import tktools
|
import tktools
|
||||||
import webchecker
|
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():
|
def main():
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], 't:m:qva')
|
opts, args = getopt.getopt(sys.argv[1:], 't:m:qva')
|
||||||
|
|
|
@ -97,8 +97,6 @@ class Sucker(webchecker.Checker):
|
||||||
path = path + "index.html"
|
path = path + "index.html"
|
||||||
if os.sep != "/":
|
if os.sep != "/":
|
||||||
path = os.sep.join(path.split("/"))
|
path = os.sep.join(path.split("/"))
|
||||||
if os.name == "mac":
|
|
||||||
path = os.sep + path
|
|
||||||
path = os.path.join(host, path)
|
path = os.path.join(host, path)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
18
setup.py
18
setup.py
|
@ -127,7 +127,7 @@ class PyBuildExt(build_ext):
|
||||||
# Platform-dependent module source and include directories
|
# Platform-dependent module source and include directories
|
||||||
incdirlist = []
|
incdirlist = []
|
||||||
platform = self.get_platform()
|
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")):
|
sysconfig.get_config_var("CONFIG_ARGS")):
|
||||||
# Mac OS X also includes some mac-specific modules
|
# Mac OS X also includes some mac-specific modules
|
||||||
macmoddir = os.path.join(srcdir, 'Mac/Modules')
|
macmoddir = os.path.join(srcdir, 'Mac/Modules')
|
||||||
|
@ -160,7 +160,6 @@ class PyBuildExt(build_ext):
|
||||||
if ext.name in sys.builtin_module_names:
|
if ext.name in sys.builtin_module_names:
|
||||||
self.extensions.remove(ext)
|
self.extensions.remove(ext)
|
||||||
|
|
||||||
if platform != 'mac':
|
|
||||||
# Parse Modules/Setup and Modules/Setup.local to figure out which
|
# Parse Modules/Setup and Modules/Setup.local to figure out which
|
||||||
# modules are turned on in the file.
|
# modules are turned on in the file.
|
||||||
remove_modules = []
|
remove_modules = []
|
||||||
|
@ -397,7 +396,7 @@ class PyBuildExt(build_ext):
|
||||||
|
|
||||||
# Check for MacOS X, which doesn't need libm.a at all
|
# Check for MacOS X, which doesn't need libm.a at all
|
||||||
math_libs = ['m']
|
math_libs = ['m']
|
||||||
if platform in ['darwin', 'beos', 'mac']:
|
if platform in ['darwin', 'beos']:
|
||||||
math_libs = []
|
math_libs = []
|
||||||
|
|
||||||
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
|
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
|
||||||
|
@ -485,7 +484,6 @@ class PyBuildExt(build_ext):
|
||||||
|
|
||||||
# fcntl(2) and ioctl(2)
|
# fcntl(2) and ioctl(2)
|
||||||
exts.append( Extension('fcntl', ['fcntlmodule.c']) )
|
exts.append( Extension('fcntl', ['fcntlmodule.c']) )
|
||||||
if platform not in ['mac']:
|
|
||||||
# pwd(3)
|
# pwd(3)
|
||||||
exts.append( Extension('pwd', ['pwdmodule.c']) )
|
exts.append( Extension('pwd', ['pwdmodule.c']) )
|
||||||
# grp(3)
|
# grp(3)
|
||||||
|
@ -496,8 +494,6 @@ class PyBuildExt(build_ext):
|
||||||
exts.append( Extension('spwd', ['spwdmodule.c']) )
|
exts.append( Extension('spwd', ['spwdmodule.c']) )
|
||||||
else:
|
else:
|
||||||
missing.append('spwd')
|
missing.append('spwd')
|
||||||
else:
|
|
||||||
missing.extend(['pwd', 'grp', 'spwd'])
|
|
||||||
|
|
||||||
# select(2); not on ancient System V
|
# select(2); not on ancient System V
|
||||||
exts.append( Extension('select', ['selectmodule.c']) )
|
exts.append( Extension('select', ['selectmodule.c']) )
|
||||||
|
@ -510,17 +506,14 @@ class PyBuildExt(build_ext):
|
||||||
exts.append( Extension('cPickle', ['cPickle.c']) )
|
exts.append( Extension('cPickle', ['cPickle.c']) )
|
||||||
|
|
||||||
# Memory-mapped files (also works on Win32).
|
# Memory-mapped files (also works on Win32).
|
||||||
if platform not in ['atheos', 'mac']:
|
if platform not in ['atheos']:
|
||||||
exts.append( Extension('mmap', ['mmapmodule.c']) )
|
exts.append( Extension('mmap', ['mmapmodule.c']) )
|
||||||
else:
|
else:
|
||||||
missing.append('mmap')
|
missing.append('mmap')
|
||||||
|
|
||||||
# Lance Ellinghaus's syslog module
|
# Lance Ellinghaus's syslog module
|
||||||
if platform not in ['mac']:
|
|
||||||
# syslog daemon interface
|
# syslog daemon interface
|
||||||
exts.append( Extension('syslog', ['syslogmodule.c']) )
|
exts.append( Extension('syslog', ['syslogmodule.c']) )
|
||||||
else:
|
|
||||||
missing.append('syslog')
|
|
||||||
|
|
||||||
# George Neville-Neil's timing module:
|
# George Neville-Neil's timing module:
|
||||||
# Deprecated in PEP 4 http://www.python.org/peps/pep-0004.html
|
# Deprecated in PEP 4 http://www.python.org/peps/pep-0004.html
|
||||||
|
@ -592,7 +585,6 @@ class PyBuildExt(build_ext):
|
||||||
else:
|
else:
|
||||||
missing.append('readline')
|
missing.append('readline')
|
||||||
|
|
||||||
if platform not in ['mac']:
|
|
||||||
# crypt module.
|
# crypt module.
|
||||||
|
|
||||||
if self.compiler.find_library_file(lib_dirs, 'crypt'):
|
if self.compiler.find_library_file(lib_dirs, 'crypt'):
|
||||||
|
@ -600,8 +592,6 @@ class PyBuildExt(build_ext):
|
||||||
else:
|
else:
|
||||||
libs = []
|
libs = []
|
||||||
exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) )
|
exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) )
|
||||||
else:
|
|
||||||
missing.append('crypt')
|
|
||||||
|
|
||||||
# CSV files
|
# CSV files
|
||||||
exts.append( Extension('_csv', ['_csv.c']) )
|
exts.append( Extension('_csv', ['_csv.c']) )
|
||||||
|
@ -1093,7 +1083,7 @@ class PyBuildExt(build_ext):
|
||||||
missing.append('gdbm')
|
missing.append('gdbm')
|
||||||
|
|
||||||
# Unix-only modules
|
# Unix-only modules
|
||||||
if platform not in ['mac', 'win32']:
|
if platform not in ['win32']:
|
||||||
# Steen Lumholt's termios module
|
# Steen Lumholt's termios module
|
||||||
exts.append( Extension('termios', ['termios.c']) )
|
exts.append( Extension('termios', ['termios.c']) )
|
||||||
# Jeremy Hylton's rlimit interface
|
# Jeremy Hylton's rlimit interface
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue