aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo-Chuan Hsieh <sunpoet@FreeBSD.org>2023-03-21 18:44:02 +0000
committerPo-Chuan Hsieh <sunpoet@FreeBSD.org>2023-03-21 19:20:40 +0000
commit3911e01f5b28619bf23e61f1a7c4ab0af8260849 (patch)
tree70813d86c348aa8956725b78881a3920b0a7531f
parenta2ee9608c313978137291dfb8090a265322a6368 (diff)
downloadports-3911e01f5b28619bf23e61f1a7c4ab0af8260849.tar.gz
ports-3911e01f5b28619bf23e61f1a7c4ab0af8260849.zip
devel/py-hatch-vcs: Convert to USE_PYTHON=pep517
- Bump PORTREVISION for dependency and package change
-rw-r--r--devel/py-hatch-vcs/Makefile8
-rw-r--r--devel/py-hatch-vcs/files/setup.py33
2 files changed, 3 insertions, 38 deletions
diff --git a/devel/py-hatch-vcs/Makefile b/devel/py-hatch-vcs/Makefile
index 90d49b21dc32..899a7b35f6cb 100644
--- a/devel/py-hatch-vcs/Makefile
+++ b/devel/py-hatch-vcs/Makefile
@@ -1,5 +1,6 @@
PORTNAME= hatch-vcs
PORTVERSION= 0.3.0
+PORTREVISION= 1
CATEGORIES= devel python
MASTER_SITES= PYPI
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@@ -12,18 +13,15 @@ WWW= https://github.com/ofek/hatch-vcs
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE.txt
+BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}hatchling>=1.1.0:devel/py-hatchling@${PY_FLAVOR}
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}hatchling>=1.1.0:devel/py-hatchling@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}setuptools_scm>=6.4.0:devel/py-setuptools_scm@${PY_FLAVOR}
TEST_DEPENDS= git:devel/git
USES= python:3.7+
-USE_PYTHON= autoplist concurrent distutils pytest
+USE_PYTHON= autoplist concurrent pep517 pytest
NO_ARCH= yes
TEST_ENV= PYTHONPATH=${STAGEDIR}${PYTHON_SITELIBDIR}
-post-patch:
- @${RM} ${WRKSRC}/pyproject.toml
- @${SED} -e 's|%%PORTVERSION%%|${PORTVERSION}|' ${FILESDIR}/setup.py > ${WRKSRC}/setup.py
-
.include <bsd.port.mk>
diff --git a/devel/py-hatch-vcs/files/setup.py b/devel/py-hatch-vcs/files/setup.py
deleted file mode 100644
index e3edabf836c6..000000000000
--- a/devel/py-hatch-vcs/files/setup.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-from setuptools import setup
-
-setup(
- name='hatch-vcs',
- version='%%PORTVERSION%%',
- description='Hatch plugin for versioning with your preferred VCS',
- long_description='# hatch-vcs\n\n| | |\n| --- | --- |\n| CI/CD | [![CI - Test](https://github.com/ofek/hatch-vcs/actions/workflows/test.yml/badge.svg)](https://github.com/ofek/hatch-vcs/actions/workflows/test.yml) [![CD - Build](https://github.com/ofek/hatch-vcs/actions/workflows/build.yml/badge.svg)](https://github.com/ofek/hatch-vcs/actions/workflows/build.yml) |\n| Package | [![PyPI - Version](https://img.shields.io/pypi/v/hatch-vcs.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.org/project/hatch-vcs/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hatch-vcs.svg?logo=python&label=Python&logoColor=gold)](https://pypi.org/project/hatch-vcs/) |\n| Meta | [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![code style - black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/ambv/black) [![License - MIT](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://spdx.org/licenses/) [![GitHub Sponsors](https://img.shields.io/github/sponsors/ofek?logo=GitHub%20Sponsors&style=social)](https://github.com/sponsors/ofek) |\n\n-----\n\nThis provides a plugin for [Hatch](https://github.com/pypa/hatch) that uses your preferred version control system (like Git) to determine project versions.\n\n**Table of Contents**\n\n- [Global dependency](#global-dependency)\n- [Version source](#version-source)\n - [Version source options](#version-source-options)\n - [Version source environment variables](#version-source-environment-variables)\n- [Build hook](#build-hook)\n - [Build hook options](#build-hook-options)\n - [Editable installs](#editable-installs)\n- [Metadata hook](#metadata-hook)\n - [Metadata hook options](#metadata-hook-options)\n - [URLs](#urls)\n - [Example](#example)\n- [License](#license)\n\n## Global dependency\n\nEnsure `hatch-vcs` is defined within the `build-system.requires` field in your `pyproject.toml` file.\n\n```toml\n[build-system]\nrequires = ["hatchling", "hatch-vcs"]\nbuild-backend = "hatchling.build"\n```\n\n## Version source\n\nThe [version source plugin](https://hatch.pypa.io/latest/plugins/version-source/reference/) name is `vcs`.\n\n- ***pyproject.toml***\n\n ```toml\n [tool.hatch.version]\n source = "vcs"\n ```\n\n- ***hatch.toml***\n\n ```toml\n [version]\n source = "vcs"\n ```\n\n### Version source options\n\n| Option | Type | Default | Description |\n| --- | --- | --- | --- |\n| `tag-pattern` | `str` | see [code](https://github.com/pypa/setuptools_scm/blob/v6.4.0/src/setuptools_scm/config.py#L13) | A regular expression used to extract the version part from VCS tags. The pattern needs to contain either a single match group, or a group named `version`, that captures the actual version information. |\n| `fallback-version` | `str` | | The version that will be used if no other method for detecting the version is successful. If not specified, unsuccessful version detection will raise an error. |\n| `raw-options` | `dict` | | A table of [`setuptools-scm` parameters](https://github.com/pypa/setuptools_scm#configuration-parameters) that will override any of the options listed above. The `write_to` and `write_to_template` parameters are ignored. |\n\n### Version source environment variables\n\n- `SETUPTOOLS_SCM_PRETEND_VERSION`: When defined and not empty, it\'s used as the primary source for the version, in which case it will be an unparsed string.\n\n## Build hook\n\nThe [build hook plugin](https://hatch.pypa.io/latest/plugins/build-hook/reference/) name is `vcs`.\n\n- ***pyproject.toml***\n\n ```toml\n [tool.hatch.build.hooks.vcs]\n version-file = "_version.py"\n ```\n\n- ***hatch.toml***\n\n ```toml\n [build.hooks.vcs]\n version-file = "_version.py"\n ```\n\nBuilding or installing when the latest tag is ``v1.2.3`` will generate the file\n\n- ***_version.py***\n\n ```python\n # coding: utf-8\n # file generated by setuptools_scm\n # don\'t change, don\'t track in version control\n __version__ = version = \'1.2.3\'\n __version_tuple__ = version_tuple = (1, 2, 3)\n ```\n\n### Build hook options\n\n| Option | Type | Default | Description |\n| --- | --- | --- | --- |\n| `version-file` | `str` | ***REQUIRED*** | The relative path to the file that gets updated with the current version. |\n| `template` | `str` | | The template used to overwrite the `version-file`. See the [code](https://github.com/pypa/setuptools_scm/blob/v6.4.0/src/setuptools_scm/__init__.py#L30-L39) for the default template for each file extension. |\n\n### Editable installs\n\nThe version file is only updated upon install or build. Thus the version number in an [editable install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs) (Hatch\'s [dev mode](https://hatch.pypa.io/latest/config/build/#dev-mode)) will be incorrect if the version changes and the project is not rebuilt. An unsupported workaround for keeping the version number up-to-date can be found at [hatch-vcs-footgun-example](https://github.com/maresb/hatch-vcs-footgun-example).\n\n## Metadata hook\n\n**Note:** only Git is supported\n\nThe [metadata hook plugin](https://hatch.pypa.io/latest/plugins/metadata-hook/reference/) name is `vcs`.\n\n- ***pyproject.toml***\n\n ```toml\n [tool.hatch.metadata.hooks.vcs]\n ```\n\n- ***hatch.toml***\n\n ```toml\n [metadata.hooks.vcs]\n ```\n\n### Metadata hook options\n\n#### URLs\n\nThe `urls` option is equivalent to [`project.urls`](https://hatch.pypa.io/latest/config/metadata/#urls) except that each URL supports [context formatting](https://hatch.pypa.io/latest/config/context/) with the following fields:\n\n- `commit_hash` - the latest commit hash\n\n### Example\n\n- ***pyproject.toml***\n\n ```toml\n [tool.hatch.metadata.hooks.vcs]\n Homepage = "https://www.example.com"\n source_archive = "https://github.com/org/repo/archive/{commit_hash}.zip"\n ```\n\n- ***hatch.toml***\n\n ```toml\n [metadata.hooks.vcs]\n Homepage = "https://www.example.com"\n source_archive = "https://github.com/org/repo/archive/{commit_hash}.zip"\n ```\n\n## License\n\n`hatch-vcs` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n',
- author_email='Ofek Lev <oss@ofek.dev>',
- classifiers=[
- 'Development Status :: 4 - Beta',
- 'Programming Language :: Python',
- 'Programming Language :: Python :: 3.7',
- 'Programming Language :: Python :: 3.8',
- 'Programming Language :: Python :: 3.9',
- 'Programming Language :: Python :: 3.10',
- 'Programming Language :: Python :: 3.11',
- 'Programming Language :: Python :: Implementation :: CPython',
- 'Programming Language :: Python :: Implementation :: PyPy',
- ],
- install_requires=[
- 'hatchling>=1.1.0',
- 'setuptools-scm>=6.4.0',
- ],
- entry_points={
- 'hatch': [
- 'vcs = hatch_vcs.hooks',
- ],
- },
- packages=[
- 'hatch_vcs',
- ],
-)