-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
124 lines (92 loc) · 4.2 KB
/
Copy pathMakefile
File metadata and controls
124 lines (92 loc) · 4.2 KB
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
# Extra arguments supplied to tox command
ARGS?=
# Location of virtual env used for development.
VENV?=.venv
# Open resource on Mac OS X or Linux
OPEN_RESOURCE=bash -c 'open $$0 || xdg-open $$0'
# Source virtualenv to execute command (flake8, sphinx, twine, etc...)
IN_VENV=if [ -f $(VENV)/bin/activate ]; then . $(VENV)/bin/activate; fi;
# TODO: add this upstream as a remote if it doesn't already exist.
UPSTREAM?=galaxyproject
SOURCE_DIR?=galaxy_utils
BUILD_SCRIPTS_DIR=scripts
VERSION?=$(shell python $(BUILD_SCRIPTS_DIR)/print_version_for_release.py $(SOURCE_DIR))
# TODO: get a RTD
DOC_URL?=https://galaxy_utils.readthedocs.org
PROJECT_URL?=https://github.com/galaxyproject/sequence_utils
TEST_DIR?=tests
DOCS_DIR?=docs
ITEM?=
.PHONY: clean-pyc clean-build docs clean
help:
@egrep '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr *.egg-info
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test: ## remove test and coverage artifacts
rm -f .coverage
rm -fr htmlcov/
install: ## install into Python environment
python setup.py install
setup-venv: ## setup a development virtual env in current directory
if [ ! -d $(VENV) ]; then python3 -m venv $(VENV); exit; fi;
$(IN_VENV) python3 -m pip install -r dev-requirements.txt
setup-git-hook-lint: ## setup precommit hook for linting project
cp $(BUILD_SCRIPTS_DIR)/pre-commit-lint .git/hooks/pre-commit
setup-git-hook-lint-and-test: ## setup precommit hook for linting and testing project
cp $(BUILD_SCRIPTS_DIR)/pre-commit-lint-and-test .git/hooks/pre-commit
lint: ## check style using tox and flake8
$(IN_VENV) tox -e lint
lint-readme: ## check README formatting for PyPI
$(IN_VENV) python setup.py check -r -s
test: ## run tests with the default Python (faster than tox)
$(IN_VENV) pytest
tool-tests: ## Run tool tests against library in current state
bash tests/planemo_test.bash
tox: ## run tests with tox
$(IN_VENV) tox -- $(ARGS)
_coverage-report: ## build coverage report with the default Python
coverage run --source $(SOURCE_DIR) setup.py $(TEST_DIR)
coverage report -m
coverage html
_open-coverage: ## open coverage report using open
open htmlcov/index.html || xdg-open htmlcov/index.html
coverage: _coverage-report open-coverage ## check code coverage quickly with the default Python
open-history: # view HISTORY.rst as HTML.
rst2html HISTORY.rst > /tmp/seq_util_history.html
$(OPEN_RESOURCE) /tmp/seq_util_history.html
ready-docs: ## rebuild docs folder ahead of running docs or lint-docs
rm -f $(DOCS_DIR)/$(SOURCE_DIR).rst
rm -f $(DOCS_DIR)/modules.rst
$(IN_VENV) sphinx-apidoc -f -o $(DOCS_DIR)/ $(SOURCE_DIR) $(SOURCE_DOC_EXCLUDE)
docs: ready-docs ## generate Sphinx HTML documentation, including API docs
$(IN_VENV) $(MAKE) -C $(DOCS_DIR) clean
$(IN_VENV) $(MAKE) -C $(DOCS_DIR) html
lint-docs: ready-docs
$(IN_VENV) $(MAKE) -C $(DOCS_DIR) clean
$(IN_VENV) $(MAKE) -C $(DOCS_DIR) html 2>&1 | python $(BUILD_SCRIPTS_DIR)/lint_sphinx_output.py
_open-docs:
$(OPEN_RESOURCE) $(DOCS_DIR)/_build/html/index.html
open-docs: docs _open-docs ## generate Sphinx HTML documentation and open in browser
open-rtd: docs ## open docs on readthedocs.org
$(OPEN_RESOURCE) $(PROJECT_URL)
open-project: ## open project on github
$(OPEN_RESOURCE) $(PROJECT_URL)
commit-version: ## Update version and history, commit.
$(IN_VENV) python $(BUILD_SCRIPTS_DIR)/commit_version.py $(SOURCE_DIR) $(VERSION)
new-version: ## Mint a new version
$(IN_VENV) python $(BUILD_SCRIPTS_DIR)/new_version.py $(SOURCE_DIR) $(VERSION)
release-local: commit-version new-version
push-release: ## Push a tagged release to github
git push $(UPSTREAM) master
git push --tags $(UPSTREAM)
release: release-local push-release ## package, review, and upload a release
add-history: ## Reformat HISTORY.rst with data from Github's API
$(IN_VENV) python $(BUILD_SCRIPTS_DIR)/bootstrap_history.py $(ITEM)