forked from translate/amagama
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (57 loc) · 2.2 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
DOCS_DIR=docs
.PHONY: all docs requirements help
all: help
docs:
# The following creates the HTML docs.
# NOTE: cd and make must be in the same line.
cd ${DOCS_DIR}; make SPHINXOPTS="-W -q" html
help:
@echo "Help"
@echo "----"
@echo
@echo " docs - build Sphinx docs"
@echo " requirements - (re)generate pinned and minimum requirements"
# Perform forced build using -W for the (.PHONY) requirements target
requirements:
$(MAKE) -W $(REQFILE) requirements/min-versions.txt requirements.txt
REQS=.reqs
REQFILE=requirements/recommended.txt
requirements.txt: $(REQFILE) requirements/required.txt # by inclusion
@set -e; \
case `pip --version` in \
"pip 0"*|"pip 1.[012]"*) \
virtualenv --no-site-packages --clear $(REQS); \
source $(REQS)/bin/activate; \
echo starting clean install of requirements from PyPI; \
pip install --use-mirrors -r $(REQFILE); \
: trap removes partial/empty target on failure; \
trap 'if [ "$$?" != 0 ]; then rm -f $@; fi' 0; \
pip freeze | grep -v '^wsgiref==' | sort > $@ ;; \
*) \
: only pip 1.3.1+ processes --download recursively; \
rm -rf $(REQS); mkdir $(REQS); \
echo starting download of requirements from PyPI; \
pip install --download $(REQS) -r $(REQFILE); \
: trap removes partial/empty target on failure; \
trap 'if [ "$$?" != 0 ]; then rm -f $@; fi' 0; \
(cd $(REQS) && ls *.tar* | \
sed -e 's/-\([0-9]\)/==\1/' -e 's/\.tar.*$$//') > $@; \
esac;
requirements/min-versions.txt: requirements/*.txt
@if grep -q '>[0-9]' $^; then \
echo "Use '>=' not '>' for requirements"; exit 1; \
fi
@echo "creating $@"
@echo "# Automatically generated: DO NOT EDIT" > $@
@echo "# Regenerate using 'make requirements'" >> $@
@echo "# ====================================" >> $@
@echo "# Minimum Requirements" >> $@
@echo "# ====================================" >> $@
@echo "#" >> $@
@echo "# These are the minimum versions of dependencies that the developers" >> $@
@echo "# claim will work." >> $@
@echo "#" >> $@
@echo "# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> $@
@echo "#" >> $@
@echo >> $@
@cat $^ | sed -n '/=/{s/>=/==/;s/,<.*//;p;}' >> $@