forked from b3yc0d3/rule34Py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (70 loc) · 2.15 KB
/
Makefile
File metadata and controls
100 lines (70 loc) · 2.15 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
# Extract the project name and version from the pyproject.toml file.
PROJECT = $(shell $(PYTHON3) scripts/read_pyproject.py project/name | tr 'A-Z' 'a-z')
VERSION = $(shell $(PYTHON3) scripts/read_pyproject.py project/version)
# Binaries
PYTHON3 ?= python3
PYTEST = $(PYTHON3) -m pytest
PYTHON_BUILD = $(PYTHON3) -m build
RUFF = $(PYTHON3) -m ruff
SPHINX = $(PYTHON3) -m sphinx
TWINE = $(PYTHON3) -m twine
# Source files
builddir ?= build
srcdir = rule34Py
dist_files = \
$(srcdir) \
LICENSE \
NOTICE.md \
pyproject.toml \
README.md \
sdist = $(builddir)/$(PROJECT)-$(VERSION).tar.gz # The python sdist.
wheels = $(builddir)/$(PROJECT)-$(VERSION)-py3-none-any.whl # The python wheels.
# Installation Directories
prefix ?= /usr/local
docdir ?= $(prefix)/share/doc/$(project)
htmldir ?= $(docdir)/html
.DEFAULT_GOAL = all
# REAL TARGETS #
################
$(wheels) &: $(dist_files)
$(PYTHON_BUILD) --outdir $(builddir) --wheel
$(sdist) : $(dist_files)
$(PYTHON_BUILD) --outdir $(builddir) --sdist
# PHONY TARGETS #
#################
# Build all binary targets necessary for installation.
# Does not build documentation or source distributions.
all : $(wheels)
.PHONY : all
# Run pre-installation tests on the built artifacts.
check : all
PYTHONPATH=$(builddir)/lib $(PYTEST) tests/unit/
.PHONY : check
# Remove all files created as a result of building the project.
clean : mostlyclean
find ./ -depth -path '**/.pytest_cache*' -print -delete
find ./ -depth -path '**/__pycache__*' -print -delete
$(RUFF) clean
.PHONY : clean
# Build the redistributable source archive.
dist : $(sdist)
.PHONY : dist
# Check and publish the python package index artifacts.
publish : $(sdist) $(wheels)
$(TWINE) check $(^)
$(TWINE) upload $(^)
.PHONY : publish
# Build the project's HTML documentation.
html :
$(SPHINX) --builder html docs $(builddir)/html
.PHONY : html
# Lint the project source for quality.
lint :
$(RUFF) check $(srcdir)
.PHONY : lint
# Remove files created as a result of building the project, except those that
# rarely need to be rebuilt.
mostlyclean :
rm -rf $(builddir)
find ./ -depth -path '**/rule34Py.egg-info*' -print -delete
.PHONY : mostlyclean