Compare commits

..

1 Commits

Author SHA1 Message Date
eabdullin
620aad1151 import CS python-tomli-1.2.3-4.el8 2023-10-23 07:48:27 +00:00
6 changed files with 128 additions and 24 deletions

2
.gitignore vendored
View File

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

View File

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

View File

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

@ -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

View File

@ -8,9 +8,8 @@ setup(
long_description=pathlib.Path("README.md").read_text(), long_description=pathlib.Path("README.md").read_text(),
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
packages=["tomli"], packages=["tomli"],
package_dir={"": "src"},
package_data={"tomli": ["py.typed"]}, package_data={"tomli": ["py.typed"]},
python_requires=">=3.7", python_requires=">=3.6",
author="Taneli Hukkinen", author="Taneli Hukkinen",
author_email="hukkin@users.noreply.github.com", author_email="hukkin@users.noreply.github.com",
license="MIT", license="MIT",
@ -20,6 +19,7 @@ setup(
"Operating System :: Microsoft :: Windows", "Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux", "Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.9",

View File

@ -1,22 +1,29 @@
Name: python-tomli Name: python-tomli
Version: 2.0.1 Version: 1.2.3
Release: 5%{?dist} Release: 4%{?dist}
Summary: A little TOML parser for Python Summary: A little TOML parser for Python
License: MIT License: MIT
URL: https://pypi.org/project/tomli/ 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. # This a downstream-only setup.py manually created from pyproject.toml metadata.
# It contains a @@VERSION@@ placeholder. # It contains a @@VERSION@@ placeholder.
Source1: tomli-setup.py 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 BuildArch: noarch
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools
# The test suite uses the stdlib's unittest framework, but we use %%pytest # Upstream test requirements are in tests/requirements.txt
# as the test runner.
BuildRequires: python3-pytest BuildRequires: python3-pytest
%global _description %{expand: %global _description %{expand:
@ -35,38 +42,33 @@ Summary: %{summary}
%prep %prep
%autosetup -p1 -n tomli-%{version} %autosetup -p1 -n tomli-%{version}
sed 's/@@VERSION@@/%{version}/' %{SOURCE1} > setup.py sed 's/@@VERSION@@/%{version}/' %{SOURCE1} > setup.py
rm pyproject.toml # force the PEP 517 fallback build backend (setuptools)
%generate_buildrequires
%pyproject_buildrequires -r
%build %build
%pyproject_wheel %py3_build
%install %install
%pyproject_install %py3_install
%pyproject_save_files tomli
%check %check
%py3_check_import tomli
%pytest %pytest
%files -n python3-tomli -f %{pyproject_files} %files -n python3-tomli
%doc README.md %doc README.md
%doc CHANGELOG.md %doc CHANGELOG.md
%license LICENSE
%{python3_sitelib}/tomli/
%{python3_sitelib}/tomli-%{version}-py%{python3_version}.egg-info/
%changelog %changelog
* Wed Mar 08 2023 Miro Hrončok <mhroncok@redhat.com> - 2.0.1-5 * Wed Mar 08 2023 Miro Hrončok <mhroncok@redhat.com> - 1.2.3-4
- Initial package for RHEL 9 - Initial package for RHEL 8
- Resolves: rhbz#2175213 - Resolves: rhbz#2175215
- Fedora+EPEL contributions by: - Fedora+EPEL contributions by:
Maxwell G <gotmax@e.email> Maxwell G <gotmax@e.email>
Michel Alexandre Salim <salimma@fedoraproject.org>
Miro Hrončok <miro@hroncok.cz> Miro Hrončok <miro@hroncok.cz>
Petr Viktorin <pviktori@redhat.com> Petr Viktorin <pviktori@redhat.com>