Import python-tomli from EPEL 8
From 4fc2536d0c
Co-Authored-By: Maxwell G <gotmax@e.email>
Co-Authored-By: Petr Viktorin <pviktori@redhat.com>
Related: rhbz#2175215
This commit is contained in:
parent
1d59287176
commit
25e070b622
6
.gitignore
vendored
6
.gitignore
vendored
@ -0,0 +1,6 @@
|
|||||||
|
/1.0.4.tar.gz
|
||||||
|
/1.1.0.tar.gz
|
||||||
|
/1.2.1.tar.gz
|
||||||
|
/1.2.2.tar.gz
|
||||||
|
/1.2.3.tar.gz
|
||||||
|
/python-tomli-1.2.3.tar.gz
|
30
0001-tests-Replace-tmp_path-with-tmpdir-pytest-fixture.patch
Normal file
30
0001-tests-Replace-tmp_path-with-tmpdir-pytest-fixture.patch
Normal 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
|
||||||
|
|
72
Remove_python-dateutil_test_dependency.patch
Normal file
72
Remove_python-dateutil_test_dependency.patch
Normal 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
|
121
python-tomli.spec
Normal file
121
python-tomli.spec
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
# 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}
|
||||||
|
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
|
||||||
|
# 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
|
||||||
|
# pip is needed for %%py3_install_wheel
|
||||||
|
BuildRequires: python3-pip
|
||||||
|
|
||||||
|
%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:
|
||||||
|
BuildRequires: python3-pytest
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%global _description %{expand:
|
||||||
|
Tomli is a Python library for parsing TOML.
|
||||||
|
Tomli is fully compatible with TOML v1.0.0.}
|
||||||
|
|
||||||
|
|
||||||
|
%description %_description
|
||||||
|
|
||||||
|
%package -n python3-tomli
|
||||||
|
Summary: %{summary}
|
||||||
|
|
||||||
|
%description -n python3-tomli %_description
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1 -n tomli-%{version}
|
||||||
|
|
||||||
|
%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
|
||||||
|
|
||||||
|
|
||||||
|
%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
|
||||||
|
|
||||||
|
|
||||||
|
%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
|
||||||
|
%doc README.md
|
||||||
|
%doc CHANGELOG.md
|
||||||
|
%license LICENSE
|
||||||
|
%{python3_sitelib}/tomli/
|
||||||
|
%{python3_sitelib}/tomli-%{version}%{?with_bootstrap:+rpmbootstrap}.dist-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
|
Loading…
Reference in New Issue
Block a user