-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #479 from SPF-OST/command-line
Add simple command line interface to `pytrnsys`.
- Loading branch information
Showing
15 changed files
with
230 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
from PyInstaller.utils.hooks import collect_data_files, collect_submodules | ||
|
||
datas = [] | ||
datas += collect_data_files("pytrnsys") | ||
datas += collect_data_files("trnsysGUI") | ||
|
||
block_cipher = None | ||
|
||
a = Analysis( | ||
["runPytrnsys.py"], | ||
pathex=[], | ||
binaries=[], | ||
datas=datas, | ||
hiddenimports=["pytrnsys", *collect_submodules("pytrnsys")], | ||
hookspath=[], | ||
hooksconfig={"matplotlib": {"backends": ["AGG", "PDF"]}}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False, | ||
) | ||
pyz = PYZ(a.pure) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
[], | ||
name="pytrnsys", | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=True, | ||
hide_console="hide-early", | ||
disable_windowed_traceback=True, | ||
argv_emulation=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None, | ||
) | ||
|
||
ga = Analysis( | ||
["runPytrnsysGui.py"], | ||
pathex=[], | ||
binaries=[], | ||
datas=datas, | ||
hiddenimports=[], | ||
hookspath=[], | ||
hooksconfig={"matplotlib": {"backends": ["AGG", "PDF"]}}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False, | ||
) | ||
|
||
gpyz = PYZ(ga.pure) | ||
|
||
gexe = EXE( | ||
gpyz, | ||
ga.scripts, | ||
[], | ||
name="pytrnsys-gui", | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=False, | ||
disable_windowed_traceback=False, | ||
argv_emulation=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None, | ||
) | ||
|
||
coll = COLLECT( | ||
exe, | ||
a.binaries, | ||
a.datas, | ||
gexe, | ||
ga.binaries, | ||
ga.datas, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
name="pytrnsys", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pathlib as _pl | ||
|
||
import typer as _typer | ||
import typing_extensions as _te | ||
|
||
_ReadableFilePath = _te.Annotated[_pl.Path, _typer.Argument(readable=True, dir_okay=False)] | ||
|
||
|
||
def main(python_script_path: _ReadableFilePath) -> None: # /NOSONAR # pylint: disable=invalid-name | ||
_runFile(python_script_path) | ||
|
||
|
||
def _runFile(pythonScriptPath: _pl.Path) -> None: | ||
sourceCode = pythonScriptPath.read_text() | ||
compiledCode = compile(sourceCode, pythonScriptPath, mode="exec") | ||
exec(compiledCode) # pylint: disable=exec-used | ||
|
||
|
||
_typer.run(main) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,5 @@ lark | |
appdirs | ||
Jinja2 | ||
qtconsole | ||
typer | ||
typing_extensions |
Oops, something went wrong.