Skip to content

Commit

Permalink
working solution
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptingosx committed Feb 3, 2022
1 parent 99f96df commit 2927f67
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions quickpkg
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/usr/local/bin/managed_python3

This comment was marked as resolved.

Copy link
@andreped

andreped Apr 21, 2022

Running quickpkg on a hosted runner (GitHib Action CI), this results in an Error (observed on macOS-15):

Cloning into 'quickpkg'...
/Users/runner/work/_temp/5fb59a5c-97d8-4069-bf10-0169e67a8e01.sh: quickpkg/quickpkg: /usr/local/bin/managed_python3: bad interpreter: No such file or directory
Error: Process completed with exit code 126.

This comment was marked as resolved.

Copy link
@scriptingosx

scriptingosx Apr 21, 2022

Author Owner

from the ReadMe, under 'Dependencies':

This script is built and tested with the MacAdmins "Managed Python."

This is the shebang for the MacAdmins Managed Python. You either need to install this python or change the shebang to whichever python you provide. Note that this script uses non-standard modules, such as PyObjC, so you will need to provide those, as well.

This comment was marked as resolved.

Copy link
@andreped

andreped Apr 21, 2022

Oh! I was not aware of that. That explains the issues I observed when tested my software on the new macOS 11.x versions... I will make an Issue, such that we can track this issue better there. I had some questions on how to solve this, if that is OK with you.

This comment was marked as resolved.

Copy link
@scriptingosx

scriptingosx Apr 21, 2022

Author Owner

Issues are definitely better than comments, but if you try to use this script with any other python, then you will be pretty much on your own...


import argparse
import string
import os
import subprocess
import tempfile
import shutil
import stat
import plistlib

#
# quickpkg
Expand Down Expand Up @@ -142,7 +145,7 @@ def finditemswithextension(dirpath, item_extension):
if os.path.exists(dirpath):
for x in os.listdir(dirpath):
(item_basename, item_extension) = os.path.splitext(x)
item_extension = string.lstrip(item_extension, '.')
item_extension = item_extension.lstrip('.')
if item_extension == 'app':
foundapps.append(os.path.join(dirpath, x))
else:
Expand All @@ -157,7 +160,8 @@ def appNameAndVersion(app_path):
print("Application at path %s does not have Info.plist" % app_path)
# TODO: cleanup volumes here
cleanup_and_exit(1)
info_plist = readPlist(info_path)
with open(info_path, 'rb') as info_file:
info_plist = plistlib.load(info_file)
app_name = info_plist.get("CFBundleName")
if app_name is None:
app_name = info_plist.get("CFBundleDisplayName")
Expand Down Expand Up @@ -234,15 +238,15 @@ if __name__ == "__main__":
args = parser.parse_args()

# remove trailing '/' from path
item_path = string.rstrip(args.item_path, '/')
item_path = args.item_path.rstrip('/')

if item_path.startswith('~'):
item_path = os.path.expanduser(item_path)
item_path = os.path.abspath(item_path)

# get file extension
(item_basename, item_extension) = os.path.splitext(item_path)
item_extension = string.lstrip(item_extension, '.')
item_extension = item_extension.lstrip('.')

# is extension supported
if item_extension not in supported_extensions:
Expand Down Expand Up @@ -358,12 +362,14 @@ if __name__ == "__main__":

if not args.relocatable:
# read and change component plist
components = readPlist(component_plist)
with open(component_plist, 'rb') as component_file:
components = plistlib.load(component_file)
# component plist is an array of components
for bundle in components:
if "BundleIsRelocatable" in list(bundle.keys()):
bundle["BundleIsRelocatable"] = False
writePlist(components, component_plist)
with open(component_plist, 'wb') as component_file:
plistlib.dump(components, component_file, fmt=plistlib.FMT_XML)

pkg_name = "{name}-{version}.pkg"
if args.output:
Expand Down

0 comments on commit 2927f67

Please sign in to comment.