#22 [DO NOT MERGE] Initial package for RHEL 8
Closed 6 months ago by churchyard. Opened 6 months ago by churchyard.
rpms/ churchyard/python-tomli rhel8  into  epel8

file added
+1
@@ -0,0 +1,1 @@ 

+ 1

file added
+7
@@ -0,0 +1,7 @@ 

+ --- !Policy

+ 

+ product_versions:

+   - rhel-8

+ decision_context: osci_compose_gate

+ rules:

+   - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

file added
+11
@@ -0,0 +1,11 @@ 

+ discover:

+   - name: Smoke-tests

+     how: shell

+     tests:

+     - name: python-import-test

+       test: python3 -c 'import tomli'

+       require:

+       - python3-tomli

+       duration: 2m

+ execute:

+   how: tmt

file modified
+21 -68
@@ -1,18 +1,18 @@ 

- # This package buildrequires flit_core to build the wheel, but flit_core requires tomli.

- # To bootstrap, we copy the files to appropriate locations manually and create a minimal dist-info metadata.

- # Note that as a pure Python package, the wheel contains no pre-built binary stuff.

- # When bootstrap is enabled, we don't run tests either, just an import check.

- %bcond_with     bootstrap

- 

  Name:           python-tomli

  Version:        1.2.3

- Release:        3%{?dist}

+ Release:        4%{?dist}

If the package was never introduced to RHEL8, I'd change the release to 1.

  Summary:        A little TOML parser for Python

  

  License:        MIT

  URL:            https://pypi.org/project/tomli/

  %global forgeurl https://github.com/hukkin/tomli

  Source0:        %{forgeurl}/archive/%{version}/%{name}-%{version}.tar.gz

+ 

+ # Upstream tomli uses flit, but we want to use setuptools on RHEL 8.

+ # This a downstream-only setup.py manually created from pyproject.toml metadata.

+ # It contains a @@VERSION@@ placeholder.

+ Source1:        tomli-setup.py

Same comment as RHEL9.

+ 

  # RHEL 8's pytest is too old and does not support the tmp_path filter.

  Patch0:         0001-tests-Replace-tmp_path-with-tmpdir-pytest-fixture.patch

  # RHEL 8's old dateutil is missing parser.isoparse.
@@ -21,15 +21,10 @@ 

  

  BuildArch:      noarch

  BuildRequires:  python3-devel

- # pip is needed for %%py3_install_wheel

- BuildRequires:  python3-pip

+ BuildRequires:  python3-setuptools

  

- %if %{without bootstrap}

- BuildRequires:  python3-flit-core

- # Upstream test requirements are in tests/requirements.txt,

- # but they're mixed together with coverage ones. Tests only need:

+ # Upstream test requirements are in tests/requirements.txt

  BuildRequires:  python3-pytest

