#397 [F37] Use tomli for older Pythons, now when RHEL 9 has it
Merged a year ago by churchyard. Opened a year ago by churchyard.
rpms/ churchyard/pyproject-rpm-macros tomli-even-on-3.9  into  f37

file modified
+2 -2
@@ -159,9 +159,9 @@ 

  echo 'python%{python3_pkgversion}dist(packaging)'

  %{!-N:if [ -f pyproject.toml ]; then

    %["%{python3_pkgversion}" == "3"

-     ? "echo '(python%{python3_pkgversion}dist(toml) if python%{python3_pkgversion}-devel < 3.11)'"

+     ? "echo '(python%{python3_pkgversion}dist(tomli) if python%{python3_pkgversion}-devel < 3.11)'"

      : "%[v"%{python3_pkgversion}" < v"3.11"

-        ? "echo 'python%{python3_pkgversion}dist(toml)'"

+        ? "echo 'python%{python3_pkgversion}dist(tomli)'"

         : "true # will use tomllib, echo nothing"

      ]"

    ]

file modified
+6 -3
@@ -13,8 +13,8 @@ 

  #   Increment Y and reset Z when new macros or features are added

  #   Increment Z when this is a bugfix or a cosmetic change

  # Dropping support for EOL Fedoras is *not* considered a breaking change

- Version:        1.8.0

- Release:        2%{?dist}

+ Version:        1.8.1

+ Release:        1%{?dist}

  

  # Macro files

  Source001:      macros.pyproject
@@ -61,7 +61,7 @@ 

  BuildRequires:  python3dist(tox-current-env) >= 0.0.6

  %endif

  BuildRequires:  python3dist(wheel)

- BuildRequires:  (python3dist(toml) if python3-devel < 3.11)

+ BuildRequires:  (python3dist(tomli) if python3 < 3.11)

  %endif

  

  # We build on top of those:
@@ -161,6 +161,9 @@ 

  

  

  %changelog

+ * Wed May 31 2023 Miro Hrončok <mhroncok@redhat.com> - 1.8.1-1

+ - On Python older than 3.11, use tomli instead of deprecated toml

+ 

  * Tue May 23 2023 Miro Hrončok <mhroncok@redhat.com> - 1.8.0-2

  - Rebuilt for ELN dependency changes

  

file modified
+3 -7
@@ -202,19 +202,15 @@ 

  def toml_load(opened_binary_file):

      try:

          # tomllib is in the standard library since 3.11.0b1

-         import tomllib as toml_module

-         load_from = opened_binary_file

+         import tomllib

      except ImportError:

          try:

-             # note: we could use tomli here,

-             # but for backwards compatibility with RHEL 9, we use toml instead

-             import toml as toml_module

-             load_from = io.TextIOWrapper(opened_binary_file, encoding='utf-8')

+             import tomli as tomllib

          except ImportError as e:

              print_err('Import error:', e)

              # already echoed by the %pyproject_buildrequires macro

              sys.exit(0)

-     return toml_module.load(load_from)

+     return tomllib.load(opened_binary_file)

  

  

  def get_backend(requirements):

@@ -17,7 +17,7 @@ 

    installed:

      setuptools: 5

      wheel: 1

-     toml: 1

+     tomli: 1

    pyproject.toml: |

      # empty

    setup.py: |
@@ -42,7 +42,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

    include_runtime: false

    pyproject.toml: |

      # empty
@@ -58,7 +58,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

    setup.py: |

      # empty

    pyproject.toml: |
@@ -81,7 +81,7 @@ 

  

  Bad character in version:

    installed:

-     toml: 1

+     tomli: 1

    pyproject.toml: |

      [build-system]

      requires = ["pkg == 0.$.^.*"]
@@ -89,7 +89,7 @@ 

  

  Single value version with unsupported compatible operator:

    installed:

-     toml: 1

+     tomli: 1

    pyproject.toml: |

      [build-system]

      requires = ["pkg ~= 42", "foo"]
@@ -98,7 +98,7 @@ 

  

  Asterisk in version with unsupported compatible operator:

    installed:

-     toml: 1

+     tomli: 1

    pyproject.toml: |

      [build-system]

      requires = ["pkg ~= 0.1.*", "foo"]
@@ -107,7 +107,7 @@ 

  

  Local path as requirement:

    installed:

-     toml: 1

+     tomli: 1

    pyproject.toml: |

      [build-system]

      requires = ["./pkg-1.2.3.tar.gz", "foo"]
@@ -116,7 +116,7 @@ 

  

  Pip's egg=pkgName requirement not in requirements file:

    installed:

-     toml: 1

+     tomli: 1

    pyproject.toml: |

      [build-system]

      requires = ["git+https://github.com/monty/spam.git@master#egg=spam", "foo"]
@@ -125,7 +125,7 @@ 

  

  URL without egg fragment as requirement:

    installed:

-     toml: 1

+     tomli: 1

    pyproject.toml: |

      [build-system]

      requires = ["git+https://github.com/pkg-dev/pkg.git@96dbe5e3", "foo"]
@@ -137,7 +137,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

    pyproject.toml: |

      [build-system]

      requires = [
@@ -186,7 +186,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

    pyproject.toml: |

      [build-system]

      requires = [
@@ -654,7 +654,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

      lxml: 3.9

      ncclient: 1

      cryptography: 2
@@ -690,7 +690,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

      lxml: 3.9

      ncclient: 1

      cryptography: 2
@@ -801,7 +801,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

      cffi: 1.15.0rc2

    pyproject.toml: |

      [build-system]
@@ -841,7 +841,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

    pyproject.toml: |

      [build-system]

      requires = ["setuptools"]
@@ -864,7 +864,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

    extras:

      - tests

    pyproject.toml: |
@@ -893,7 +893,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

    extras:

      - dev  # this is deliberately sooner in the alphabet than the referenced ones

    pyproject.toml: |
@@ -926,7 +926,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

    extras:

      - xdev  # this is deliberately later in the alphabet than the referenced ones

    pyproject.toml: |
@@ -959,7 +959,7 @@ 

    installed:

      setuptools: 50

      wheel: 1

-     toml: 1

+     tomli: 1

    extras:

      - start

    pyproject.toml: |

no initial comment

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/b4a4e68a3cf746b6b751e97beb1f0cec

2 new commits added

  • Fix the conditional tests-related BuildRequires for Python version
  • Use tomli for older Pythons, now when RHEL 9 has it
a year ago

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/cddbbb3b6d0e41309b5c08c9c276b42e

Pull-Request has been merged by churchyard

a year ago