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 Aug 6, 2023
1 parent 2e9e671 commit 9d5f815
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
17 changes: 8 additions & 9 deletions utils/linux_compile_py_from_src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,16 @@

# Install build dependencies for Python
# Reference: https://devguide.python.org/getting-started/setup-building/#linux
if ! grep -Fxq "deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main" "/etc/apt/sources.list"; then
sudo sh -c "echo 'deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main' >> /etc/apt/sources.list"
if ! grep -Fxq "deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic main" "/etc/apt/sources.list"; then
sudo sh -c "echo 'deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic main' >> /etc/apt/sources.list"
fi

sudo apt-get update
sudo apt-get -y build-dep python3
# libgdbm-compat-dev is not available on Ubuntu 16.04
sudo apt-get -y install build-essential gdb lcov pkg-config libbz2-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev
sudo apt-get -y install build-essential gdb lcov pkg-config libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev

# Compile Python from source
PY_VER=3.9.16
PY_VER=3.10.12
PY_PACKAGE="Python-$PY_VER.tgz"
PY_FOLDER="Python-$PY_VER"

Expand All @@ -44,17 +43,17 @@ fi
cd $PY_FOLDER
# PyInstaller requires "--enable-shared"
./configure --enable-optimizations --with-lto --enable-shared
make -j -s
make -s -j
sudo make altinstall
cd ..

# Fix error while loading shared libraries
sudo ldconfig

# Install 3rd-party libraries
python3.9 -m pip install --upgrade pip setuptools
pip3.9 install -r requirements_dev.txt
pip3.9 cache purge
python3.10 -m pip install --upgrade pip setuptools
pip3.10 install -r requirements_dev.txt
pip3.10 cache purge

# Fix libxcb-xinerama.so
sudo apt-get install libxcb-xinerama0
Expand Down
2 changes: 1 addition & 1 deletion utils/wl_downloader_spacy_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@
elif platform.system() == 'Darwin':
subprocess.run(['pip3', 'install', model_url], check = True)
elif platform.system() == 'Linux':
subprocess.run(['pip3.9', 'install', model_url], check = True)
subprocess.run(['pip3.10', 'install', model_url], check = True)
else:
print(f"The latest version of spaCy's {lang_text} model ({model_ver}) has already been installed!")
4 changes: 2 additions & 2 deletions utils/wl_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def print_with_elapsed_time(message):
elif is_macos:
subprocess.run(['python3', '-m', 'PyInstaller', '--clean', '--noconfirm', 'wl_packaging.spec'], check = True)
elif is_linux:
subprocess.run(['python3.9', '-m', 'PyInstaller', '--clean', '--noconfirm', 'wl_packaging.spec'], check = True)
subprocess.run(['python3.10', '-m', 'PyInstaller', '--clean', '--noconfirm', 'wl_packaging.spec'], check = True)

# Create folders
if is_windows or is_linux:
Expand All @@ -64,7 +64,7 @@ def print_with_elapsed_time(message):
subprocess.run(['chmod', '+x', 'dist/Wordless/Wordless.sh'], check = True)

# Generate .desktop file
subprocess.run(['python3.9', '-m', 'PyInstaller', '--clean', '--noconfirm', 'linux_create_shortcut.py'], check = True)
subprocess.run(['python3.10', '-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 @@ -123,6 +123,9 @@ hiddenimports = [
# Charset Normalizer
'charset_normalizer.md__mypyc',

# khmer-nltk
'sklearn_crfsuite',

# pymorphy3
'pymorphy3_dicts_ru',
'pymorphy3_dicts_uk',
Expand Down
2 changes: 1 addition & 1 deletion wordless/wl_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def restart(self, save_settings = True):
elif is_macos:
subprocess.Popen(['python3', '-m', 'wordless.wl_main'])
elif is_linux:
subprocess.Popen(['python3.9', '-m', 'wordless.wl_main'])
subprocess.Popen(['python3.10', '-m', 'wordless.wl_main'])

sys.exit(0)

Expand Down

0 comments on commit 9d5f815

Please sign in to comment.