#124 F33: Support PEP 517 list based backend-path
Merged 3 years ago by churchyard. Opened 3 years ago by churchyard.
rpms/ churchyard/pyproject-rpm-macros backend-path-list  into  f33

file modified
+34 -1
@@ -80,7 +80,7 @@ 

  For projects that specify test requirements using an [`extra`

  provide](https://packaging.python.org/specifications/core-metadata/#provides-extra-multiple-use),

  these can be added using the `-x` flag.

- Multiple extras can be supplied as a comma separated list.

+ Multiple extras can be supplied by repeating the flag or as a comma separated list.

  For example, if upstream suggests installing test dependencies with

  `pip install mypackage[testing]`, the test deps would be generated by:

  
@@ -211,6 +211,39 @@ 

  The warning is harmless.

  

  

+ Generating Extras subpackages

+ -----------------------------

+ 

+ The `%pyproject_extras_subpkg` macro generates simple subpackage(s)

+ for Python extras.

+ 

+ The macro should be placed after the base package's `%description` to avoid

+ issues in building the SRPM.

+ 

+ For example, if the `requests` project's metadata defines the extras

+ `security` and `socks`, the following invocation will generate the subpackage

+ `python3-requests+security` that provides `python3dist(requests[security])`,

+ and a similar one for `socks`.

+ 

+     %pyproject_extras_subpkg -n python3-requests security socks

+ 

+ The macro works like `%python_extras_subpkg`,

+ except the `-i`/`-f`/`-F` arguments are optional and discouraged.

+ A filelist written by `%pyproject_install` is used by default.

+ For more information on `%python_extras_subpkg`, see the [Fedora change].

+ 

+ [Fedora change]: https://fedoraproject.org/wiki/Changes/PythonExtras

+ 

+ These arguments are still required:

+ 

+ * -n: name of the “base” package (e.g. python3-requests)

+ * Positional arguments: the extra name(s).

+   Multiple subpackages are generated when multiple names are provided.

+ 

+ The macro does nothing on Fedora 32 and lower, as automation around

+ extras was only added in f33.

+ 

+ 

  Limitations

  -----------

  

file modified
+4 -1
@@ -6,7 +6,7 @@ 

  

  # Keep the version at zero and increment only release

  Version:        0

- Release:        30%{?dist}

+ Release:        31%{?dist}

  

  # Macro files

  Source001:      macros.pyproject
@@ -94,6 +94,9 @@ 

  %license LICENSE

  

  %changelog

+ * Mon Oct 05 2020 Miro Hrončok <mhroncok@redhat.com> - 0-31

+ - Support PEP 517 list based backend-path

+ 

  * Tue Sep 29 2020 Lumír Balhar <lbalhar@redhat.com> - 0-30

  - Process RECORD files in %%pyproject_install and remove them

  - Support the extras configuration option of tox in %%pyproject_buildrequires -t

file modified
+4 -1
@@ -185,7 +185,10 @@ 

  

      backend_path = buildsystem_data.get('backend-path')

      if backend_path:

-         sys.path.insert(0, backend_path)

+         # PEP 517 example shows the path as a list, but some projects don't follow that

+         if isinstance(backend_path, str):

+             backend_path = [backend_path]

+         sys.path = backend_path + sys.path

  

      module_name, _, object_name = backend_name.partition(":")

      backend_module = importlib.import_module(module_name)

@@ -0,0 +1,47 @@ 

+ Name:           python-flit-core

+ Version:        3.0.0

+ Release:        0%{?dist}

+ Summary:        Distribution-building parts of Flit

+ 

+ License:        BSD

+ URL:            https://pypi.org/project/flit-core/

+ Source0:        %{pypi_source flit_core}

+ 

+ BuildArch:      noarch

+ BuildRequires:  python3-devel

+ BuildRequires:  pyproject-rpm-macros

+ 

+ %description

+ Test a build with pyproject.toml backend-path = .

+ flit-core builds with flit-core.

+ 

+ 

+ %package -n python3-flit-core

+ Summary:        %{summary}

+ 

+ %description -n python3-flit-core

+ ...

+ 

+ 

+ %prep

+ %autosetup -p1 -n flit_core-%{version}

+ 

+ 

+ %generate_buildrequires

+ %pyproject_buildrequires

+ 

+ 

+ %build

+ %if 0%{?fedora} < 33 && 0%{?rhel} < 9

+ # the old pip version cannot handle backend-path properly, let's help it:

+ export PYTHONPATH=$PWD

+ %endif

+ %pyproject_wheel

+ 

+ 

+ %install

+ %pyproject_install

+ %pyproject_save_files flit_core

+ 

+ 

+ %files -n python3-flit-core -f %{pyproject_files}

@@ -0,0 +1,49 @@ 

+ Name:           python-poetry-core

+ Version:        1.0.0

+ Release:        0%{?dist}

+ Summary:        Poetry PEP 517 Build Backend

+ 

+ License:        MIT

+ URL:            https://pypi.org/project/poetry-core/

+ Source0:        %{pypi_source poetry-core}

+ 

+ BuildArch:      noarch

+ BuildRequires:  python3-devel

+ BuildRequires:  pyproject-rpm-macros

+ 

+ %description

+ Test a build with pyproject.toml backend-path = [.]

+ poetry-core builds with poetry-core.

+ 

+ 

+ %package -n python3-poetry-core

+ Summary:        %{summary}

+ 

+ %description -n python3-poetry-core

+ ...

+ 

+ 

+ %prep

+ %autosetup -p1 -n poetry-core-%{version}

+ 

+ 

+ %generate_buildrequires

+ %pyproject_buildrequires

+ 

+ 

+ %build

+ %if 0%{?fedora} < 33 && 0%{?rhel} < 9

+ # the old pip version cannot handle backend-path properly, let's help it:

+ export PYTHONPATH=$PWD

+ %endif

+ %pyproject_wheel

+ 

+ 

+ %install

+ %pyproject_install

+ %pyproject_save_files poetry

+ 

+ 

+ %files -n python3-poetry-core -f %{pyproject_files}

+ %doc README.md

+ %license LICENSE

file modified
+6
@@ -67,6 +67,12 @@ 

      - dns_lexicon:

          dir: .

          run: ./mocktest.sh python-dns-lexicon

+     - flit_core:

+         dir: .

+         run: ./mocktest.sh python-flit-core

+     - poetry_core:

+         dir: .

+         run: ./mocktest.sh python-poetry-core

      required_packages:

      - mock

      - rpmdevtools

no initial comment

1 new commit added

  • CI tests: Workaround old pip missing features in testing specs
3 years ago

Build failed.

Build succeeded.

Pull-Request has been merged by churchyard

3 years ago