Skip to content

Commit

Permalink
Adapt to PyInstaller 6.x.x
Browse files Browse the repository at this point in the history
  • Loading branch information
vasole committed Oct 19, 2023
1 parent 5c45008 commit 92ae3c3
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion package/pyinstaller/pyinstaller.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import subprocess
import time
import logging

import PyInstaller
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
from PyInstaller.config import CONF

Expand Down Expand Up @@ -379,7 +380,13 @@ def cleanup_cache(topdir):

def replace_module(name):
dest = os.path.join(DISTDIR, script_n[0])
target = os.path.join(dest, os.path.basename(name))
if sys.platform.startswith("darwin") and PyInstaller.__version__ >= '6.0.0':
target = os.path.join(dest, "special_modules")
if not os.path.exists(target):
os.mkdir(target)
target = os.path.join(target, os.path.basename(name))
else:
target = os.path.join(dest, os.path.basename(name))
print("source = ", name)
print("dest = ", target)
if os.path.exists(target):
Expand Down Expand Up @@ -518,6 +525,18 @@ if sys.platform.startswith("darwin"):
shutil.rmtree(dest)
os.rename(source, dest)

# relocate the special modules
special_modules_dir = os.path.join(dest, "Contents", "MacOS", "special_modules")
if os.path.exists(special_modules_dir):
source = os.path.join(special_modules_dir, "*")
dest = os.path.join(dest, "Contents", "Frameworks")
cmd = "cp -Rf %s %s" % (source, dest)
print(cmd)
os.system(cmd)
source = source[:-1]
print("deleting %s" % source)
shutil.rmtree(source)

# Pack the application
destination = os.path.join(SPECPATH, "artifacts")
if os.path.exists(destination):
Expand Down

0 comments on commit 92ae3c3

Please sign in to comment.