Last active
November 18, 2022 14:24
-
-
Save shazow/3928595 to your computer and use it in GitHub Desktop.
Makefile which handles Python requirements.txt and *.egg-info (with optional virtualenv checking).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REQUIREMENTS_FILE=requirements.txt | |
REQUIREMENTS_OUT=requirements.txt.log | |
SETUP_OUT=*.egg-info | |
all: setup requirements | |
requirements: $(REQUIREMENTS_OUT) | |
$(REQUIREMENTS_OUT): $(REQUIREMENTS_FILE) | |
pip install -r $(REQUIREMENTS_FILE) | tee $(REQUIREMENTS_OUT) | |
setup: virtualenv $(SETUP_OUT) | |
$(SETUP_OUT): setup.py setup.cfg | |
python setup.py develop | |
touch $(SETUP_OUT) | |
clean: | |
find . -name "*.py[oc]" -delete | |
find . -name "__pycache__" -delete | |
rm $(REQUIREMENTS_OUT) | |
test: | |
nosetests | |
# Remove the virtualenv target and the `setup` dependency if you don't care about it. | |
virtualenv: | |
ifndef VIRTUAL_ENV | |
$(error No VIRTUAL_ENV defined) | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also https://gist.github.com/3759731 for the simple version.