From 620aad11515e1fb8d71ce201198a5c82919593be Mon Sep 17 00:00:00 2001 From: eabdullin Date: Mon, 23 Oct 2023 07:48:27 +0000 Subject: [PATCH] import CS python-tomli-1.2.3-4.el8 --- .gitignore | 2 +- .python-tomli.metadata | 2 +- ...-tmp_path-with-tmpdir-pytest-fixture.patch | 30 ++++++++ ...move_python-dateutil_test_dependency.patch | 72 +++++++++++++++++++ SOURCES/tomli-setup.py | 4 +- SPECS/python-tomli.spec | 42 +++++------ 6 files changed, 128 insertions(+), 24 deletions(-) create mode 100644 SOURCES/0001-tests-Replace-tmp_path-with-tmpdir-pytest-fixture.patch create mode 100644 SOURCES/Remove_python-dateutil_test_dependency.patch diff --git a/.gitignore b/.gitignore index 0f0404d..0247dec 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/python-tomli-2.0.1.tar.gz +SOURCES/python-tomli-1.2.3.tar.gz diff --git a/.python-tomli.metadata b/.python-tomli.metadata index a68f1db..61697dd 100644 --- a/.python-tomli.metadata +++ b/.python-tomli.metadata @@ -1 +1 @@ -234c9caf7ba15e7892a0ae3ed1f0381d9fb5e61c SOURCES/python-tomli-2.0.1.tar.gz +73c33785ba32c4653869d370621878185c36598c SOURCES/python-tomli-1.2.3.tar.gz diff --git a/SOURCES/0001-tests-Replace-tmp_path-with-tmpdir-pytest-fixture.patch b/SOURCES/0001-tests-Replace-tmp_path-with-tmpdir-pytest-fixture.patch new file mode 100644 index 0000000..1a9290f --- /dev/null +++ b/SOURCES/0001-tests-Replace-tmp_path-with-tmpdir-pytest-fixture.patch @@ -0,0 +1,30 @@ +From 03f6ef8f3e40c3088a22afde5eec50ffa9f21cfd Mon Sep 17 00:00:00 2001 +From: Maxwell G +Date: Thu, 6 Oct 2022 23:18:34 -0500 +Subject: [PATCH] tests: Replace tmp_path with tmpdir pytest fixture + +RHEL 8's pytest is too old and does not support the tmp_path filter. +--- + tests/test_misc.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/test_misc.py b/tests/test_misc.py +index 2eec882..ece225f 100644 +--- a/tests/test_misc.py ++++ b/tests/test_misc.py +@@ -8,10 +8,10 @@ import pytest + import tomli + + +-def test_load(tmp_path): ++def test_load(tmpdir): + content = "one=1 \n two='two' \n arr=[]" + expected = {"one": 1, "two": "two", "arr": []} +- file_path = tmp_path / "test.toml" ++ file_path = Path(tmpdir) / "test.toml" + file_path.write_text(content) + + # Test text mode +-- +2.37.3 + diff --git a/SOURCES/Remove_python-dateutil_test_dependency.patch b/SOURCES/Remove_python-dateutil_test_dependency.patch new file mode 100644 index 0000000..be6e423 --- /dev/null +++ b/SOURCES/Remove_python-dateutil_test_dependency.patch @@ -0,0 +1,72 @@ +From a54d95e47fd603718dc506dcfce0cfa519248292 Mon Sep 17 00:00:00 2001 +From: Taneli Hukkinen <3275109+hukkin@users.noreply.github.com> +Date: Mon, 3 Jan 2022 04:29:16 +0200 +Subject: [PATCH] Remove python-dateutil test dependency (#158) + +--- + .pre-commit-config.yaml | 1 - + tests/burntsushi.py | 23 +++++++++++++++++++++-- + tests/requirements.txt | 1 - + 3 files changed, 21 insertions(+), 4 deletions(-) + +diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml +index e50d256..a139350 100644 +--- a/.pre-commit-config.yaml ++++ b/.pre-commit-config.yaml +@@ -51,5 +51,4 @@ repos: + - id: mypy + args: ["--scripts-are-modules"] + additional_dependencies: +- - types-python-dateutil + - pytest +diff --git a/tests/burntsushi.py b/tests/burntsushi.py +index 54087cb..44cea5b 100644 +--- a/tests/burntsushi.py ++++ b/tests/burntsushi.py +@@ -3,7 +3,6 @@ + import datetime + from typing import Any + +-import dateutil.parser + import pytest + + +@@ -66,7 +65,27 @@ def normalize(d: dict) -> dict: + + + def normalize_datetime_str(dt_str: str) -> str: +- return dateutil.parser.isoparse(dt_str).isoformat() ++ if dt_str[-1].lower() == "z": ++ dt_str = dt_str[:-1] + "+00:00" ++ ++ date = dt_str[:10] ++ rest = dt_str[11:] ++ ++ if "+" in rest: ++ sign = "+" ++ elif "-" in rest: ++ sign = "-" ++ else: ++ sign = "" ++ ++ if sign: ++ time, _, offset = rest.partition(sign) ++ else: ++ time = rest ++ offset = "" ++ ++ time = time.rstrip("0") if "." in time else time ++ return date + "T" + time + sign + offset + + + def normalize_float_str(float_str: str) -> str: +diff --git a/tests/requirements.txt b/tests/requirements.txt +index ce5780e..c34e694 100644 +--- a/tests/requirements.txt ++++ b/tests/requirements.txt +@@ -1,5 +1,4 @@ + pytest + pytest-randomly + pytest-cov >=2.12.1 +-python-dateutil + coverage !=6.0 diff --git a/SOURCES/tomli-setup.py b/SOURCES/tomli-setup.py index 5dd3968..6aa25a0 100644 --- a/SOURCES/tomli-setup.py +++ b/SOURCES/tomli-setup.py @@ -8,9 +8,8 @@ setup( long_description=pathlib.Path("README.md").read_text(), long_description_content_type="text/markdown", packages=["tomli"], - package_dir={"": "src"}, package_data={"tomli": ["py.typed"]}, - python_requires=">=3.7", + python_requires=">=3.6", author="Taneli Hukkinen", author_email="hukkin@users.noreply.github.com", license="MIT", @@ -20,6 +19,7 @@ setup( "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", diff --git a/SPECS/python-tomli.spec b/SPECS/python-tomli.spec index d5248b3..9e9d509 100644 --- a/SPECS/python-tomli.spec +++ b/SPECS/python-tomli.spec @@ -1,22 +1,29 @@ Name: python-tomli -Version: 2.0.1 -Release: 5%{?dist} +Version: 1.2.3 +Release: 4%{?dist} Summary: A little TOML parser for Python License: MIT URL: https://pypi.org/project/tomli/ -Source0: https://github.com/hukkin/tomli/archive/%{version}/%{name}-%{version}.tar.gz +%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 9. +# 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 +# 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. +# This upstream change removes that test dependency entirely. +Patch1: %{forgeurl}/commit/a54d95e.patch#/Remove_python-dateutil_test_dependency.patch + BuildArch: noarch BuildRequires: python3-devel +BuildRequires: python3-setuptools -# The test suite uses the stdlib's unittest framework, but we use %%pytest -# as the test runner. +# Upstream test requirements are in tests/requirements.txt BuildRequires: python3-pytest %global _description %{expand: @@ -35,38 +42,33 @@ Summary: %{summary} %prep %autosetup -p1 -n tomli-%{version} sed 's/@@VERSION@@/%{version}/' %{SOURCE1} > setup.py -rm pyproject.toml # force the PEP 517 fallback build backend (setuptools) - - -%generate_buildrequires -%pyproject_buildrequires -r %build -%pyproject_wheel +%py3_build %install -%pyproject_install -%pyproject_save_files tomli +%py3_install %check -%py3_check_import tomli %pytest -%files -n python3-tomli -f %{pyproject_files} +%files -n python3-tomli %doc README.md %doc CHANGELOG.md +%license LICENSE +%{python3_sitelib}/tomli/ +%{python3_sitelib}/tomli-%{version}-py%{python3_version}.egg-info/ %changelog -* Wed Mar 08 2023 Miro Hrončok - 2.0.1-5 -- Initial package for RHEL 9 -- Resolves: rhbz#2175213 +* Wed Mar 08 2023 Miro Hrončok - 1.2.3-4 +- Initial package for RHEL 8 +- Resolves: rhbz#2175215 - Fedora+EPEL contributions by: Maxwell G - Michel Alexandre Salim Miro Hrončok Petr Viktorin