mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-23 23:17:58 +00:00
don't use spec file when building bin
This commit is contained in:
parent
0af6a33b69
commit
a0ee22406b
|
@ -1,5 +0,0 @@
|
||||||
include frontend/base.haml
|
|
||||||
include frontend/style.css
|
|
||||||
include data/statements.sql
|
|
||||||
include data/swagger.yaml
|
|
||||||
include frontend/page/home.haml
|
|
56
relay.spec
56
relay.spec
|
@ -1,56 +0,0 @@
|
||||||
# -*- mode: python ; coding: utf-8 -*-
|
|
||||||
import importlib
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
block_cipher = None
|
|
||||||
aiohttp_swagger_path = Path(importlib.import_module('aiohttp_swagger').__file__).parent
|
|
||||||
|
|
||||||
|
|
||||||
a = Analysis(
|
|
||||||
['relay/__main__.py'],
|
|
||||||
pathex=[],
|
|
||||||
binaries=[],
|
|
||||||
datas=[
|
|
||||||
('relay/data', 'relay/data'),
|
|
||||||
('relay/frontend', 'relay/frontend'),
|
|
||||||
(aiohttp_swagger_path, 'aiohttp_swagger')
|
|
||||||
],
|
|
||||||
hiddenimports=[
|
|
||||||
'pg8000',
|
|
||||||
'sqlite3'
|
|
||||||
],
|
|
||||||
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,
|
|
||||||
a.binaries,
|
|
||||||
a.zipfiles,
|
|
||||||
a.datas,
|
|
||||||
[],
|
|
||||||
name='activityrelay',
|
|
||||||
icon=None,
|
|
||||||
debug=False,
|
|
||||||
bootloader_ignore_signals=False,
|
|
||||||
strip=False,
|
|
||||||
upx=True,
|
|
||||||
upx_exclude=[],
|
|
||||||
runtime_tmpdir=None,
|
|
||||||
console=True,
|
|
||||||
disable_windowed_traceback=False,
|
|
||||||
argv_emulation=False,
|
|
||||||
target_arch=None,
|
|
||||||
codesign_identity=None,
|
|
||||||
entitlements_file=None,
|
|
||||||
)
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
from relay.manage import main
|
from relay.manage import main
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
multiprocessing.freeze_support()
|
||||||
main()
|
main()
|
||||||
|
|
44
relay/dev.py
44
relay/dev.py
|
@ -1,10 +1,14 @@
|
||||||
import click
|
import click
|
||||||
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from tempfile import TemporaryDirectory
|
||||||
|
|
||||||
|
from . import __version__
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from watchdog.observers import Observer
|
from watchdog.observers import Observer
|
||||||
|
@ -46,24 +50,32 @@ def cli_lint(path):
|
||||||
subprocess.run([sys.executable, '-m', 'pylint', path], check = False)
|
subprocess.run([sys.executable, '-m', 'pylint', path], check = False)
|
||||||
|
|
||||||
|
|
||||||
@cli.command('manifest-gen')
|
|
||||||
def cli_manifest_install():
|
|
||||||
paths = []
|
|
||||||
|
|
||||||
for path in SCRIPT.rglob('*'):
|
|
||||||
if path.suffix.lower() in IGNORE_EXT or not path.is_file():
|
|
||||||
continue
|
|
||||||
|
|
||||||
paths.append(path)
|
|
||||||
|
|
||||||
with REPO.joinpath('MANIFEST.in').open('w', encoding = 'utf-8') as fd:
|
|
||||||
for path in paths:
|
|
||||||
fd.write(f'include {str(path.relative_to(SCRIPT))}\n')
|
|
||||||
|
|
||||||
|
|
||||||
@cli.command('build')
|
@cli.command('build')
|
||||||
def cli_build():
|
def cli_build():
|
||||||
cmd = [sys.executable, '-m', 'PyInstaller', 'relay.spec']
|
with TemporaryDirectory() as tmp:
|
||||||
|
arch = 'amd64' if sys.maxsize >= 2**32 else 'i386'
|
||||||
|
cmd = [
|
||||||
|
sys.executable, '-m', 'PyInstaller',
|
||||||
|
'--collect-data', 'relay',
|
||||||
|
'--collect-data', 'aiohttp_swagger',
|
||||||
|
'--hidden-import', 'pg8000',
|
||||||
|
'--hidden-import', 'sqlite3',
|
||||||
|
'--name', f'activityrelay-{__version__}-{platform.system().lower()}-{arch}',
|
||||||
|
'--workpath', tmp,
|
||||||
|
'--onefile', 'relay/__main__.py',
|
||||||
|
]
|
||||||
|
|
||||||
|
if platform.system() == 'Windows':
|
||||||
|
cmd.append('--console')
|
||||||
|
|
||||||
|
# putting the spec path on a different drive than the source dir breaks
|
||||||
|
if str(SCRIPT)[0] == tmp[0]:
|
||||||
|
cmd.extend(['--specpath', tmp])
|
||||||
|
|
||||||
|
else:
|
||||||
|
cmd.append('--strip')
|
||||||
|
cmd.extend(['--specpath', tmp])
|
||||||
|
|
||||||
subprocess.run(cmd, check = False)
|
subprocess.run(cmd, check = False)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue