Skip to content

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

Open
@laundmo

Description

@laundmo

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions