mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 01:44:03 +03:00
adca95a78d
Rather than a homebrewed approach, we can use `make` to figure out when it's necessary to regenerate our venv. This Makefile will regenerate _requirements.txt_ from _requirements-top-level.txt_ when the latter is changed. It will also regenerate the venv when _requirements.txt_ is changed (i.e. changes are pulled, or it's regenerated as described above). `make` uses file/directory timestamps to figure out what to rebuild. This is probably more reliable than expecting people to update a version number whenever they change a file. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5152 GitOrigin-RevId: 24b27d49bf6c4ba1d57ac38ea38ae278216c6d66
31 lines
1.2 KiB
Makefile
31 lines
1.2 KiB
Makefile
LEGACY_TESTS = server/tests-py
|
|
LEGACY_TESTS_VENV = $(LEGACY_TESTS)/.hasura-dev-python-venv
|
|
|
|
# cryptography v3.4.8 requires Rust dependencies by default, but we don't need them for our tests.
|
|
# The following environment variable disables this requirement.
|
|
# https://cryptography.io/en/3.4.8/faq.html#installing-cryptography-fails-with-error-can-not-find-rust-compiler
|
|
export CRYPTOGRAPHY_DONT_BUILD_RUST = 1
|
|
|
|
# Make's automatic variables such as `$<` and `$@` can be confusing.
|
|
# If you are unsure what they do, please consult the documentation.
|
|
# https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
|
|
|
|
$(LEGACY_TESTS_VENV): $(LEGACY_TESTS)/requirements.txt
|
|
rm -rf "$(LEGACY_TESTS_VENV)"
|
|
python3 -m venv "$(LEGACY_TESTS_VENV)"
|
|
source "$@/bin/activate"; \
|
|
pip3 install -r $<
|
|
touch $@
|
|
|
|
$(LEGACY_TESTS)/requirements.txt: $(LEGACY_TESTS)/requirements-top-level.txt
|
|
rm -rf "$(LEGACY_TESTS_VENV)"
|
|
python3 -m venv "$(LEGACY_TESTS_VENV)"
|
|
source "$(LEGACY_TESTS_VENV)/bin/activate"; \
|
|
pip3 install wheel; \
|
|
pip3 install -r $<; \
|
|
( \
|
|
echo '# Do not modify this file directly. Instead, modify $<.'; \
|
|
echo '# Then, run `make` in this directory to regenerate this file.'; \
|
|
pip3 freeze \
|
|
) > $@
|