Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2927f67

Browse files
working solution
1 parent 99f96df commit 2927f67

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

‎quickpkg‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
#!/usr/local/bin/managed_python3
2+
13
import argparse
24
import string
35
import os
46
import subprocess
57
import tempfile
68
import shutil
79
import stat
10+
import plistlib
811

912
#
1013
# quickpkg
@@ -142,7 +145,7 @@ def finditemswithextension(dirpath, item_extension):
142145
if os.path.exists(dirpath):
143146
for x in os.listdir(dirpath):
144147
(item_basename, item_extension) = os.path.splitext(x)
145-
item_extension = string.lstrip(item_extension, '.')
148+
item_extension = item_extension.lstrip('.')
146149
if item_extension == 'app':
147150
foundapps.append(os.path.join(dirpath, x))
148151
else:
@@ -157,7 +160,8 @@ def appNameAndVersion(app_path):
157160
print("Application at path %s does not have Info.plist" % app_path)
158161
# TODO: cleanup volumes here
159162
cleanup_and_exit(1)
160-
info_plist = readPlist(info_path)
163+
with open(info_path, 'rb') as info_file:
164+
info_plist = plistlib.load(info_file)
161165
app_name = info_plist.get("CFBundleName")
162166
if app_name is None:
163167
app_name = info_plist.get("CFBundleDisplayName")
@@ -234,15 +238,15 @@ if __name__ == "__main__":
234238
args = parser.parse_args()
235239

236240
# remove trailing '/' from path
237-
item_path = string.rstrip(args.item_path, '/')
241+
item_path = args.item_path.rstrip('/')
238242

239243
if item_path.startswith('~'):
240244
item_path = os.path.expanduser(item_path)
241245
item_path = os.path.abspath(item_path)
242246

243247
# get file extension
244248
(item_basename, item_extension) = os.path.splitext(item_path)
245-
item_extension = string.lstrip(item_extension, '.')
249+
item_extension = item_extension.lstrip('.')
246250

247251
# is extension supported
248252
if item_extension not in supported_extensions:
@@ -358,12 +362,14 @@ if __name__ == "__main__":
358362

359363
if not args.relocatable:
360364
# read and change component plist
361-
components = readPlist(component_plist)
365+
with open(component_plist, 'rb') as component_file:
366+
components = plistlib.load(component_file)
362367
# component plist is an array of components
363368
for bundle in components:
364369
if "BundleIsRelocatable" in list(bundle.keys()):
365370
bundle["BundleIsRelocatable"] = False
366-
writePlist(components, component_plist)
371+
with open(component_plist, 'wb') as component_file:
372+
plistlib.dump(components, component_file, fmt=plistlib.FMT_XML)
367373

368374
pkg_name = "{name}-{version}.pkg"
369375
if args.output:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /