6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-05 12:57:52 +00:00
tutor/tutor.spec
Régis Behmo be1ff08917 Add all plugins (with data) to binary bundle
All existing plugins are added to the binary bundle, in their latest
version, so that users don't need to pip install tutor.

Also, the tutor MANIFEST.in file was removed to simplify the management
of package data.

Close #242.
2019-08-20 17:03:46 +02:00

56 lines
1.4 KiB
Python

# -*- mode: python -*-
import importlib
import os
import pkg_resources
block_cipher = None
datas = [("./tutor/templates", "./tutor/templates")]
hidden_imports = []
# Auto-discover plugins and include patches & templates folders
for entrypoint in pkg_resources.iter_entry_points("tutor.plugin.v0"):
plugin_name = entrypoint.name
plugin = entrypoint.load()
plugin_root = os.path.dirname(plugin.__file__)
plugin_root_module_name = os.path.basename(plugin_root)
hidden_imports.append(entrypoint.module_name)
for folder in ["patches", "templates"]:
path = os.path.join(plugin_root, folder)
if os.path.exists(path):
datas.append((path, os.path.join(plugin_root_module_name, folder)))
# The following was initially generated with:
# pyinstaller --onefile --name=tutor --add-data=./tutor/templates:./tutor/templates ./bin/main.py
a = Analysis(
["bin/main.py"],
pathex=[os.path.abspath(".")],
binaries=[],
datas=datas,
hiddenimports=hidden_imports,
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="tutor",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True,
)