Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 94f2528

Browse files
Remove traces of MacOS9 support.
Fix for issue #7908
1 parent a045f19 commit 94f2528

20 files changed

Lines changed: 53 additions & 197 deletions

Demo/pdist/FSProxy.py

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@
2323
import time
2424
import fnmatch
2525

26-
if os.name == 'mac':
27-
import macfs
28-
maxnamelen = 31
29-
else:
30-
macfs = None
31-
maxnamelen = 255
26+
maxnamelen = 255
3227

3328
skipnames = (os.curdir, os.pardir)
3429

@@ -63,16 +58,10 @@ def _readignore(self):
6358
return ignore
6459

6560
def _hidden(self, name):
66-
if os.name == 'mac':
67-
return name[0] == '(' and name[-1] == ')'
68-
else:
69-
return name[0] == '.'
61+
return name[0] == '.'
7062

7163
def _hide(self, name):
72-
if os.name == 'mac':
73-
return '(%s)' % name
74-
else:
75-
return '.%s' % name
64+
return '.%s' % name
7665

7766
def visible(self, name):
7867
if len(name) > maxnamelen: return 0
@@ -81,18 +70,8 @@ def visible(self, name):
8170
if self._hidden(name): return 0
8271
head, tail = os.path.split(name)
8372
if head or not tail: return 0
84-
if macfs:
85-
if os.path.exists(name) and not os.path.isdir(name):
86-
try:
87-
fs = macfs.FSSpec(name)
88-
c, t = fs.GetCreatorType()
89-
if t != 'TEXT': return 0
90-
except macfs.error as msg:
91-
print("***", name, msg)
92-
return 0
93-
else:
94-
if os.path.islink(name): return 0
95-
if '\0' in open(name, 'rb').read(512): return 0
73+
if os.path.islink(name): return 0
74+
if '\0' in open(name, 'rb').read(512): return 0
9675
for ign in self._ignore:
9776
if fnmatch.fnmatch(name, ign): return 0
9877
return 1

