-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (89 loc) · 3.65 KB
/
Makefile
File metadata and controls
105 lines (89 loc) · 3.65 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
# .PHONY is used to declare that the targets are not files
.PHONY: install-dev clean clean-build clean-pyc clean-test clean-doc release build update-version sync-webapp-readme build-docs deploy-docs joss
help:
@echo "Available commands to 'make':"
@echo " install-dev : do an editable install of the NPLinker package for development"
@echo " clean : remove all build, test, coverage and Python artifacts"
@echo " clean-build : remove build artifacts"
@echo " clean-pyc : remove Python cache file artifacts"
@echo " clean-test : remove test and coverage artifacts"
@echo " clean-doc : remove doc build artifacts"
@echo " build : build package"
@echo " release : upload package to pypi"
@echo " build-docs : build documentation for local development"
@echo " deploy-docs : deploy documentation to GitHub Pages"
@echo " update-version: update NPLinker version (e.g. make update-version CURRENT_VERSION=0.1.0 NEW_VERSION=0.2.0)"
@echo " joss : compile JOSS paper from markdown to PDF for previewing"
install-dev:
pip install -e ".[dev]"
install-nplinker-deps
clean: clean-build clean-pyc clean-test clean-doc
clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
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 {} +
find . -name '*_cache' -exec rm -fr {} +
clean-test:
rm -f .coverage*
rm -f coverage.xml
clean-doc:
rm -rf site
build: clean
python -m build
ls -l dist
release:
python -m twine upload dist/*
# Define the files to update version
FILES := src/nplinker/__init__.py pyproject.toml CITATION.cff
# Rule to update the version in the specified files
update-version:
ifndef CURRENT_VERSION
$(error CURRENT_VERSION is not provided. Usage: make update-version CURRENT_VERSION=0.1.0 NEW_VERSION=0.2.0)
endif
ifndef NEW_VERSION
$(error NEW_VERSION is not provided. Usage: make update-version CURRENT_VERSION=0.1.0 NEW_VERSION=0.2.0)
endif
@for file in $(FILES); do \
if ! grep -qE "__version__ = \"$(CURRENT_VERSION)\"|version = \"$(CURRENT_VERSION)\"|version: \"$(CURRENT_VERSION)\"" $$file; then \
echo "Error: Current version $(CURRENT_VERSION) not found in $$file"; \
exit 1; \
fi; \
done
@echo "Updating version from $(CURRENT_VERSION) to $(NEW_VERSION) for following files:"
@for file in $(FILES); do \
echo " $$file"; \
if [ "$(shell uname)" = "Darwin" ]; then \
sed -i '' -e 's/__version__ = "$(CURRENT_VERSION)"/__version__ = "$(NEW_VERSION)"/' \
-e 's/version = "$(CURRENT_VERSION)"/version = "$(NEW_VERSION)"/' \
-e 's/version: "$(CURRENT_VERSION)"/version: "$(NEW_VERSION)"/' $$file; \
else \
sed -i'' -e 's/__version__ = "$(CURRENT_VERSION)"/__version__ = "$(NEW_VERSION)"/' \
-e 's/version = "$(CURRENT_VERSION)"/version = "$(NEW_VERSION)"/' \
-e 's/version: "$(CURRENT_VERSION)"/version: "$(NEW_VERSION)"/' $$file; \
fi; \
done
@echo "Version update complete."
sync-webapp-readme:
mkdir -p docs/webapp
curl -sSf https://raw.githubusercontent.com/NPLinker/nplinker-webapp/main/README.md -o docs/webapp/readme.md
build-docs: sync-webapp-readme
mkdocs serve
deploy-docs: sync-webapp-readme
ifndef version
$(error version is not set. Usage: make deploy-docs version=YOUR_VERSION)
endif
mike deploy -p -u $(version) latest
joss:
@docker info > /dev/null 2>&1 || { echo >&2 "Docker is not running. Please start Docker and try again."; exit 1; }
docker run --rm \
--volume ${PWD}/joss:/data \
--user $(id -u):$(id -g) \
--env JOURNAL=joss \
openjournals/inara