File size: 4,943 Bytes
cd61108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
define ALL
	update-requirements
	install-jython
endef
ALL:=$(shell echo $(ALL))  # to remove line-feeds

define REQUIREMENTS_FILES
	requirements/dev.txt
	requirements/docs.txt
	requirements/lint.txt
	requirements/test.txt
	requirements.txt
endef
REQUIREMENTS_FILES:=$(shell echo $(REQUIREMENTS_FILES))

define REQUIREMENTS_IN
	requirements.in
endef
REQUIREMENTS_IN:=$(shell echo $(REQUIREMENTS_IN))

define REQUIREMENTS_IN_TEST
	requirements/test.in
	requirements.in
endef
REQUIREMENTS_IN_TEST:=$(shell echo $(REQUIREMENTS_IN_TEST))

define REQUIREMENTS_IN_LINT
	requirements/lint.in
endef
REQUIREMENTS_IN_LINT:=$(shell echo $(REQUIREMENTS_IN_LINT))

define REQUIREMENTS_IN_DOCS
	requirements/docs.in
endef
REQUIREMENTS_IN_DOCS:=$(shell echo $(REQUIREMENTS_IN_DOCS))

define REQUIREMENTS_IN_DEV
	requirements/dev.in
	requirements/docs.in
	requirements/lint.in
	requirements/test.in
	requirements.in
endef
REQUIREMENTS_IN_DEV:=$(shell echo $(REQUIREMENTS_IN_DEV))

offline?=0

ifeq (1,$(offline))
PIP_NO_INDEX:=--no-index
endif

FIND_LINKS?=
VENV	:= . .venv/bin/activate &&


.PHONY: all
all: $(ALL)

.PHONY: bootstrap
bootstrap:
	[ -e bin/activate ] || virtualenv -p python2.7 .
	$(VENV) pip install -U setuptools pip wheel pip-tools
	make update-requirements
	$(VENV) buildout

.PHONY: update-requirements
update-requirements: $(REQUIREMENTS_FILES)
	$(VENV) pip-sync $(FIND_LINKS) $(PIP_NO_INDEX) requirements/dev.txt

requirements.txt: $(REQUIREMENTS_IN)
	$(VENV)	pip-compile $(FIND_LINKS) $(PIP_NO_INDEX) $(pip-compile-options) -o $@ $^

requirements/test.txt: $(REQUIREMENTS_IN_TEST)
	$(VENV) pip-compile $(FIND_LINKS) $(PIP_NO_INDEX) $(pip-compile-options) -o $@ $^

requirements/lint.txt: $(REQUIREMENTS_IN_LINT)
	$(VENV) pip-compile $(FIND_LINKS) $(PIP_NO_INDEX) $(pip-compile-options) -o $@ $^

requirements/docs.txt: $(REQUIREMENTS_IN_DOCS)
	$(VENV) pip-compile $(FIND_LINKS) $(PIP_NO_INDEX) $(pip-compile-options) -o $@ $^

requirements/dev.txt: $(REQUIREMENTS_IN_DEV)
	$(VENV) pip-compile $(FIND_LINKS) $(PIP_NO_INDEX) $(pip-compile-options) -o $@ $^


.PHONY: extract-messages
extract-messages:
	$(VENV) python setup.py extract_messages --input-paths=pyhwp/hwp5/proc --output-file=pyhwp/hwp5/locale/hwp5proc.pot
	$(VENV) python setup.py extract_messages --input-paths=pyhwp/hwp5/hwp5html.py --output-file=pyhwp/hwp5/locale/hwp5html.pot
	$(VENV) python setup.py extract_messages --input-paths=pyhwp/hwp5/hwp5odt.py --output-file=pyhwp/hwp5/locale/hwp5odt.pot
	$(VENV) python setup.py extract_messages --input-paths=pyhwp/hwp5/hwp5txt.py --output-file=pyhwp/hwp5/locale/hwp5txt.pot
	$(VENV) python setup.py extract_messages --input-paths=pyhwp/hwp5/hwp5view.py --output-file=pyhwp/hwp5/locale/hwp5view.pot

.PHONY: init-catalog
init-catalog:
	$(VENV) python setup.py init_catalog --domain=hwp5proc --input-file=pyhwp/hwp5/locale/hwp5proc.pot --locale=ko
	$(VENV) python setup.py init_catalog --domain=hwp5html --input-file=pyhwp/hwp5/locale/hwp5html.pot --locale=ko
	$(VENV) python setup.py init_catalog --domain=hwp5odt --input-file=pyhwp/hwp5/locale/hwp5odt.pot --locale=ko
	$(VENV) python setup.py init_catalog --domain=hwp5txt --input-file=pyhwp/hwp5/locale/hwp5txt.pot --locale=ko
	$(VENV) python setup.py init_catalog --domain=hwp5view --input-file=pyhwp/hwp5/locale/hwp5view.pot --locale=ko

.PHONY: update-catalog
update-catalog:
	$(VENV) python setup.py update_catalog --domain=hwp5proc --input-file=pyhwp/hwp5/locale/hwp5proc.pot
	$(VENV) python setup.py update_catalog --domain=hwp5html --input-file=pyhwp/hwp5/locale/hwp5html.pot
	$(VENV) python setup.py update_catalog --domain=hwp5odt --input-file=pyhwp/hwp5/locale/hwp5odt.pot
	$(VENV) python setup.py update_catalog --domain=hwp5txt --input-file=pyhwp/hwp5/locale/hwp5txt.pot
	$(VENV) python setup.py update_catalog --domain=hwp5view --input-file=pyhwp/hwp5/locale/hwp5view.pot

.PHONY: compile-catalog
compile-catalog:
	$(VENV) python setup.py compile_catalog --domain=hwp5proc
	$(VENV) python setup.py compile_catalog --domain=hwp5html
	$(VENV) python setup.py compile_catalog --domain=hwp5odt
	$(VENV) python setup.py compile_catalog --domain=hwp5txt
	$(VENV) python setup.py compile_catalog --domain=hwp5view

.PHONY: notebook
notebook:
	$(VENV)	jupyter notebook --notebook-dir=notebooks


.PHONY: test
test:
	$(VENV) tox --parallel 2 -e py27,py38

.PHONY: test-report
test-report:
	$(VENV) coverage combine .tox/*/tmp
	$(VENV) coverage report
	$(VENV) coverage html
	$(VENV) coverage xml

.PHONY: clitest
clitest:
	$(VENV) env LANG=C clitest -1 --prefix 3 tests/cli_tests/hwp5proc.txt tests/cli_tests/hwp5odt.txt tests/cli_tests/hwp5html.txt tests/cli_tests/hwp5txt.txt


.PHONY: install-jython
install-jython: parts/jython2.7/bin/jython
parts/jython2.7/bin/jython:
	rm -rf parts/jython2.7
	mkdir -p parts
	$(VIRTUAL_ENV)/bin/jip install org.python:jython-installer:2.7.1
	java -jar $(VIRTUAL_ENV)/javalib/jython-installer-2.7.1.jar -s -d $(PWD)/parts/jython2.7