Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dawg==0.8.0",
"dill==0.3.3",
"ics==0.6",
"jaeger_client==4.3.0",
"jaeger_client==4.6.0",
"Jinja2==2.10.1",
"keras==2.6.0",
"lazy",
Expand All @@ -53,7 +53,8 @@
"tensorflow==2.6.0",
"timeout-decorator==0.4.1",
"tqdm",
"Twisted"
"Twisted",
"pyinstaller=4.5",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"pyinstaller==4.5",

],
classifiers=[
"Programming Language :: Python :: 3.6",
Expand Down
3 changes: 2 additions & 1 deletion smart_kit/start_points/main_loop_http.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import typing
from collections import defaultdict
import sys
from wsgiref.simple_server import make_server

import scenarios.logging.logger_constants as log_const
Expand Down Expand Up @@ -153,4 +154,4 @@ def run(self):
def stop(self, signum, frame):
if self._server:
self._server.server_close()
exit(0)
sys.exit(0)
52 changes: 52 additions & 0 deletions smart_kit/template/app.pyinst.spec-tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- mode: python ; coding: utf-8 -*-
from smart_kit.utils.pyinst import SAF_data_files

datas = SAF_data_files

block_cipher = None

a = Analysis(
['manage.py'],
pathex=[os.path.abspath(SPECPATH)],
binaries=[],
datas=datas,
hiddenimports=['app_config'],
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='app',
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,
name='app',
strip=False,
upx=True,
upx_exclude=[],
)
3 changes: 2 additions & 1 deletion smart_kit/testing/local.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import cmd
import json
import sys
import os
import pprint
import typing
Expand Down Expand Up @@ -133,7 +134,7 @@ def do_show_scenarios(self, _input: str):
def preloop(self):
if len(self.available_scenarios) == 0:
print("Нет доступных сценариев.")
exit(0)
sys.exit(0)

self.environment.intent = self.available_scenarios[0]
print("Текущий сценарий: ", self.environment.intent)
Expand Down
27 changes: 27 additions & 0 deletions smart_kit/utils/pyinst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
import importlib


def data_files_for_packages(package_files: dict) -> list:
datas = []
for package, files in package_files.items():
proot = os.path.dirname(importlib.import_module(package).__file__) if package != '' else ''
datas.extend(
(
os.path.join(proot, f), # Source file pattern
os.path.join(package, os.path.dirname(f)) # Dest relative folder
) for f in files)
return datas


# This is not necessarily actual files but path patters
SAF_data_files = data_files_for_packages({
# Our app
'': ['static/.'],
# Our lib
'smart_kit': ['template/.'],
# 3rd-party libs
'ics': ['grammar/contentline.ebnf'],
'pymorphy2_dicts': ['data/*.json', 'data/*.array', 'data/*.dawg', 'data/*.intdawg'],
'rnnmorph': ['models/.'],
})