Makefile 2.61 KB
Newer Older
Valentin Samir's avatar
Valentin Samir committed
1
.PHONY: build dist docs
2
VERSION=`python setup.py -V`
3

4 5 6
build:
	python setup.py build

7 8
install: dist
	pip -V
9
	pip install --no-cache-dir --no-deps --upgrade --force-reinstall --find-links ./dist/django-cas-server-${VERSION}.tar.gz django-cas-server
10 11 12

uninstall:
	pip uninstall django-cas-server || true
13

Valentin Samir's avatar
Valentin Samir committed
14
clean_pyc:
15 16
	find ./ -name '*.pyc' -delete
	find ./ -name __pycache__ -delete
Valentin Samir's avatar
Valentin Samir committed
17
clean_build:
18
	rm -rf build django_cas_server.egg-info dist
Valentin Samir's avatar
Valentin Samir committed
19
clean_tox:
Valentin Samir's avatar
Valentin Samir committed
20
	rm -rf .tox tox_logs
Valentin Samir's avatar
Valentin Samir committed
21 22
clean_test_venv:
	rm -rf test_venv
23 24 25 26
clean_coverage:
	rm -rf coverage.xml .coverage htmlcov
clean_tild_backup:
	find ./ -name '*~' -delete
Valentin Samir's avatar
Valentin Samir committed
27
clean_docs:
28
	rm -rf docs/_build/ docs/django.inv
29 30
clean_eggs:
	rm -rf .eggs/
31

32
clean: clean_pyc clean_build clean_coverage clean_tild_backup
33

34
clean_all: clean clean_tox clean_test_venv clean_docs clean_eggs
35

36 37
dist:
	python setup.py sdist
38

39
test_venv/bin/python:
40 41
	python3 -m venv test_venv
	test_venv/bin/pip install -U --requirement requirements-dev.txt 'Django>=2.0,<2.1'
42

43
test_venv/cas/manage.py: test_venv
44 45
	mkdir -p test_venv/cas
	test_venv/bin/django-admin startproject cas test_venv/cas
46
	ln -s ../../cas_server test_venv/cas/cas_server
47
	sed -i "s/'django.contrib.staticfiles',/'django.contrib.staticfiles',\n    'cas_server',/" test_venv/cas/cas/settings.py
48 49 50
	sed -i "s/'django.middleware.clickjacking.XFrameOptionsMiddleware',/'django.middleware.clickjacking.XFrameOptionsMiddleware',\n    'django.middleware.locale.LocaleMiddleware',/" test_venv/cas/cas/settings.py
	sed -i 's/from django.conf.urls import url/from django.conf.urls import url, include/' test_venv/cas/cas/urls.py
	sed -i "s@url(r'^admin/', admin.site.urls),@url(r'^admin/', admin.site.urls),\n    url(r'^', include('cas_server.urls', namespace='cas_server')),@" test_venv/cas/cas/urls.py
51 52
	test_venv/bin/python test_venv/cas/manage.py migrate
	test_venv/bin/python test_venv/cas/manage.py createsuperuser
53

54 55 56
test_venv: test_venv/bin/python

test_project: test_venv/cas/manage.py
57 58 59
	@echo "##############################################################"
	@echo "A test django project was created in $(realpath test_venv/cas)"

Valentin Samir's avatar
Valentin Samir committed
60
run_server: test_project
61
	test_venv/bin/python test_venv/cas/manage.py runserver
62

Valentin Samir's avatar
Valentin Samir committed
63
run_tests: test_venv
64
	python setup.py check --restructuredtext --stric
65
	test_venv/bin/py.test -rw -x --cov=cas_server --cov-report html --cov-report term
Valentin Samir's avatar
Valentin Samir committed
66
	rm htmlcov/coverage_html.js  # I am really pissed off by those keybord shortcuts
Valentin Samir's avatar
Valentin Samir committed
67 68 69 70

test_venv/bin/sphinx-build: test_venv
	test_venv/bin/pip install Sphinx sphinx_rtd_theme

Valentin Samir's avatar
Valentin Samir committed
71
docs: test_venv/bin/sphinx-build
72
	bash -c "source test_venv/bin/activate; cd docs; make html"
73 74 75

publish_pypi_release:
	python setup.py sdist bdist_wheel upload --sign