-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
102 lines (79 loc) · 2.89 KB
/
Makefile
File metadata and controls
102 lines (79 loc) · 2.89 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
# Location of virtualenv 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;
UPSTREAM?=galaxyproject
SOURCE_DIR?=gxjobconfinit
BUILD_SCRIPTS_DIR=scripts
DEV_RELEASE?=0
VERSION?=$(shell DEV_RELEASE=$(DEV_RELEASE) python $(BUILD_SCRIPTS_DIR)/print_version_for_release.py)
PROJECT_NAME?=galaxy-$(shell basename $(CURDIR))
PROJECT_NAME:=$(subst _,-,$(PROJECT_NAME))
BRANCH?=$(shell git rev-parse --abbrev-ref HEAD)
TEST_DIR?=tests
TESTS?=$(SOURCE_DIR) $(TEST_DIR)
.PHONY: clean-pyc clean-build docs clean
help:
@echo "clean - remove all build, test, coverage and Python artifacts"
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "clean-test - remove test and coverage artifacts"
@echo "setup-venv - setup a development virtualenv in current directory."
@echo "format - format code with black, isort and ruff"
@echo "lint-dist - twine check dist results, including validating README content"
@echo "dist - package project for PyPI distribution"
clean: clean-build clean-pyc clean-tests
clean-build:
rm -fr build/
rm -fr dist/
rm -fr galaxy_*.egg-info
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-tests:
rm -fr .tox/
setup-venv:
if [ ! -d $(VENV) ]; then virtualenv $(VENV); exit; fi;
$(IN_VENV) pip install -r dev-requirements.txt
test:
$(IN_VENV) pytest $(TESTS)
develop:
python setup.py develop
dist: clean
$(IN_VENV) python -m build
ls -l dist
_twine-exists: ; @which twine > /dev/null
lint-dist: _twine-exists dist
$(IN_VENV) twine check dist/*
_release-test-artifacts:
$(IN_VENV) twine upload -r test dist/*
$(OPEN_RESOURCE) https://testpypi.python.org/pypi/$(PROJECT_NAME)
release-test-artifacts: lint-dist _release-test-artifacts
_release-artifacts:
@while [ -z "$$CONTINUE" ]; do \
read -r -p "Have you executed release-test and reviewed results? [y/N]: " CONTINUE; \
done ; \
[ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || (echo "Exiting."; exit 1;)
@echo "Releasing"
$(IN_VENV) twine upload dist/*
release-artifacts: release-test-artifacts _release-artifacts
commit-version:
$(IN_VENV) DEV_RELEASE=$(DEV_RELEASE) python $(BUILD_SCRIPTS_DIR)/commit_version.py $(VERSION)
new-version:
$(IN_VENV) DEV_RELEASE=$(DEV_RELEASE) python $(BUILD_SCRIPTS_DIR)/new_version.py $(VERSION)
release-local: commit-version release-artifacts new-version
push-release:
# git push $(UPSTREAM) $(BRANCH)
# git push upstream $(PROJECT_NAME)-$(VERSION)
echo "Makefile doesn't manually push release."
release: release-local push-release
format:
$(IN_VENV) isort .
$(IN_VENV) black .
$(IN_VENV) ruff check --fix .
mypy:
mypy .