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

Skip to content

Commit 9aa8fd0

Browse files
committed
Handle .icns and .plist files for applets.
Also, for now (until we learn to parse .plist files) we make a special case for the IDE, setting the creator to "Pide".
1 parent 96f9e08 commit 9aa8fd0

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

Mac/Lib/buildtools.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,18 @@ def process_common_macho(template, progress, code, rsrcname, destname, is_update
268268
if shortname[-4:] == '.app':
269269
# Strip the .app suffix
270270
shortname = shortname[:-4]
271-
plistname = shortname + '.plist'
271+
# And deduce the .plist and .icns names
272+
plistname = None
273+
icnsname = None
274+
if rsrcname and rsrcname[-5:] == '.rsrc':
275+
tmp = rsrcname[:-5]
276+
plistname = tmp + '.plist'
277+
if os.path.exists(plistname):
278+
icnsname = tmp + '.icns'
279+
if not os.path.exists(icnsname):
280+
icnsname = None
281+
else:
282+
plistname = None
272283
# Start with copying the .app framework
273284
if not is_update:
274285
exceptlist = ["Contents/Info.plist",
@@ -277,11 +288,18 @@ def process_common_macho(template, progress, code, rsrcname, destname, is_update
277288
]
278289
copyapptree(template, destname, exceptlist)
279290
# Now either use the .plist file or the default
280-
if plistname and os.path.exists(plistname):
291+
if plistname:
281292
shutil.copy2(plistname, os.path.join(destname, 'Contents/Info.plist'))
282-
# XXXX Wrong. This should be parsed from plist file
283-
# icnsname = 'PythonApplet.icns'
284-
ownertype = 'PytA'
293+
if icnsname:
294+
icnsdest = os.path.split(icnsname)[1]
295+
icnsdest = os.path.join(destname,
296+
os.path.join('Contents/Resources', icnsdest))
297+
shutil.copy2(icnsname, icnsdest)
298+
# XXXX Wrong. This should be parsed from plist file. Also a big hack:-)
299+
if shortname == 'PythonIDE':
300+
ownertype = 'Pide'
301+
else:
302+
ownertype = 'PytA'
285303
# XXXX Should copy .icns file
286304
else:
287305
plistname = os.path.join(template, 'Contents/Resources/Applet-Info.plist')

0 commit comments

Comments
 (0)