22
33# External utilities
44PYTHON =python3
5- PIP =pip
5+ PIP =pip3
66PYTEST =pytest
77TWINE =twine
88PYFLAGS =
99MSGINIT =msginit
1010MSGMERGE =msgmerge
1111MSGFMT =msgfmt
1212XGETTEXT =xgettext
13- DEST_DIR =/
13+ DESTDIR =/
14+ BUILDDIR =build
1415
1516# Find the location of the GObject introspection libs and cairo (required for
1617# the develop target)
@@ -20,12 +21,10 @@ GLIB:=
2021
2122# Calculate the base names of the distribution, the location of all source,
2223# documentation, packaging, icon, and executable script files
23- NAME: =$(shell $(PYTHON ) $(PYFLAGS ) setup.py -- name)
24+ NAME: =$(shell $(PYTHON ) $(PYFLAGS ) -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb') )['project'][' name'])" )
2425WHEEL_NAME: =$(subst -,_,$(NAME ) )
25- VER: =$(shell $(PYTHON ) $(PYFLAGS ) setup.py --version)
26- PY_SOURCES: =$(shell \
27- $(PYTHON ) $(PYFLAGS ) setup.py egg_info >/dev/null 2>&1 && \
28- cat $(WHEEL_NAME ) .egg-info/SOURCES.txt | grep -v "\.egg-info" | grep -v "\.mo$$")
26+ VER: =$(shell $(PYTHON ) $(PYFLAGS ) -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb') )['project']['version'])")
27+ PY_SOURCES: =$(wildcard pemmican/* .py)
2928DOC_SOURCES: =docs/conf.py \
3029 $(wildcard docs/* .png) \
3130 $(wildcard docs/* .svg) \
@@ -34,12 +33,10 @@ DOC_SOURCES:=docs/conf.py \
3433 $(wildcard docs/* .gpi) \
3534 $(wildcard docs/* .rst) \
3635 $(wildcard docs/* .pdf)
37- SUBDIRS: =
3836
3937# Calculate the name of all outputs
4038DIST_WHEEL =dist/$(WHEEL_NAME ) -$(VER ) -py3-none-any.whl
4139DIST_TAR =dist/$(NAME ) -$(VER ) .tar.gz
42- DIST_ZIP =dist/$(NAME ) -$(VER ) .zip
4340POT_FILE =po/$(NAME ) .pot
4441PO_FILES: =$(wildcard po/* .po)
4542MO_FILES: =$(patsubst po/% .po,po/mo/% /LC_MESSAGES/$(NAME ) .mo,$(PO_FILES ) )
5956 @echo " make doc - Generate HTML and PDF documentation"
6057 @echo " make source - Create source package"
6158 @echo " make wheel - Generate a PyPI wheel package"
62- @echo " make zip - Generate a source zip package"
63- @echo " make tar - Generate a source tar package"
6459 @echo " make dist - Generate all packages"
6560 @echo " make clean - Get rid of all generated files"
6661 @echo " make release - Create and tag a new release"
6762 @echo " make upload - Upload the new release to repositories"
6863
69- install : $( SUBDIRS )
70- $(PYTHON ) $( PYFLAGS ) setup.py install --root $(DEST_DIR )
64+ install :
65+ $(PIP ) install . --root $(DESTDIR )
7166
7267doc : $(DOC_SOURCES )
7368 $(MAKE ) -C docs clean
@@ -79,14 +74,10 @@ doc: $(DOC_SOURCES)
7974preview :
8075 $(MAKE ) -C docs preview
8176
82- source : $(DIST_TAR ) $( DIST_ZIP )
77+ source : $(DIST_TAR )
8378
8479wheel : $(DIST_WHEEL )
8580
86- zip : $(DIST_ZIP )
87-
88- tar : $(DIST_TAR )
89-
9081dist : $(DIST_WHEEL ) $(DIST_TAR ) $(DIST_ZIP )
9182
9283pot : $(POT_FILE ) $(PO_FILES )
@@ -121,10 +112,7 @@ test:
121112 $(PYTEST )
122113
123114clean :
124- rm -fr dist/ build/ man/ .pytest_cache/ .mypy_cache/ $(WHEEL_NAME ) .egg-info/ tags .coverage
125- for dir in $( SUBDIRS) ; do \
126- $(MAKE ) -C $$ dir clean; \
127- done
115+ rm -rf $(BUILDDIR ) .pytest_cache/ .mypy_cache/ $(WHEEL_NAME ) .egg-info/ tags .coverage
128116 find $(CURDIR ) -name " *.pyc" -delete
129117 find $(CURDIR ) -name " __pycache__" -delete
130118
@@ -134,9 +122,6 @@ tags: $(PY_SOURCES)
134122lint : $(PY_SOURCES )
135123 pylint $(WHEEL_NAME )
136124
137- $(SUBDIRS ) :
138- $(MAKE ) -C $@
139-
140125$(MAN_PAGES ) : $(DOC_SOURCES )
141126 $(MAKE ) -C docs man
142127 mkdir -p man/
@@ -152,14 +137,11 @@ po/mo/%/LC_MESSAGES/$(NAME).mo: po/%.po
152137 mkdir -p $(dir $@ )
153138 $(MSGFMT ) $< -o $@
154139
155- $(DIST_TAR ) : $(PY_SOURCES ) $(SUBDIRS )
156- $(PYTHON ) $(PYFLAGS ) setup.py sdist --formats gztar
157-
158- $(DIST_ZIP ) : $(PY_SOURCES ) $(SUBDIRS )
159- $(PYTHON ) $(PYFLAGS ) setup.py sdist --formats zip
140+ $(DIST_TAR ) : $(PY_SOURCES )
141+ $(PYTHON ) $(PYFLAGS ) -m build --sdist -o $(BUILDDIR ) /dist .
160142
161- $(DIST_WHEEL ) : $(PY_SOURCES ) $( SUBDIRS )
162- $(PYTHON ) $(PYFLAGS ) setup.py bdist_wheel
143+ $(DIST_WHEEL ) : $(PY_SOURCES )
144+ $(PYTHON ) $(PYFLAGS ) -m build --wheel -o $( BUILDDIR ) /dist .
163145
164146release :
165147 $(MAKE ) clean
@@ -171,4 +153,4 @@ upload: $(DIST_TAR) $(DIST_WHEEL)
171153 $(TWINE ) check $(DIST_TAR ) $(DIST_WHEEL )
172154 $(TWINE ) upload $(DIST_TAR ) $(DIST_WHEEL )
173155
174- .PHONY : all install develop test doc source wheel zip tar dist clean tags release upload $( SUBDIRS )
156+ .PHONY : all install develop test doc source wheel zip tar dist clean tags release upload
0 commit comments