Skip to content

Commit

Permalink
OZI.build 1.3.0
Browse files Browse the repository at this point in the history
changes target the 1.20 release of OZI and spec version 0.9
add the remaining metadata keys and deprecate ``requires``

Signed-off-by: rjdbcm <[email protected]>
  • Loading branch information
rjdbcm committed Aug 26, 2024
1 parent db4f98b commit de14c71
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 20 deletions.
40 changes: 40 additions & 0 deletions doc/pyproject.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
26 changes: 23 additions & 3 deletions ozi_build/buildapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
31 changes: 31 additions & 0 deletions ozi_build/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
},
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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."""
Expand Down
38 changes: 22 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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="[email protected]"
maintainer="Eden Ross Duff MSc"
maintainer-email="[email protected]"
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",
Expand All @@ -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="[email protected]"
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",
]
]
requires-python="py3-none"
summary="Create pep517 compliant packages from the meson build system, OZI-maintained fork."

[tool.deptry.per_rule_ignores]
DEP002 = ["meson"]

0 comments on commit de14c71

Please sign in to comment.