Skip to content

Commit

Permalink
Add a Makefile to simplify setup
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <tdruez@nexb.com>
  • Loading branch information
tdruez committed Dec 8, 2023
1 parent 81a1665 commit 832eeff
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 5 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
15 changes: 10 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^^^^^
Expand All @@ -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.

::

Expand Down

0 comments on commit 832eeff

Please sign in to comment.