File: Makefile

package info (click to toggle)
django-cas-server 3.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,704 kB
  • sloc: python: 6,154; makefile: 275; xml: 100; javascript: 92; sh: 3
file content (89 lines) | stat: -rw-r--r-- 3,042 bytes parent folder | download
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
78
79
80
81
82
83
84
85
86
87
88
89
.PHONY: build dist docs
VERSION=`python3 setup.py -V`

WHL_FILES := $(wildcard dist/*.whl)
WHL_ASC := $(WHL_FILES:=.asc)
DIST_FILE := $(wildcard dist/*.tar.gz)
DIST_ASC := $(DIST_FILE:=.asc)

build:
	python3 setup.py build

install: dist
	pip3 -V
	pip3 install --no-cache-dir --no-deps --upgrade --force-reinstall --find-links ./dist/django-cas-server-${VERSION}.tar.gz django-cas-server

uninstall:
	pip3 uninstall django-cas-server || true

clean_pyc:
	find ./ -name '*.pyc' -delete
	find ./ -name __pycache__ -delete
clean_build:
	rm -rf build django_cas_server.egg-info dist
clean_tox:
	rm -rf .tox tox_logs
clean_test_venv:
	rm -rf test_venv
clean_coverage:
	rm -rf coverage.xml .coverage htmlcov
clean_tild_backup:
	find ./ -name '*~' -delete
clean_docs:
	rm -rf docs/_build/ docs/django.inv docs/python.inv
clean_eggs:
	rm -rf .eggs/

clean: clean_pyc clean_build clean_coverage clean_tild_backup

clean_all: clean clean_tox clean_test_venv clean_docs clean_eggs

dist:
	python3 setup.py sdist
	python3 setup.py bdist_wheel

test_venv/bin/python:
	python3 -m venv test_venv
	test_venv/bin/pip install -U --requirement requirements-dev.txt 'Django>=5.2,<5.3'

test_venv/cas/manage.py: test_venv
	mkdir -p test_venv/cas
	test_venv/bin/django-admin startproject cas test_venv/cas
	ln -s ../../cas_server test_venv/cas/cas_server
	sed -i "s/'django.contrib.staticfiles',/'django.contrib.staticfiles',\n    'cas_server',/" test_venv/cas/cas/settings.py
	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.urls import path/from django.urls import path, include/' test_venv/cas/cas/urls.py
	sed -i "s@path('admin/', admin.site.urls),@path('admin/', admin.site.urls),\n    path('', include('cas_server.urls', namespace='cas_server')),@" test_venv/cas/cas/urls.py
	test_venv/bin/python test_venv/cas/manage.py migrate
	test_venv/bin/python test_venv/cas/manage.py createsuperuser

test_venv: test_venv/bin/python

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

run_server: test_project
	test_venv/bin/python test_venv/cas/manage.py runserver

run_tests: test_venv
	python3 setup.py check --restructuredtext --stric
	test_venv/bin/py.test -rw -x --cov=cas_server --cov-report html --cov-report term
	rm htmlcov/coverage_html.js  # I am really pissed off by those keybord shortcuts

test_venv/bin/sphinx-build: test_venv
	test_venv/bin/pip install -r docs/requirements.txt

docs: test_venv/bin/sphinx-build
	bash -c "source test_venv/bin/activate; cd docs; make html"

sign_release: $(WHL_ASC) $(DIST_ASC)

dist/%.asc:
	gpg --detach-sign -a $(@:.asc=)

test_venv/bin/twine: test_venv
	test_venv/bin/pip install twine

publish_pypi_release: test_venv test_venv/bin/twine dist sign_release
	test_venv/bin/twine upload --sign dist/*