pyinstaller funzionante
This commit is contained in:
parent
d8c8520950
commit
5a40d24798
4 changed files with 72 additions and 8 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,3 +3,5 @@
|
||||||
*~
|
*~
|
||||||
build/
|
build/
|
||||||
dist/
|
dist/
|
||||||
|
rec/
|
||||||
|
*.egg-info/
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
from argparse import ArgumentParser, Action
|
from argparse import ArgumentParser, Action
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
@ -74,6 +75,9 @@ def common_pre():
|
||||||
logger.warn("Configuration file '%s' does not exist; skipping" % path)
|
logger.warn("Configuration file '%s' does not exist; skipping" % path)
|
||||||
continue
|
continue
|
||||||
configs.append(path)
|
configs.append(path)
|
||||||
|
if getattr(sys, 'frozen', False):
|
||||||
|
os.chdir(sys._MEIPASS)
|
||||||
|
else:
|
||||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||||
for conf in configs:
|
for conf in configs:
|
||||||
get_config().from_pyfile(conf)
|
get_config().from_pyfile(conf)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
|
||||||
HOST = "localhost"
|
HOST = "localhost"
|
||||||
PORT = "8000"
|
PORT = "8000"
|
||||||
|
@ -28,8 +30,13 @@ TAG_EXTRA = {}
|
||||||
# LICENSE URI is special because date need to be added
|
# LICENSE URI is special because date need to be added
|
||||||
TAG_LICENSE_URI = None
|
TAG_LICENSE_URI = None
|
||||||
|
|
||||||
|
# defaults
|
||||||
STATIC_FILES = "static/"
|
STATIC_FILES = "static/"
|
||||||
STATIC_PAGES = "pages/"
|
STATIC_PAGES = "pages/"
|
||||||
|
if getattr(sys, 'frozen', False): # pyinstaller
|
||||||
|
STATIC_FILES = os.path.join(sys._MEIPASS, STATIC_FILES)
|
||||||
|
STATIC_PAGES = os.path.join(sys._MEIPASS, STATIC_PAGES)
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
from pkg_resources import resource_filename, resource_isdir
|
from pkg_resources import resource_filename, resource_isdir
|
||||||
|
|
||||||
|
|
51
techrec.spec
Normal file
51
techrec.spec
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
block_cipher = None
|
||||||
|
|
||||||
|
|
||||||
|
a = Analysis(
|
||||||
|
["server/cli.py"],
|
||||||
|
pathex=["."],
|
||||||
|
binaries=[],
|
||||||
|
datas=[
|
||||||
|
("server/default_config.py", "."),
|
||||||
|
("server/pages/", "pages/"),
|
||||||
|
("server/static/", "static/"),
|
||||||
|
],
|
||||||
|
hiddenimports=[
|
||||||
|
"techrec.cli",
|
||||||
|
"techrec.config_manager",
|
||||||
|
"techrec.db",
|
||||||
|
"techrec.default_config",
|
||||||
|
"techrec.forge",
|
||||||
|
"techrec.maint",
|
||||||
|
"techrec.processqueue",
|
||||||
|
"techrec.server",
|
||||||
|
"techrec.test_forge",
|
||||||
|
],
|
||||||
|
hookspath=[],
|
||||||
|
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,
|
||||||
|
a.binaries,
|
||||||
|
a.zipfiles,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name="techrec",
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=True,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=True,
|
||||||
|
)
|
||||||
|
# vim: set ft=python:
|
Loading…
Reference in a new issue