forked from xzkostyan/clickhouse-cityhash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython.mk
76 lines (61 loc) · 1.87 KB
/
python.mk
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
.PHONY: clean develop env extras package release test virtualenv build_ext
PYMODULE := cityhash
EXTENSION := $(PYMODULE).so
SRC_DIR := src
EXTENSION_INTERMEDIATE := ./$(SRC_DIR)/$(PYMODULE).cpp
EXTENSION_DEPS := ./$(SRC_DIR)/$(PYMODULE).pyx
PYPI_HOST := pypi
DISTRIBUTE := sdist bdist_wheel
EXTRAS_REQS := dev-requirements.txt $(wildcard extras-*-requirements.txt)
PYENV := PYTHONPATH=. . env/bin/activate;
PYTHON := $(PYENV) python
PIP := $(PYENV) pip
package: env build_ext
$(PYTHON) setup.py $(DISTRIBUTE)
release: env build_ext
$(PYTHON) setup.py $(DISTRIBUTE) upload -r $(PYPI_HOST)
shell: extras build_ext
$(PYENV) $(ENV_EXTRA) ipython
build_ext: $(EXTENSION)
@echo "done building '$(EXTENSION)' extension"
$(EXTENSION): env $(EXTENSION_DEPS)
$(PYTHON) setup.py build_ext --inplace
test: extras build_ext
$(PYENV) nosetests $(NOSEARGS)
$(PYENV) py.test README.rst
nuke: clean
rm -f $(EXTENSION_INTERMEDIATE)
rm -rf *.egg *.egg-info env
clean:
python setup.py clean
rm -rf dist build
rm -f $(EXTENSION)
find $(SRC_DIR) -type f -name "*.pyc" -exec rm {} \;
find $(SRC_DIR) -type f -name "*.cpp" -exec rm {} \;
find $(SRC_DIR) -type f -name "*.so" -exec rm {} \;
develop:
@echo "Installing for " `which pip`
-pip uninstall --yes $(PYMODULE)
pip install -e .
extras: env/make.extras
env/make.extras: $(EXTRAS_REQS) | env
rm -rf env/build
$(PYENV) for req in $?; do pip install -r $$req; done
touch $@
ifeq ($(PIP_SYSTEM_SITE_PACKAGES),1)
VENV_OPTS="--system-site-packages"
else
VENV_OPTS="--no-site-packages"
endif
env virtualenv: env/bin/activate
env/bin/activate: setup.py
test -f $@ || virtualenv $(VENV_OPTS) env
$(PYENV) curl https://bootstrap.pypa.io/ez_setup.py | python
$(PIP) install -U pip
$(PIP) install -U setuptools
$(PIP) install -U markerlib
$(PIP) install -U wheel
$(PIP) install -U cython
$(PIP) install -U Distribute
$(PIP) install -e .
touch $@