Skip to content

Commit

Permalink
Adding ability to create a mepo binary that can uploaded as an artifa…
Browse files Browse the repository at this point in the history
…ct of a Github actions workflow. Pyinstaller requires that the top level script not use relative imports
  • Loading branch information
pchakraborty committed Apr 25, 2024
1 parent dab118d commit acdd32a
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
51 changes: 51 additions & 0 deletions mepo.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -*- mode: python ; coding: utf-8 -*-

import os
import glob

cmd_dir = os.path.join(SPECPATH, 'src/mepo/command')
cmd_list = [os.path.basename(x).split('.')[0] for x in glob.glob(os.path.join(cmd_dir, '*.py'))]
hidden_imports = [f'mepo.command.{x}' for x in cmd_list if '_' not in x] # exclude subcommands
print(f'hidden_imports: {hidden_imports}')

a = Analysis(
['src/mepo/__main__.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=hidden_imports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='mepo',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='mepo',
)
5 changes: 4 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
PyYAML>=5.4
pylint>=3.1.0
pylint
build
twine
pyinstaller
4 changes: 2 additions & 2 deletions src/mepo/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from importlib import import_module

from .cmdline.parser import MepoArgParser
from .utilities import mepoconfig
from mepo.cmdline.parser import MepoArgParser
from mepo.utilities import mepoconfig


def main():
Expand Down

0 comments on commit acdd32a

Please sign in to comment.