mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Fix Mac build, patch #1091 by Humberto Diogenes.
This commit is contained in:
parent
e4ac7504c9
commit
c76473d887
8 changed files with 18 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
||||||
# Accessor functions for control properties
|
# Accessor functions for control properties
|
||||||
|
|
||||||
from Controls import *
|
from Carbon.Controls import *
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
# These needn't go through this module, but are here for completeness
|
# These needn't go through this module, but are here for completeness
|
||||||
|
|
|
@ -17,7 +17,8 @@ import warnings
|
||||||
warnings.warn("the buildtools module is deprecated", DeprecationWarning, 2)
|
warnings.warn("the buildtools module is deprecated", DeprecationWarning, 2)
|
||||||
|
|
||||||
|
|
||||||
BuildError = "BuildError"
|
class BuildError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
# .pyc file (and 'PYC ' resource magic number)
|
# .pyc file (and 'PYC ' resource magic number)
|
||||||
MAGIC = imp.get_magic()
|
MAGIC = imp.get_magic()
|
||||||
|
|
|
@ -180,7 +180,7 @@ class BundleBuilder(Defaults):
|
||||||
assert len(self.type) == len(self.creator) == 4, \
|
assert len(self.type) == len(self.creator) == 4, \
|
||||||
"type and creator must be 4-byte strings."
|
"type and creator must be 4-byte strings."
|
||||||
pkginfo = pathjoin(contents, "PkgInfo")
|
pkginfo = pathjoin(contents, "PkgInfo")
|
||||||
f = open(pkginfo, "wb")
|
f = open(pkginfo, "w")
|
||||||
f.write(self.type + self.creator)
|
f.write(self.type + self.creator)
|
||||||
f.close()
|
f.close()
|
||||||
#
|
#
|
||||||
|
|
|
@ -76,15 +76,15 @@ def open_pathname(pathname, verbose=0):
|
||||||
AppleSingle file"""
|
AppleSingle file"""
|
||||||
try:
|
try:
|
||||||
refno = Res.FSpOpenResFile(pathname, 1)
|
refno = Res.FSpOpenResFile(pathname, 1)
|
||||||
except Res.Error as arg:
|
except Res.Error as error:
|
||||||
if arg[0] in (-37, -39):
|
if error.args[0] in (-37, -39):
|
||||||
# No resource fork. We may be on OSX, and this may be either
|
# No resource fork. We may be on OSX, and this may be either
|
||||||
# a data-fork based resource file or a AppleSingle file
|
# a data-fork based resource file or a AppleSingle file
|
||||||
# from the CVS repository.
|
# from the CVS repository.
|
||||||
try:
|
try:
|
||||||
refno = Res.FSOpenResourceFile(pathname, '', 1)
|
refno = Res.FSOpenResourceFile(pathname, '', 1)
|
||||||
except Res.Error as arg:
|
except Res.Error as error:
|
||||||
if arg[0] != -199:
|
if error.args[0] != -199:
|
||||||
# -199 is "bad resource map"
|
# -199 is "bad resource map"
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
|
@ -103,15 +103,15 @@ def resource_pathname(pathname, verbose=0):
|
||||||
try:
|
try:
|
||||||
refno = Res.FSpOpenResFile(pathname, 1)
|
refno = Res.FSpOpenResFile(pathname, 1)
|
||||||
Res.CloseResFile(refno)
|
Res.CloseResFile(refno)
|
||||||
except Res.Error as arg:
|
except Res.Error as error:
|
||||||
if arg[0] in (-37, -39):
|
if error.args[0] in (-37, -39):
|
||||||
# No resource fork. We may be on OSX, and this may be either
|
# No resource fork. We may be on OSX, and this may be either
|
||||||
# a data-fork based resource file or a AppleSingle file
|
# a data-fork based resource file or a AppleSingle file
|
||||||
# from the CVS repository.
|
# from the CVS repository.
|
||||||
try:
|
try:
|
||||||
refno = Res.FSOpenResourceFile(pathname, '', 1)
|
refno = Res.FSOpenResourceFile(pathname, '', 1)
|
||||||
except Res.Error as arg:
|
except Res.Error as error:
|
||||||
if arg[0] != -199:
|
if error.args[0] != -199:
|
||||||
# -199 is "bad resource map"
|
# -199 is "bad resource map"
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -55,5 +55,5 @@ IDLE.app: \
|
||||||
|
|
||||||
|
|
||||||
Info.plist: $(srcdir)/Info.plist.in
|
Info.plist: $(srcdir)/Info.plist.in
|
||||||
sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
|
sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
|
||||||
|
|
||||||
|
|
|
@ -78,4 +78,4 @@ Python\ Launcher: $(OBJECTS)
|
||||||
$(CC) $(LDFLAGS) -o "Python Launcher" $(OBJECTS) -framework AppKit -framework Carbon
|
$(CC) $(LDFLAGS) -o "Python Launcher" $(OBJECTS) -framework AppKit -framework Carbon
|
||||||
|
|
||||||
Info.plist: $(srcdir)/Info.plist.in
|
Info.plist: $(srcdir)/Info.plist.in
|
||||||
sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
|
sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
|
||||||
|
|
|
@ -80,11 +80,11 @@ def makescript(filename, compiler):
|
||||||
"""Create a wrapper script for a compiler"""
|
"""Create a wrapper script for a compiler"""
|
||||||
dirname = os.path.split(filename)[0]
|
dirname = os.path.split(filename)[0]
|
||||||
if not os.access(dirname, os.X_OK):
|
if not os.access(dirname, os.X_OK):
|
||||||
os.mkdir(dirname, 0755)
|
os.mkdir(dirname, 0o755)
|
||||||
fp = open(filename, 'w')
|
fp = open(filename, 'w')
|
||||||
fp.write(SCRIPT % compiler)
|
fp.write(SCRIPT % compiler)
|
||||||
fp.close()
|
fp.close()
|
||||||
os.chmod(filename, 0755)
|
os.chmod(filename, 0o755)
|
||||||
print('fixapplepython23: Created', filename)
|
print('fixapplepython23: Created', filename)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -12,7 +12,8 @@ import getopt
|
||||||
class NoArgsError(Exception):
|
class NoArgsError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def handler((verbose, force), dirname, fnames):
|
def handler(arg1, dirname, fnames):
|
||||||
|
verbose, force = arg1
|
||||||
for fn in fnames:
|
for fn in fnames:
|
||||||
if fn[-5:] == '.rsrc' and fn[-13:] != '.rsrc.df.rsrc':
|
if fn[-5:] == '.rsrc' and fn[-13:] != '.rsrc.df.rsrc':
|
||||||
if force:
|
if force:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue