This repository has been archived by the owner on Jul 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
77 lines (61 loc) · 2.25 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
PYTHON ?= python3
export VIRTUAL_ENV := $(realpath .)/venv
export PATH := $(VIRTUAL_ENV)/bin:$(PATH)
unexport WORKON_HOME PIP_RESPECT_VIRTUALENV PIP_VIRTUALENV_BASE
# Configure THIS:
PROJECT_FOLDER=./djangoevents
PROJECT_NAME=djangoevents
help:
@echo
@echo 'Make targets:'
@echo ' make install'
@echo ' -> make install.virtualenv'
@echo ' -> make install.runtime'
@echo ' -> make install.package'
@echo ' make clean'
@echo ' make test'
@echo ' make tdd'
# Top-level phony targets
_install__runtime = $(VIRTUAL_ENV)/bin/django-admin.py
_install__virtualenv = $(VIRTUAL_ENV)/bin/pip
_install__package = ./djangoevents.egg-info
# make should not confuse these commands with files
.PHONY: install install.virtualenv install.runtime install.package
.PHONY: clean
clean:
rm -rf $(VIRTUAL_ENV)
find . -type f -name '*.pyc' -print0 | xargs -0 rm -f
find . -type d -name '__pycache__' -print0 | xargs -0 rm -rf
rm -rf $(PROJECT_FOLDER).egg-info
# Installation
install: install.virtualenv install.runtime install.package
install.runtime: $(_install__runtime)
install.virtualenv: $(_install__virtualenv)
install.package: $(_install__package)
$(_install__runtime):
$(_install__virtualenv) install -r requirements.txt
touch $@
$(_install__package):
@echo '================================================================'
@echo 'About to install $(PROJECT_NAME) in development mode'
@echo 'Package would be linked within virtualenv so there is no need'
@echo 'to reinstall it every time source code is changed'
@echo '================================================================'
$(VIRTUAL_ENV)/bin/python setup.py develop
touch $@
$(_install__virtualenv):
$(PYTHON) -mvenv $(VIRTUAL_ENV)
@echo '================================================================'
@echo 'You can now enable virtualenv with:'
@echo ' source $(VIRTUAL_ENV)/bin/activate'
@echo '================================================================'
$(VIRTUAL_ENV)/bin/pip install -U pip
touch $@
test:
$(VIRTUAL_ENV)/bin/py.test ${PROJECT_FOLDER}
tdd:
$(VIRTUAL_ENV)/bin/ptw -c -- ${PROJECT_FOLDER}
release:
# Warning: requires setting PYPI_USERNAME and PYPI_PASSWORD environment variables
# in order to authenticate to PyPI
$(PYTHON) setup.py sdist release_to_pypi