mac-arm build bug
ikhz opened this issue · 1 comments
ikhz commented
Traceback (most recent call last):
File "/venv/lib/python3.9/site-packages/pyupdater/cli/__init__.py", line 79, in main
_real_main(args)
File "/venv/lib/python3.9/site-packages/pyupdater/cli/__init__.py", line 55, in _real_main
dispatch_command(args, pyi_args)
File "/venv/lib/python3.9/site-packages/pyupdater/cli/__init__.py", line 68, in dispatch_command
cmd(args, pyi_args)
File "/venv/lib/python3.9/site-packages/pyupdater/cli/commands.py", line 101, in _cmd_build
builder.build()
File "venv/lib/python3.9/site-packages/pyupdater/utils/builder.py", line 89, in build
self._archive(temp_name)
File "/venv/lib/python3.9/site-packages/pyupdater/utils/builder.py", line 234, in _archive
Builder._mac_binary_rename(app_name, self.app_name)
File "/venv/lib/python3.9/site-packages/pyupdater/utils/builder.py", line 210, in _mac_binary_rename
os.rename("mac", app_name)
FileNotFoundError: [Errno 2] No such file or directory: 'mac' -> ''
# Updates name of binary from mac to applications name
@staticmethod
def _mac_binary_rename(temp_name, app_name):
bin_dir = os.path.join(temp_name, "Contents", "MacOS")
plist = os.path.join(temp_name, "Contents", "Info.plist")
with ChDir(bin_dir):
os.rename("mac", app_name)
its trying to rename 'mac' binary but its named 'mac-arm'
ikhz commented
fix
# Updates name of binary from mac to applications name
@staticmethod
def _mac_binary_rename(temp_name, app_name):
bin_dir = os.path.join(temp_name, "Contents", "MacOS")
plist = os.path.join(temp_name, "Contents", "Info.plist")
bin_name = 'mac' if not os.uname().machine == 'arm64' else 'mac-arm'
with ChDir(bin_dir):
os.rename(bin_name, app_name)
# We also have to update to ensure app launches correctly
with io.open(plist, "r", encoding="utf-8") as f:
plist_data = f.readlines()
new_plist_data = []
for d in plist_data:
if bin_name in d:
new_plist_data.append(d.replace(bin_name, app_name))
else:
new_plist_data.append(d)
with io.open(plist, "w", encoding="utf-8") as f:
for d in new_plist_data:
f.write(d)