diff --git a/doc/pyproject.md b/doc/pyproject.md index f86c2ba..fb35712 100644 --- a/doc/pyproject.md +++ b/doc/pyproject.md @@ -52,6 +52,11 @@ of your package to show on PyPI. This should be written in reStructuredText Markdown or plain text, and the filename should have the appropriate extension (`.rst`, `.md` or `.txt`). +### `download-url` + +A link to download the current version of the project. +The string `{version}` will be replaced with the built version. + ### `home-page` A string containing the URL for the package's home page. @@ -95,6 +100,18 @@ to set the python installation when using The name of the module, will use the meson project name if not specified +### `obsoletes` + +A list of PyPI packages that this project should not be installed concurrently with. + +``` toml + obsoletes = [ + "OtherProject", + "AnotherProject==3.4", + 'virtual_package; python_version >= "3.4"', + ] +``` + ### `pkg-info-file` Pass a PKG-INFO file direcly usable. @@ -119,6 +136,18 @@ project-urls = [ ] ``` +### `provides` + +A list of PyPI packages that this project provides its own version of. + +``` toml + provides = [ + "OtherProject", + "AnotherProject==3.4", + 'virtual_package; python_version >= "3.4"', + ] +``` + ### `requires` A list of other packages from PyPI that this package needs. Each package may @@ -133,6 +162,17 @@ after a semicolon. For example: ] ``` +### `requires-external` + +A list of non-PyPI dependency packages. For example: + +``` toml + requires-external = [ + "git", + "node", + ] +``` + ### `requires-python` A version specifier for the versions of Python this requires, e.g. ``~=3.3`` or diff --git a/meson.build b/meson.build index e0fa4d2..60353da 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('OZI.build', version : '1.2.4', license : 'apache-2.0') +project('OZI.build', version : '1.3.0', license : 'apache-2.0') fs = import('fs') python = import('python').find_installation() subdir('ozi_build') diff --git a/ozi_build/buildapi.py b/ozi_build/buildapi.py index eb9f9f6..521af18 100644 --- a/ozi_build/buildapi.py +++ b/ozi_build/buildapi.py @@ -86,7 +86,12 @@ def __init__(self, builddir=None): self.__entry_points = config['tool']['ozi-build'].get( 'entry-points', [] ) - self.__extras = config.get('project', {}).get('optional_dependencies', {}) + self.__extras = config.get('project', {}).get('optional_dependencies', None) + if self.__extras is not None: + log.warning('pyproject.toml:project.optional_dependencies should be renamed to pyproject.toml:project.optional-dependencies') + else: + self.__extras = config.get('project', {}).get('optional-dependencies', {}) + self.__requires = config.get('project', {}).get('dependencies', None) self.installed = [] self.options = [] self.builddir = None @@ -232,12 +237,27 @@ def get_metadata(self): if key in self: res += '{}: {}\n'.format(key.capitalize(), self[key]) + if 'download-url' in self: + if '{version}' in self['download-url']: + res += f'Download-URL: {self["download-url"].replace("{version}", self["version"])}\n' + else: + log.warning('pyproject.toml:tools.ozi-build.metadata.download-url missing {version} replace pattern') + res += f'Download-URL: {self["download-url"]}\n' + + if self.__requires: + for package in self.__requires: + res += 'Requires-Dist: {}\n'.format(package) + + if self.get('requires', None): + raise ValueError('pyproject.toml:tools.ozi-build.metadata.requires is deprecated as of OZI.build 1.3') + for key, mdata_key in [ - ('requires', 'Requires-Dist'), + ('provides', 'Provides-Dist'), + ('obsoletes', 'Obsoletes-Dist'), ('classifiers', 'Classifier'), ('project-urls', 'Project-URL'), + ('requires-external', 'Requires-External'), ]: - vals = self.get(key, []) for val in vals: res += '{}: {}\n'.format(mdata_key, val) diff --git a/ozi_build/schema.py b/ozi_build/schema.py index d37f614..31fa4b6 100644 --- a/ozi_build/schema.py +++ b/ozi_build/schema.py @@ -30,6 +30,9 @@ `http://www.example.com/~cschultz/bvote/`""" }, + "download-url": { + "description": """A string containing the URL for the package's source, will replace '{version}' with the current version.""" + }, "license": { "description": """Text indicating the license covering the distribution. This text can be either a valid license expression as defined in [pep639](https://www.python.org/dev/peps/pep-0639/#id88) or any free text.""" }, @@ -59,6 +62,17 @@ "module": { "description": "The name of the module, will use the meson project name if not specified" }, + "obsoletes": {"description": """ +A list of PyPI packages that this project should not be installed concurrently with. + +``` toml + obsoletes = [ + "OtherProject", + "AnotherProject==3.4", + 'virtual_package; python_version >= "3.4"', + ] +``` +"""}, "pkg-info-file": { "description": """Pass a PKG-INFO file direcly usable. @@ -80,6 +94,15 @@ ] ```""" }, + "provides": {"description": """A list of PyPI packages that this project provides its own version of. + +``` toml + provides = [ + "OtherProject", + "AnotherProject==3.4", + 'virtual_package; python_version >= "3.4"', + ] +```"""}, "requires": { "description": """A list of other packages from PyPI that this package needs. Each package may be followed by a version specifier like ``(>=4.1)`` or ``>=4.1``, and/or an @@ -93,6 +116,14 @@ ] ```""" }, + "requires-external": {"description": """A list of non-PyPI dependency packages. For example: + +``` toml + requires-external = [ + "git", + "node", + ] +```"""}, "requires-python": { "description": """A version specifier for the versions of Python this requires, e.g. ``~=3.3`` or ``>=3.3,<4`` which are equivalents.""" diff --git a/pyproject.toml b/pyproject.toml index a15bce5..ab89f12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,15 @@ requires = [ backend-path = [".", "ozi_build"] build-backend = "ozi_build.buildapi" -[project.optional_dependencies] +[project] +dynamic = ["version"] +dependencies = [ + "wheel>0.33", + "meson[ninja]>1.1.0", + 'tomli>=2.0.0;python_version<"3.11"', +] + +[project.optional-dependencies] # ozi-spec version 0.8 # core build dependencies core = [ @@ -21,14 +29,8 @@ uv = ["uv"] cython = ["cython~=3.0"] [tool.ozi-build.metadata] -meson-python-option-name="python_version" -author="Thibault Saunier" author-email="tsaunier@gnome.org" -maintainer="Eden Ross Duff MSc" -maintainer-email="help@oziproject.dev" -summary="Create pep517 compliant packages from the meson build system, OZI-maintained fork." -home-page="https://oziproject.dev" -description-file="README.rst" +author="Thibault Saunier" classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", @@ -38,14 +40,18 @@ classifiers = [ "Topic :: System :: Archiving :: Packaging", "Development Status :: 4 - Beta", ] -requires-python="py3-none" -requires = [ - "wheel>0.33", - "meson[ninja]>1.1.0", - 'tomli>=2.0.0;python_version<"3.11"', - "setuptools", -] +download-url="https://github.com/OZI-Project/OZI.build/archive/refs/tags/{version}" +description-file="README.rst" +home-page="https://oziproject.dev" +maintainer-email="help@oziproject.dev" +maintainer="Eden Ross Duff MSc" +meson-python-option-name="python_version" project-urls= [ "Source, https://github.com/OZI-Project/OZI.build", "Documentation, https://docs.oziproject.dev/en/stable/ozi_build.html", -] \ No newline at end of file +] +requires-python="py3-none" +summary="Create pep517 compliant packages from the meson build system, OZI-maintained fork." + +[tool.deptry.per_rule_ignores] +DEP002 = ["meson"]