Skip to content

Commit

Permalink
renaming plain-text file "VERISON" to "VERSION.py" and explicitly imp…
Browse files Browse the repository at this point in the history
…orting in `__version__.py` so pyinstaller will automatically detect VERSION as a dependency. (#37)

The original method using a plain text file results in a run-time error when pyinstaller is used to generate a single file executable with the following line:

`pyinstaller -F -w <hart_protocol_user_script.py>`

where `<hart_protocol_user_script.py>` is a script that imports `hart_protocol`

pyinstaller was not detecting file *VERSION* as a required dependency and it wasn't being included in the executable image.  There may also be another method of resolving this issue on the pyinstaller side by using --add-data or possibly a hook file (my first attempts were not successful).

Co-authored-by: Brian Amos <amos@sensornetworksinc.com>
  • Loading branch information
brian-amos-embedded and Brian Amos authored Jun 2, 2023
1 parent df519a0 commit cf0f78b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion hart_protocol/VERSION

This file was deleted.

1 change: 1 addition & 0 deletions hart_protocol/VERSION.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "2023.5.0"
6 changes: 1 addition & 5 deletions hart_protocol/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@

import pathlib
import subprocess
from .VERSION import __version__


here = pathlib.Path(__file__).resolve().parent


__all__ = ["__version__", "__branch__"]


# read from VERSION file
with open(str(here / "VERSION")) as f:
__version__ = f.read().strip()

try:
__branch__ = (
subprocess.run(["git", "branch", "--show-current"], capture_output=True, cwd=here)
Expand Down

0 comments on commit cf0f78b

Please sign in to comment.