- %endif

  

  %global _description %{expand:

  Tomli is a Python library for parsing TOML.
@@ -46,39 +41,19 @@ 

  

  %prep

  %autosetup -p1 -n tomli-%{version}

+ sed 's/@@VERSION@@/%{version}/' %{SOURCE1} > setup.py

+ 

  

  %build

- %if %{without bootstrap}

- %{python3} -m flit_core.wheel

- %else

- %global distinfo tomli-%{version}+rpmbootstrap.dist-info

- mkdir %{distinfo}

- cat > %{distinfo}/METADATA << EOF

- Metadata-Version: 2.2

- Name: tomli

- Version: %{version}+rpmbootstrap

- EOF

- %endif

+ %py3_build

  

  

  %install

- %if %{without bootstrap}

- %py3_install_wheel tomli-%{version}-py3-none-any.whl

- %else

- mkdir -p %{buildroot}%{python3_sitelib}

- cp -a tomli %{distinfo} %{buildroot}%{python3_sitelib}

- %endif

+ %py3_install

  

  

  %check

- %py3_check_import tomli

- %if %{without bootstrap}

- # assert the properly built package has no runtime requires

- # if it does, we need to change the bootstrap metadata

- test -f %{buildroot}%{python3_sitelib}/tomli-%{version}.dist-info/METADATA

- grep '^Requires-Dist:' %{buildroot}%{python3_sitelib}/tomli-%{version}.dist-info/METADATA && exit 1 || true

  %pytest

- %endif

  

  

  %files -n python3-tomli
@@ -86,36 +61,14 @@ 

  %doc CHANGELOG.md

  %license LICENSE

  %{python3_sitelib}/tomli/

- %{python3_sitelib}/tomli-%{version}%{?with_bootstrap:+rpmbootstrap}.dist-info/

+ %{python3_sitelib}/tomli-%{version}-py%{python3_version}.egg-info/

  

  

  %changelog

- * Sat Nov 12 2022 Maxwell G <gotmax@e.email> - 1.2.3-3

- - Add missing build dependency on python3-pip

- 

- * Tue Oct 11 2022 Maxwell G <gotmax@e.email> - 1.2.3-2

- - Initial EPEL 8 build (rhbz#2133112).

- 

- * Wed Feb 02 2022 Petr Viktorin <pviktori@redhat.com> - 1.2.3-1

- - Update to 1.2.3

-   - Allow lower case "t" and "z" in datetimes

- 

- * Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.2-3

- - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

- 

- * Fri Oct 29 2021 Miro Hrončok <mhroncok@redhat.com> - 1.2.2-2

- - Allow a bootstrap build without flit_core

- 

- * Wed Oct 27 2021 Petr Viktorin <pviktori@redhat.com> - 1.2.2-1

- - Update to version 1.2.2

- 

- * Wed Aug 18 2021 Petr Viktorin <pviktori@redhat.com> - 1.2.1-1

- - Update to version 1.2.1

-   - loading text (as opposed to binary) files is deprecated

- 

- * Thu Jul 29 2021 Petr Viktorin <pviktori@redhat.com> - 1.1.0-1

- - Update to version 1.1.0

-   - `load` can now take a binary file object

- 

- * Thu Jul 22 2021 Petr Viktorin <pviktori@redhat.com> - 1.0.4-1

- - Initial package

+ * Wed Mar 08 2023 Miro Hrončok <mhroncok@redhat.com> - 1.2.3-4

+ - Initial package for RHEL 8

+ - Resolves: rhbz#2175215

+ - Fedora+EPEL contributions by:

+       Maxwell G <gotmax@e.email>

+       Miro Hrončok <miro@hroncok.cz>

+       Petr Viktorin <pviktori@redhat.com>

file added
+37
@@ -0,0 +1,37 @@ 

+ import pathlib

+ from setuptools import setup

+ 

+ setup(

+     name="tomli",

+     version="@@VERSION@@",

+     description="A lil' TOML parser",

+     long_description=pathlib.Path("README.md").read_text(),

+     long_description_content_type="text/markdown",

+     packages=["tomli"],

+     package_data={"tomli": ["py.typed"]},

+     python_requires=">=3.6",

+     author="Taneli Hukkinen",

+     author_email="hukkin@users.noreply.github.com",

+     license="MIT",

+     classifiers=[

+         "License :: OSI Approved :: MIT License",

+         "Operating System :: MacOS",

+         "Operating System :: Microsoft :: Windows",

+         "Operating System :: POSIX :: Linux",

+         "Programming Language :: Python :: 3 :: Only",

+         "Programming Language :: Python :: 3.6",

+         "Programming Language :: Python :: 3.7",

+         "Programming Language :: Python :: 3.8",

+         "Programming Language :: Python :: 3.9",

+         "Programming Language :: Python :: 3.10",

+         "Programming Language :: Python :: Implementation :: CPython",

+         "Programming Language :: Python :: Implementation :: PyPy",

+         "Topic :: Software Development :: Libraries :: Python Modules",

+         "Typing :: Typed",

+     ],

+     keywords=["toml"],

+     project_urls={

+         "Homepage": "https://github.com/hukkin/tomli",

+         "Changelog": "https://github.com/hukkin/tomli/blob/master/CHANGELOG.md",

+     },

+ )

no initial comment

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

rpminspect says:

/usr/lib/python3.6/site-packages/tomli/py.typed removed from noarch

Will make sure it's added.

1 new commit added

  • fixup! Initial package for RHEL 8
6 months ago

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

Thanks for working on this!

+# Upstream tomli uses flit, but we want to use setuptools on RHEL 9.
+# This a downstream-only setup.py manually created from pyproject.toml metadata.
+# It contains the version, so the filename deliberately contains it as well.
+Source1:        tomli-%{version}-setup.py

I guess RHEL doesn't do rebases often, but I don't particularly like this approach. Having %{version} here makes git diffs harder to read, and in general, makes rebases more difficult. I would prefer using a @@VERSION@@ placeholder than be replaced with sed or %writevars. If you insist on doing this manually, I'd prefer to keep the file name the same and have a grep %{version} %{SOURCE1} in %prep to make sure it's updated. Consider this a suggestion and not a blocker.

Also, if your goal is to exactly reproduce the metadata in the setup.py, note that requires-python and urls are missing.

+%{?python_provide:%python_provide python3-tomli}

Why is this here?

I guess RHEL doesn't do rebases often, but I don't particularly like this approach. Having %{version} here makes git diffs harder to read, and in general, makes rebases more difficult. I would prefer using a @@VERSION@@ placeholder than be replaced with sed or %writevars. If you insist on doing this manually, I'd prefer to keep the file name the same and have a grep %{version} %{SOURCE1} in %prep to make sure it's updated. Consider this a suggestion and not a blocker.

I thought about that approach as well. Exactly because we don't rebase, I considered that not important. But I guess it could make the diffs easier.

Also, if your goal is to exactly reproduce the metadata in the setup.py, note that requires-python and urls are missing.

I considered requires-python useless in our context and I forgot the URLs. Will add them.

+%{?python_provide:%python_provide python3-tomli}

Why is this here?

I wrongly assumed this is a must on pure RHEL 8, but it makes no difference, so I'll get rid fo it.


Thanks for the feedback.

1 new commit added

  • fixup! Initial package for RHEL 8
6 months ago

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

rebased onto f76e2c110f2b4b79522ec12a0ccb5a86bd92fb51

6 months ago

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

If the package was never introduced to RHEL8, I'd change the release to 1.

The version placeholder is missing here.

Same comment as RHEL9.

If the package was never introduced to RHEL8, I'd change the release to 1.

The package was in EPEL 8 and we want o maintain an upgrade path, so it needs to be greater than 3.

The version placeholder is missing here.

Weird. I am pretty sure it was there. Will re-add it.

Same comment as RHEL9.

(Answered there.)

1 new commit added

  • fixup! Initial package for RHEL 8
6 months ago

rebased onto 3b2bfb3

6 months ago

Placeholder added in fixup.

Squashed.

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

If the package was never introduced to RHEL8, I'd change the release to 1.
The package was in EPEL 8 and we want o maintain an upgrade path, so it needs to be greater than 3.

I'd even set it to 5 or 6 to in case we need to fix some packaging bug in EPEL.


Anyways, this LGTM. Thanks for posting it for review and involving the existing EPEL maintainers :).

I'd even set it to 5 or 6 to in case we need to fix some packaging bug in EPEL.

If that happens, a microbump an be used.

Pull-Request has been closed by churchyard

6 months ago