-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
78 lines (59 loc) · 1.83 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
78
PROJECT = ipyjulia_hacks
.PHONY: all test clean clean-pycache doc inject-readme update-init upload
all: test doc
## Testing
test:
tox
PYJULIA_TEST_REBUILD=yes tox -e py2
test-cov: test-cov-py3
test-cov-%:
tox -e $* -- --cov $(PROJECT)
$(MAKE) coverage-report-$*
coverage-report: coverage-report-py3
coverage-report-%:
.tox/$*/bin/coverage combine .coverage
.tox/$*/bin/coverage report
.tox/$*/bin/coverage html --directory $(PWD)/.tox/$*/tmp/cov_html
clean: clean-pycache
rm -rf src/*.egg-info .tox MANIFEST
clean-pycache:
find src -name __pycache__ -o -name '*.pyc' -print0 \
| xargs --null rm -rf
## Documentation
doc: inject-readme
tox -e doc -- -W
update-init: inject-readme
git commit --message "Update src/$(PROJECT)/__init__.py" \
-- src/$(PROJECT)/__init__.py
## Inject content of README.rst to the docstring of __init__.py.
inject-readme: src/$(PROJECT)/__init__.py
src/$(PROJECT)/__init__.py: README.rst
sed '1,/^"""$$/d' $@ > [email protected]
rm $@
echo '"""' >> $@
cat README.rst >> $@
echo '"""' >> $@
cat [email protected] >> $@
# Note that sed '1,/^"""$/d' prints the lines after the SECOND """
# because the first """ appears at the first line.
## Git subtree to sync with ipyjulia_core
CORE_REPO = ipyjulia_core
CORE_PATH = src/ipyjulia_hacks/core
.PHONY: *-core
sync-core: push-core
$(MAKE) pull-core
# Doing push first so that it fails if the local and remote are
# incompatible. It means that the core is updated elsewhere. In that
# case, I need to handle it manually (e.g., maybe non-squash pull).
push-core:
git subtree push --prefix $(CORE_PATH) $(CORE_REPO) master
pull-core:
git subtree pull --prefix $(CORE_PATH) $(CORE_REPO) master --squash
set-remote-core:
git remote add -f $(CORE_REPO) [email protected]:tkf/ipyjulia_core.git
## Upload to PyPI
upload:
rm -rf dist/
python setup.py sdist
twine upload dist/*