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

Create assets/ zips using a setup.py script and custom build step so assets are included in direct git installs #933

Open
laundmo opened this issue Oct 18, 2024 · 0 comments

Comments

@laundmo
Copy link

laundmo commented Oct 18, 2024

Currently, the Makefile creates the .zip archives of the apps used by py4web setup

py4web/Makefile

Lines 13 to 16 in 4844577

py4web/assets/py4web.app.%.zip: apps/%
cd $< && find . | \
egrep "\.(py|html|css|js|png|jpg|gif|json|yaml|md|txt|mm|ico)$$" | \
zip -@ $(addprefix ../../, $@)

The above code obviously won't run when installing from git directly, which means the zip assets are missing.

pip install git+https://github.com/web2py/py4web

This is useful for testing forks or latest unreleased changes in a project original set up with the pypi version of py4web.

I propose instead writing a setup.py file which includes a custom build step, and using this to create the zip files required for full functionality.
This discussion comment shows how this would work with setuptools. Essentially, the setup.py can change the build command to a subclass which behaves the exact same as the normal setuptools build but calls a custom Command subclass first. This custom Command would then create the required assets using python code. This also means using zipfile module instead of zip command, to make sure it works the same on all OS (another downside of Makefiles).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant