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

Skip to content

Commit fddef43

Browse files
committed
Got module to work under Carbon. Also disabled a few more bits of cfm68k support.
1 parent 26d42df commit fddef43

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

Mac/Tools/macfreeze/macgen_bin.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import types
77
import macfs
88
from MACFS import *
9+
import MacOS
910
import Res
1011
import py_resource
1112
import cfmfile
@@ -96,7 +97,9 @@ def findfragments(module_dict, architecture):
9697
continue
9798
path = resolvealiasfile(module.__file__)
9899
dir, filename = os.path.split(path)
99-
ppcfile, cfm68kfile = makefilenames(filename)
100+
## ppcfile, cfm68kfile = makefilenames(filename)
101+
ppcfile = filename
102+
cfm68kfile = "dummy.cfm68k.slb"
100103

101104
# ppc stuff
102105
ppcpath = os.path.join(dir, ppcfile)
@@ -158,15 +161,15 @@ def Pstring(str):
158161
raise TypeError, "Str255 must be at most 255 chars long"
159162
return chr(len(str)) + str
160163

161-
def makefilenames(name):
162-
lname = string.lower(name)
163-
pos = string.find(lname, ".ppc.")
164-
if pos > 0:
165-
return name, name[:pos] + '.CFM68K.' + name[pos+5:]
166-
pos = string.find(lname, ".cfm68k.")
167-
if pos > 0:
168-
return name[:pos] + '.ppc.' + name[pos+8:], name
169-
raise ValueError, "can't make ppc/cfm68k filenames"
164+
##def makefilenames(name):
165+
## lname = string.lower(name)
166+
## pos = string.find(lname, ".ppc.")
167+
## if pos > 0:
168+
## return name, name[:pos] + '.CFM68K.' + name[pos+5:]
169+
## pos = string.find(lname, ".cfm68k.")
170+
## if pos > 0:
171+
## return name[:pos] + '.ppc.' + name[pos+8:], name
172+
## raise ValueError, "can't make ppc/cfm68k filenames"
170173

171174
def copyres(input, output, *args, **kwargs):
172175
openedin = openedout = 0
@@ -187,10 +190,16 @@ def copyres(input, output, *args, **kwargs):
187190
def findpythoncore():
188191
"""find the PythonCore shared library, possibly asking the user if we can't find it"""
189192

190-
vRefNum, dirID = macfs.FindFolder(kOnSystemDisk, kExtensionFolderType, 0)
193+
vRefNum, dirID = macfs.FindFolder(kOnSystemDisk, kSharedLibrariesFolderType, 0)
191194
extpath = macfs.FSSpec((vRefNum, dirID, "")).as_pathname()
192195
version = string.split(sys.version)[0]
193-
corepath = os.path.join(extpath, "PythonCore " + version)
196+
if MacOS.runtimemodel == 'carbon':
197+
corename = "PythonCoreCarbon " + version
198+
elif MacOS.runtimemodel == 'ppc':
199+
corename = "PythonCore " + version
200+
else:
201+
raise "Unknown MacOS.runtimemodel", MacOS.runtimemodel
202+
corepath = os.path.join(extpath, corename)
194203
if not os.path.exists(corepath):
195204
fss, ok = macfs.PromptGetFile("Please locate PythonCore:", "shlb")
196205
if not ok:

0 commit comments

Comments
 (0)