Skip to content

Commit a94e221

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

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Makefile

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

190+
# Build a PEP-503 compatible Simple Repository compatible directory inside of dist/.
191+
# For details on the layout of that directory, see: https://peps.python.org/pep-0503/
192+
# This directory can then be used to install (hashed) artifacts from using `pip` and
193+
# its `--extra-index-url` argument: https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-extra-index-url
194+
.PHONY: simple-index
195+
simple-index: dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
196+
mkdir -p dist/simple-index/$(PACKAGE_NAME)
197+
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
198+
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
199+
cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/simple-index/$(PACKAGE_NAME)/
200+
cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz dist/simple-index/$(PACKAGE_NAME)/
201+
190202
# Build the HTML and Markdown documentation from the package's source.
191203
DOCS_SOURCE := $(shell git ls-files docs/source)
192204
.PHONY: docs docs-html docs-md

0 commit comments

Comments
 (0)