Accepting request 1186039 from devel:languages:python
Automatic submission by obs-autosubmit OBS-URL: https://build.opensuse.org/request/show/1186039 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-flit-core?expand=0&rev=18
This commit is contained in:
commit
5948cc3308
33
py312-avoid-using-utcfromtimestamp.patch
Normal file
33
py312-avoid-using-utcfromtimestamp.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
From 915fa612e227fb4bf67f8484af5c8a399f108526 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Wim Jeantine-Glenn <hey@wimglenn.com>
|
||||||
|
Date: Mon, 13 May 2024 23:48:47 -0500
|
||||||
|
Subject: [PATCH] datetime.utcfromtimestamp is deprecated in Python 3.12, avoid
|
||||||
|
using it
|
||||||
|
|
||||||
|
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcfromtimestamp
|
||||||
|
---
|
||||||
|
flit_core/flit_core/wheel.py | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/flit_core/flit_core/wheel.py b/flit_core/flit_core/wheel.py
|
||||||
|
index b4a44b0d..dbf77372 100644
|
||||||
|
--- a/flit_core/flit_core/wheel.py
|
||||||
|
+++ b/flit_core/flit_core/wheel.py
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
from base64 import urlsafe_b64encode
|
||||||
|
import contextlib
|
||||||
|
from datetime import datetime
|
||||||
|
+from datetime import timezone
|
||||||
|
import hashlib
|
||||||
|
import io
|
||||||
|
import logging
|
||||||
|
@@ -42,7 +43,8 @@ def zip_timestamp_from_env() -> Optional[tuple]:
|
||||||
|
try:
|
||||||
|
# If SOURCE_DATE_EPOCH is set (e.g. by Debian), it's used for
|
||||||
|
# timestamps inside the zip file.
|
||||||
|
- d = datetime.utcfromtimestamp(int(os.environ['SOURCE_DATE_EPOCH']))
|
||||||
|
+ t = int(os.environ['SOURCE_DATE_EPOCH'])
|
||||||
|
+ d = datetime.fromtimestamp(t, timezone.utc)
|
||||||
|
except (KeyError, ValueError):
|
||||||
|
# Otherwise, we'll use the mtime of files, and generated files will
|
||||||
|
# default to 2016-1-1 00:00:00
|
41
py314-avoid-using-ast-str.patch
Normal file
41
py314-avoid-using-ast-str.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
From 6ab62c91d0db451b5e9ab000f0dba5471550b442 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Thomas A Caswell <tcaswell@gmail.com>
|
||||||
|
Date: Tue, 28 May 2024 10:25:13 -0400
|
||||||
|
Subject: [PATCH] MNT: fix compatibility with Python 3.14
|
||||||
|
|
||||||
|
The ast.Str class was deprecated in 3.8 and will be removed in 3.14
|
||||||
|
---
|
||||||
|
flit_core/flit_core/common.py | 11 +++++++++--
|
||||||
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/flit_core/flit_core/common.py b/flit_core/flit_core/common.py
|
||||||
|
index 6625224b..8bcda3fb 100644
|
||||||
|
--- a/flit_core/flit_core/common.py
|
||||||
|
+++ b/flit_core/flit_core/common.py
|
||||||
|
@@ -148,6 +148,10 @@ def get_docstring_and_version_via_ast(target):
|
||||||
|
with target_path.open('rb') as f:
|
||||||
|
node = ast.parse(f.read())
|
||||||
|
for child in node.body:
|
||||||
|
+ if sys.version_info >= (3, 8):
|
||||||
|
+ target_type = ast.Constant
|
||||||
|
+ else:
|
||||||
|
+ target_type = ast.Str
|
||||||
|
# Only use the version from the given module if it's a simple
|
||||||
|
# string assignment to __version__
|
||||||
|
is_version_str = (
|
||||||
|
@@ -157,10 +161,13 @@ def get_docstring_and_version_via_ast(target):
|
||||||
|
and target.id == "__version__"
|
||||||
|
for target in child.targets
|
||||||
|
)
|
||||||
|
- and isinstance(child.value, ast.Str)
|
||||||
|
+ and isinstance(child.value, target_type)
|
||||||
|
)
|
||||||
|
if is_version_str:
|
||||||
|
- version = child.value.s
|
||||||
|
+ if sys.version_info >= (3, 8):
|
||||||
|
+ version = child.value.value
|
||||||
|
+ else:
|
||||||
|
+ version = child.value.s
|
||||||
|
break
|
||||||
|
return ast.get_docstring(node), version
|
||||||
|
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Jun 30 19:09:04 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
- add py312-avoid-using-utcfromtimestamp.patch,
|
||||||
|
py314-avoid-using-ast-str.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Feb 23 12:20:15 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
|
Fri Feb 23 12:20:15 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ Summary: Distribution-building parts of Flit
|
|||||||
License: BSD-3-Clause AND MIT
|
License: BSD-3-Clause AND MIT
|
||||||
URL: https://github.com/pypa/flit
|
URL: https://github.com/pypa/flit
|
||||||
Source0: https://files.pythonhosted.org/packages/source/f/flit_core/flit_core-%{version}.tar.gz
|
Source0: https://files.pythonhosted.org/packages/source/f/flit_core/flit_core-%{version}.tar.gz
|
||||||
|
Patch1: https://github.com/pypa/flit/commit/915fa612e227fb4bf67f8484af5c8a399f108526.patch#/py312-avoid-using-utcfromtimestamp.patch
|
||||||
|
Patch2: https://github.com/pypa/flit/commit/6ab62c91d0db451b5e9ab000f0dba5471550b442.patch#/py314-avoid-using-ast-str.patch
|
||||||
BuildRequires: %{python_module base >= 3.6}
|
BuildRequires: %{python_module base >= 3.6}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
@ -88,7 +90,7 @@ This provides a PEP 517 build backend for packages using Flit.
|
|||||||
The only public interface is the API specified by PEP 517, at flit_core.buildapi.
|
The only public interface is the API specified by PEP 517, at flit_core.buildapi.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n flit_core-%{version}
|
%autosetup -p2 -n flit_core-%{version}
|
||||||
|
|
||||||
%if "%{flavor}" != "test"
|
%if "%{flavor}" != "test"
|
||||||
%build
|
%build
|
||||||
|
Loading…
Reference in New Issue
Block a user