Lib/distutils/command/install.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,6 @@
6565
'scripts': '$userbase/Scripts',
6666
'data' : '$userbase',
6767
},
68-
'mac': {
69-
'purelib': '$base/Lib/site-packages',
70-
'platlib': '$base/Lib/site-packages',
71-
'headers': '$base/Include/$dist_name',
72-
'scripts': '$base/Scripts',
73-
'data' : '$base',
74-
},
75-
'mac_user': {
76-
'purelib': '$usersite',
77-
'platlib': '$usersite',
78-
'headers': '$userbase/$py_version_short/include/$dist_name',
79-
'scripts': '$userbase/bin',
80-
'data' : '$userbase',
81-
},
8268
'os2': {
8369
'purelib': '$base/Lib/site-packages',
8470
'platlib': '$base/Lib/site-packages',

Lib/distutils/file_util.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,6 @@ def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0,
132132
if dry_run:
133133
return (dst, 1)
134134

135-
# On Mac OS, use the native file copy routine
136-
if os.name == 'mac':
137-
import macostools
138-
try:
139-
macostools.copy(src, dst, 0, preserve_times)
140-
except os.error as exc:
141-
raise DistutilsFileError(
142-
"could not copy '%s' to '%s': %s" % (src, dst, exc.args[-1]))
143-
144135
# If linking (hard or symbolic), use the appropriate system call
145136
# (Unix only, of course, but that's the caller's responsibility)
146137
elif link == 'hard':

Lib/distutils/util.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,6 @@ def change_root(new_root, pathname):
9191
path = path[1:]
9292
return os.path.join(new_root, path)
9393

94-
elif os.name == 'mac':
95-
if not os.path.isabs(pathname):
96-
return os.path.join(new_root, pathname)
97-
else:
98-
# Chop off volume name from start of path
99-
elements = pathname.split(":", 1)
100-
pathname = ":" + elements[1]
101-
return os.path.join(new_root, pathname)
102-
10394
else:
10495
raise DistutilsPlatformError("nothing known about "
10596
"platform '%s'" % os.name)

Lib/platform.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,10 +1147,6 @@ def uname():
11471147
if not version:
11481148
version = vendor
11491149

1150-
elif os.name == 'mac':
1151-
release,(version,stage,nonrel),machine = mac_ver()
1152-
system = 'MacOS'
1153-
11541150
# System specific extensions
11551151
if system == 'OpenVMS':
11561152
# OpenVMS seems to have release and version mixed up

Lib/profile.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ def runctx(statement, globals, locals, filename=None):
9292
else:
9393
return prof.print_stats()
9494

95-
if os.name == "mac":
96-
import MacOS
97-
def _get_time_mac(timer=MacOS.GetTicks):
98-
return timer() / 60.0
99-
10095
if hasattr(os, "times"):
10196
def _get_time_times(timer=os.times):
10297
t = timer()
@@ -173,10 +168,6 @@ def __init__(self, timer=None, bias=None):
173168
self.timer = resgetrusage
174169
self.dispatcher = self.trace_dispatch
175170
self.get_time = _get_time_resource
176-
elif os.name == 'mac':
177-
self.timer = MacOS.GetTicks
178-
self.dispatcher = self.trace_dispatch_mac
179-
self.get_time = _get_time_mac
180171
elif hasattr(time, 'clock'):
181172
self.timer = self.get_time = time.clock
182173
self.dispatcher = self.trace_dispatch_i

Lib/pydoc.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,7 @@ def log_message(self, *args): pass
20242024

20252025
class DocServer(http.server.HTTPServer):
20262026
def __init__(self, port, callback):
2027-
host = (sys.platform == 'mac') and '127.0.0.1' or 'localhost'
2027+
host = 'localhost'
20282028
self.address = ('', port)
20292029
self.url = 'http://%s:%d/' % (host, port)
20302030
self.callback = callback
@@ -2141,10 +2141,6 @@ def open(self, event=None, url=None):
21412141
except ImportError: # pre-webbrowser.py compatibility
21422142
if sys.platform == 'win32':
21432143
os.system('start "%s"' % url)
2144-
elif sys.platform == 'mac':
2145-
try: import ic
2146-
except ImportError: pass
2147-
else: ic.launchurl(url)
21482144
else:
21492145
rc = os.system('netscape -remote "openURL(%s)" &' % url)
21502146
if rc: os.system('netscape "%s" &' % url)

Lib/tarfile.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@
5050
import copy
5151
import re
5252

53-
if sys.platform == 'mac':
54-
# This module needs work for MacOS9, especially in the area of pathname
55-
# handling. In many places it is assumed a simple substitution of / by the
56-
# local os.path.sep is good enough to convert pathnames, but this does not
57-
# work with the mac rooted:path:name versus :nonrooted:path:name syntax
58-
raise ImportError("tarfile does not work for platform==mac")
59-
6053
try:
6154
import grp, pwd
6255
except ImportError:

Lib/test/regrtest.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,34 +1209,6 @@ def printlist(x, width=70, indent=4):
12091209
test_kqueue
12101210
test_ossaudiodev
12111211
""",
1212-
'mac':
1213-
"""
1214-
test_atexit
1215-
test_bz2
1216-
test_crypt
1217-
test_curses
1218-
test_dbm
1219-
test_fcntl
1220-
test_fork1
1221-
test_epoll
1222-
test_grp
1223-
test_ioctl
1224-
test_largefile
1225-
test_locale
1226-
test_kqueue
1227-
test_mmap
1228-
test_openpty
1229-
test_ossaudiodev
1230-
test_poll
1231-
test_popen
1232-
test_posix
1233-
test_pty
1234-
test_pwd
1235-
test_resource
1236-
test_signal
1237-
test_sundry
1238-
test_tarfile
1239-
""",
12401212
'unixware7':
12411213
"""
12421214
test_epoll

Lib/test/test_frozen.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ def test_frozen(self):
3939
else:
4040
self.fail("import __phello__.foo should have failed")
4141

42-
if sys.platform != "mac": # On the Mac this import does succeed.
43-
try:
44-
import __phello__.foo
45-
except ImportError:
46-
pass
47-
else:
48-
self.fail("import __phello__.foo should have failed")
42+
try:
43+
import __phello__.foo
44+
except ImportError:
45+
pass
46+
else:
47+
self.fail("import __phello__.foo should have failed")
4948

5049
del sys.modules['__hello__']
5150
del sys.modules['__phello__']

0 commit comments

Comments
 (0)