Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cs/sc 3351 compile det exe linux #236

Merged
merged 6 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build_exe/linux/entrypoint-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -e

cd /src

pip install .
pip install commcare-export
Copy link
Contributor Author

@Charl1996 Charl1996 Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was an issue where the version is not set, so doing

pip install .

don't work; maybe something to look into in the future. Not sure how important it is right now since we're able to simply run pip install commcare-export (of course, running pip install commcare-export assumes the newest version is already pushed to pypi, which at this stage during the release process should be true).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need -e. And depending on the version of Python, you might need setuptools too:

pip install setuptools
pip install -e .

Disclaimer: I have not tested this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. I tried it, but alas...it didn't work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried various other ways which was also a dead end or just unfeasible in the long run...I don't think this issue is really blocking, just annoying (let me know if you disagree), so I'll create a ticket to address it.

pip install -r build_exe/requirements.txt

pyinstaller --clean -y --dist ./dist/linux --workpath /tmp *.spec
4 changes: 4 additions & 0 deletions build_exe/runtime_hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import os

# This env variable is used to alter bundled behaviour
os.environ['DET_EXECUTABLE'] = '1'
2 changes: 1 addition & 1 deletion commcare-export.spec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ a = Analysis(
'sqlalchemy.sql.default_comparator',
],
hookspath=[],
runtime_hooks=[],
runtime_hooks=['build_exe/runtime_hook.py'],
excludes=[],
)
pyz = PYZ(a.pure)
Expand Down
3 changes: 3 additions & 0 deletions commcare_export/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ def stored_version():


def git_version():
if os.environ.get('DET_EXECUTABLE'):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added so that running the binary will not output an error saying "git was not found". It's expected that folks using the binary might not have git installed so deducing the version from git as is done in this function is redundant for the bundled environment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be an issue for built versions of the tools since we write the version to a file and use that in preference to the git version.

return None

described_version_bytes = subprocess.Popen(
['git', 'describe'],
stdout=subprocess.PIPE
Expand Down
Loading