Compare commits

..

No commits in common. "c8-beta" and "c9-beta" have entirely different histories.

6 changed files with 24 additions and 128 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/python-tomli-1.2.3.tar.gz
SOURCES/python-tomli-2.0.1.tar.gz

View File

@ -1 +1 @@
73c33785ba32c4653869d370621878185c36598c SOURCES/python-tomli-1.2.3.tar.gz
234c9caf7ba15e7892a0ae3ed1f0381d9fb5e61c SOURCES/python-tomli-2.0.1.tar.gz

View File

@ -1,30 +0,0 @@
From 03f6ef8f3e40c3088a22afde5eec50ffa9f21cfd Mon Sep 17 00:00:00 2001
From: Maxwell G <gotmax@e.email>
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

View File

@ -1,72 +0,0 @@
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

View File

@ -8,8 +8,9 @@ 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.6",
python_requires=">=3.7",
author="Taneli Hukkinen",
author_email="hukkin@users.noreply.github.com",
license="MIT",
@ -19,7 +20,6 @@ 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",

View File

@ -1,29 +1,22 @@
Name: python-tomli
Version: 1.2.3
Release: 4%{?dist}
Version: 2.0.1
Release: 5%{?dist}
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
Source0: https://github.com/hukkin/tomli/archive/%{version}/%{name}-%{version}.tar.gz
# Upstream tomli uses flit, but we want to use setuptools on RHEL 8.
# 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 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
# Upstream test requirements are in tests/requirements.txt
# The test suite uses the stdlib's unittest framework, but we use %%pytest
# as the test runner.
BuildRequires: python3-pytest
%global _description %{expand:
@ -42,33 +35,38 @@ 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
%py3_build
%pyproject_wheel
%install
%py3_install
%pyproject_install
%pyproject_save_files tomli
%check
%py3_check_import tomli
%pytest
%files -n python3-tomli
%files -n python3-tomli -f %{pyproject_files}
%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 <mhroncok@redhat.com> - 1.2.3-4
- Initial package for RHEL 8
- Resolves: rhbz#2175215
* Wed Mar 08 2023 Miro Hrončok <mhroncok@redhat.com> - 2.0.1-5
- Initial package for RHEL 9
- Resolves: rhbz#2175213
- Fedora+EPEL contributions by:
Maxwell G <gotmax@e.email>
Michel Alexandre Salim <salimma@fedoraproject.org>
Miro Hrončok <miro@hroncok.cz>
Petr Viktorin <pviktori@redhat.com>