diff --git a/MANIFEST.in b/MANIFEST.in index bafcaa2..1ae2c64 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,6 +5,7 @@ include mit.LICENSE include setup.py include setup.cfg include README.rst +include Makefile include MANIFEST.in include CHANGELOG.rst include CONTRIBUTING.rst diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d4ef663 --- /dev/null +++ b/Makefile @@ -0,0 +1,54 @@ +# Copyright (c) the purl authors +# SPDX-License-Identifier: MIT +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# Visit https://github.com/package-url/packageurl-python for support and +# download. + +# Python version can be specified with `$ PYTHON_EXE=python3.x make conf` +PYTHON_EXE?=python3 +ACTIVATE?=. bin/activate; +VIRTUALENV_PYZ=thirdparty/virtualenv.pyz +BLACK_ARGS=--exclude=".cache|migrations|data|lib|bin|var" + +virtualenv: + @echo "-> Bootstrap the virtualenv with PYTHON_EXE=${PYTHON_EXE}" + @${PYTHON_EXE} ${VIRTUALENV_PYZ} --never-download --no-periodic-update . + +conf: virtualenv + @echo "-> Install dependencies" + @${ACTIVATE} pip install -e . + +dev: virtualenv + @echo "-> Configure and install development dependencies" + @${ACTIVATE} pip install -e .[test] + +clean: + @echo "-> Clean the Python env" + rm -rf bin/ lib*/ include/ build/ dist/ .*cache/ pip-selfcheck.json pyvenv.cfg + find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ \ + -delete -type d -name '*.egg-info' -delete + +test: + @echo "-> Run the test suite" + ${MANAGE} test --noinput + bin/py.test tests + +.PHONY: virtualenv conf dev clean test diff --git a/README.rst b/README.rst index bbba949..8d86d17 100644 --- a/README.rst +++ b/README.rst @@ -49,12 +49,14 @@ Utilities Django models ^^^^^^^^^^^^^ -`packageurl.contrib.django.models.PackageURLMixin` is a Django abstract model mixin to use Package URLs in Django. +`packageurl.contrib.django.models.PackageURLMixin` is a Django abstract model mixin to +use Package URLs in Django. SQLAlchemy mixin ^^^^^^^^^^^^^^^^ -`packageurl.contrib.sqlalchemy.mixin.PackageURLMixin` is a SQLAlchemy declarative mixin to use Package URLs in SQLAlchemy models. +`packageurl.contrib.sqlalchemy.mixin.PackageURLMixin` is a SQLAlchemy declarative mixin +to use Package URLs in SQLAlchemy models. URL to PURL ^^^^^^^^^^^ @@ -70,9 +72,12 @@ URL to PURL PURL to URL ^^^^^^^^^^^ -- `packageurl.contrib.purl2url.get_repo_url(purl)` returns a repository URL inferred from a Package URL. -- `packageurl.contrib.purl2url.get_download_url(purl)` returns a download URL inferred from a Package URL. -- `packageurl.contrib.purl2url.get_inferred_urls(purl)` return all inferred URLs (repository, download) from a Package URL. +- `packageurl.contrib.purl2url.get_repo_url(purl)` returns a repository URL inferred + from a Package URL. +- `packageurl.contrib.purl2url.get_download_url(purl)` returns a download URL inferred + from a Package URL. +- `packageurl.contrib.purl2url.get_inferred_urls(purl)` return all inferred URLs + (repository, download) from a Package URL. ::