Skip to content

Commit

Permalink
Fix pyinstaller installation
Browse files Browse the repository at this point in the history
  • Loading branch information
Vuizur committed Mar 13, 2022
1 parent f36085f commit 3cf8edc
Show file tree
Hide file tree
Showing 29 changed files with 632,366 additions and 1 deletion.
6 changes: 5 additions & 1 deletion edit_epub.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from zipfile import ZipFile
from bs4 import BeautifulSoup
from shutil import make_archive, rmtree
from pathlib import Path

def is_unimportant(token):
return token.pos_ == "PUNCT" or token.pos_ == "SYM" or token.pos_ == "X" or token.pos_ == "SPACE" or token.text == "-"
Expand Down Expand Up @@ -85,8 +86,11 @@ def convert_book(input_file_path: str, output_file_path: str):
ANALYZE_GRAMMAR = True

extract_dir = "extract_dir_9580"
bundle_dir = Path(__file__).parent.absolute()
#nlp = load("ru_core_news_sm")
nlp = load(bundle_dir / "ru_core_news_sm-3.1.0")

nlp = load("ru_core_news_sm")

if not ANALYZE_GRAMMAR:
nlp.disable_pipes("tok2vec", "morphologizer", "parser", "attribute_ruler", "lemmatizer", "ner")

Expand Down
5 changes: 5 additions & 0 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
from PyQt6 import QtGui
from MainWindow import Ui_MainWindow
from edit_epub import convert_book
import os
import pathlib

if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
os.environ["PYMORPHY2_DICT_PATH"] = str(pathlib.Path(sys._MEIPASS).joinpath('pymorphy2_dicts_ru/data'))

def is_tool(name):
"""Check whether `name` is on PATH and marked as executable."""
Expand Down
47 changes: 47 additions & 0 deletions gui.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- mode: python ; coding: utf-8 -*-


block_cipher = None

# pymorph data
import pymorphy2_dicts_ru
pymorph_data = pymorphy2_dicts_ru.get_path()

a = Analysis(['gui.py'],
pathex=['C:\\Users\\hanne\\Documents\\Programme\\add-stress-to-epub\\venv\\Lib\\site-packages'],
binaries=[],
datas=[(pymorph_data, 'pymorphy2_dicts_ru/data')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)

exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='gui',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='gui')
2 changes: 2 additions & 0 deletions hook-gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files("ru_core_news_sm-3.1.0")
19 changes: 19 additions & 0 deletions ru_core_news_sm-3.1.0/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright 2021 ExplosionAI GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 3cf8edc

Please sign in to comment.