Skip to content

Instantly share code, notes, and snippets.

@shazow
Last active November 18, 2022 14:24
Show Gist options
  • Save shazow/3928595 to your computer and use it in GitHub Desktop.
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).
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
@shazow
Copy link
Author

shazow commented Oct 21, 2012

See also https://gist.github.com/3759731 for the simple version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment