Skip to content

Commit

Permalink
Releases: Update packaging script
Browse files Browse the repository at this point in the history
  • Loading branch information
BLKSerene committed Mar 20, 2023
1 parent b0d46ca commit 45e100c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion utils/macos_pyinstaller_recompile_bootloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import requests

PYINSTALLER_VER = '5.7.0'
PYINSTALLER_VER = '5.9.0'

# Fetch codes
print(f'Downloading PyInstaller {PYINSTALLER_VER}... ', end = '')
Expand Down
12 changes: 8 additions & 4 deletions utils/wl_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,21 @@ def print_with_elapsed_time(message):
os.makedirs('dist/Wordless.app/Contents/Macos/imports')
os.makedirs('dist/Wordless.app/Contents/Macos/exports')

# Running on Linux requires sudo
if is_linux:
# Fix GLib-GIO-ERROR, Gtk-WARNING, and many other errors/warnings on Linux
# See: https://github.com/pyinstaller/pyinstaller/issues/7506
os.remove('dist/Wordless/libgtk-3.so.0')
os.remove('dist/Wordless/libstdc++.so.6')

# Generate shell file
with open('dist/Wordless/Wordless.sh', 'w', encoding = 'utf_8') as f:
f.write('#!/bin/bash\n')
# Fix libGL error on Linux
f.write('sudo LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./Wordless\n')
f.write('./Wordless\n')

# Allow executing file as program
subprocess.run(['chmod', '+x', 'dist/Wordless/Wordless.sh'], check = True)

# Create .desktop file
# Generate .desktop file
subprocess.run(['python3.9', '-m', 'PyInstaller', '--clean', '--noconfirm', 'linux_create_shortcut.py'], check = True)
shutil.copyfile('dist/linux_create_shortcut/linux_create_shortcut', 'dist/Wordless/Wordless - Create Shortcut')
subprocess.run(['chmod', '+x', 'dist/Wordless/Wordless - Create Shortcut'], check = True)
Expand Down
3 changes: 3 additions & 0 deletions utils/wl_packaging.spec
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ datas.extend(PyInstaller.utils.hooks.collect_data_files('lingua'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('opencc'))
# python-crfsuite
datas.extend(PyInstaller.utils.hooks.collect_data_files('pycrfsuite', include_py_files = True))
# python-mecab-ko
datas.extend(PyInstaller.utils.hooks.collect_data_files('mecab'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('mecab_ko_dic'))
# pymorphy3
datas.extend(PyInstaller.utils.hooks.copy_metadata('pymorphy3_dicts_ru'))
datas.extend(PyInstaller.utils.hooks.copy_metadata('pymorphy3_dicts_uk'))
Expand Down

0 comments on commit 45e100c

Please sign in to comment.