Skip to content

Commit b65260a

Browse files
committed
feat: add a Makefile goal simple-index that generates a PEP-503 compatible Simple Index directory inside the dist
1 parent 607994d commit b65260a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,18 @@ dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-docs-md.zip: docs-md
197197
dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-build-epoch.txt:
198198
echo $(SOURCE_DATE_EPOCH) > dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-build-epoch.txt
199199

200+
# Build a PEP-503 compatible Simple Repository compatible directory inside of dist/.
201+
# For details on the layout of that directory, see: https://peps.python.org/pep-0503/
202+
# This directory can then be used to install (hashed) artifacts from using `pip` and
203+
# its `--extra-index-url` argument: https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-extra-index-url
204+
.PHONY: simple-index
205+
simple-index: dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
206+
mkdir -p dist/simple-index/$(PACKAGE_NAME)
207+
echo -e "<!-- https://peps.python.org/pep-0503/ -->\n<!DOCTYPE html><html><head><meta name='pypi:repository-version' content='1.3'></head><body><a href='/$(PACKAGE_NAME)/'>$(PACKAGE_NAME)</a></body></html>" > dist/simple-index/index.html
208+
echo -e "<!-- https://peps.python.org/pep-0503/ -->\n<!DOCTYPE html><html><head><meta name='pypi:repository-version' content='1.3'></head><body><a href='$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl'>$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl</a><a href='$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz'>$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz</a></body></html>" > dist/simple-index/$(PACKAGE_NAME)/index.html
209+
cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/simple-index/$(PACKAGE_NAME)/
210+
cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz dist/simple-index/$(PACKAGE_NAME)/
211+
200212
# Build the HTML and Markdown documentation from the package's source.
201213
DOCS_SOURCE := $(shell git ls-files docs/source)
202214
.PHONY: docs docs-html docs-md

0 commit comments

Comments
 (0)