-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
83 lines (71 loc) · 2.09 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
79
80
81
82
83
PYTHON = python3
# In not in a virtualenv, add --user options for install commands.
INSTALL_OPTS = `$(PYTHON) -c "import sys; print('' if hasattr(sys, 'real_prefix') else '--user')"`
SYSDEPS = \
antiword \
libjpeg-dev \
poppler-utils \
tesseract-ocr abiword \
unrtf \
pstotext \
libimage-exiftool-perl \
unrar \
python-setuptools \
python3-setuptools \
python-dev \
python3-dev \
python-pip \
python3-pip
TEST_PREFIX = PYTHONWARNINGS=all FULLTEXT_TESTING=1
test: ## Run tests.
${MAKE} install-git-hooks
$(TEST_PREFIX) $(PYTHON) fulltext/test/__init__.py
ci: ## Run CI tests.
${MAKE} sysdeps
${MAKE} pydeps
${MAKE} test
${MAKE} lint
lint: ## Run linters.
${MAKE} install-git-hooks
@git ls-files | grep \\.py$ | xargs $(PYTHON) -m flake8
install: ## Install this package as current user in "edit" mode.
${MAKE} install-git-hooks
PYTHONWARNINGS=all $(PYTHON) setup.py develop $(INSTALL_OPTS)
pydeps: ## Install third party python libs.
$(PYTHON) -m pip install $(INSTALL_OPTS) --upgrade -r requirements.txt
$(PYTHON) -m pip install $(INSTALL_OPTS) --upgrade flake8
sysdeps: ## Install system deps (Ubuntu).
sudo apt-get install -y $(SYSDEPS)
sudo apt-get install python
sudo pip2 install --pre --upgrade pyhwp
publish: ## Upload package on PYPI.
$(PYTHON) setup.py register
$(PYTHON) setup.py sdist upload
clean: ## Remove all build files.
rm -rf `find . -type d -name __pycache__ \
-o -type f -name \*.bak \
-o -type f -name \*.orig \
-o -type f -name \*.pyc \
-o -type f -name \*.pyd \
-o -type f -name \*.pyo \
-o -type f -name \*.rej \
-o -type f -name \*.so \
-o -type f -name \*.~ \
-o -type f -name \*\$testfn`
rm -rf \
*.core \
*.egg-info \
*\$testfn* \
.coverage \
.tox \
build/ \
dist/ \
docs/_build/ \
htmlcov/ \
venv \
tmp/
install-git-hooks: ## Install GIT pre-commit hook.
@ln -sf ../../.git-pre-commit .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
help: ## Display callable targets.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'