diff --git a/Makefile b/Makefile index 061534ff..581903e6 100644 --- a/Makefile +++ b/Makefile @@ -187,6 +187,19 @@ dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-docs-md.zip: docs-md dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-build-epoch.txt: echo $(SOURCE_DATE_EPOCH) > dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-build-epoch.txt +# Build a PEP-503 compatible Simple Repository directory inside of dist/. For details on +# the layout of that directory and the normalized project name, see: https://peps.python.org/pep-0503/ +# The directory can then be used to install (hashed) artifacts by using `pip` and +# its `--extra-index-url` argument: https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-extra-index-url +PROJECT_NAME := $(shell python -c $$'import re; print(re.sub(r"[-_.]+", "-", "$(PACKAGE_NAME)").lower());') +.PHONY: simple-index +simple-index: dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz + mkdir -p dist/simple-index/$(PROJECT_NAME) + echo -e "\nSimple Index$(PACKAGE_NAME)" > dist/simple-index/index.html + echo -e "\nSimple Index: $(PROJECT_NAME)$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" > dist/simple-index/$(PROJECT_NAME)/index.html + cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/simple-index/$(PROJECT_NAME)/ + cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz dist/simple-index/$(PROJECT_NAME)/ + # Build the HTML and Markdown documentation from the package's source. DOCS_SOURCE := $(shell git ls-files docs/source) .PHONY: docs docs-html docs-md