python-flit-core/py314-avoid-using-ast-str.patch
Steve Kowalik fbec085a4c - Update to 3.10.1:
* flit publish can now use PyPI tokens stored in keyring (PR #649), either
    project tokens with a ‘username’ like pypi_token:project:project_name
    (use the normalised form of the name) or user tokens
    (pypi_token:user:username).
  * The --python option can now take the path of a virtualenv folder, as an
    alternative to a Python executable (PR #667).
  * Flit will work with current development versions of Pythona again
    (PR #684).
  * The flit command line package now requires Python 3.8 or above (PR #660).
    flit_core still works with Python 3.6 or above.
  * The metadata in packages now has the names of optional dependency
    groups (“extras”) normalised, complying with version 2.3 of the metadata
    standard (PR #676, PR #697).
  * The flit command line package now depends on pip (PR #647).
  * Fix potential substitution of environment variables into passwords read
    from .pypirc files (PR #652).
  * A warning is now shown when building packages which specify the old
    flit.buildapi backend, which should be replaced by flit_core.buildapi
    (PR #674). It’s a good idea to always set a maximum version for the
    build requirement, to protect against changes in future major versions
    of Flit.
  * Avoid using the deprecated datetime.utcfromtimestamp() (PR #682).
  * Flit now has a SECURITY.md file in the Github repository (PR #665).
  * The tests for flit_core are no longer part of the installed package,
    reducing the size of the wheels (PR #691).
- Drop patches, included upstream:
  * py312-avoid-using-utcfromtimestamp.patch
  * py314-avoid-using-ast-str.patch
- We no longer need to remove the tests from the install.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flit-core?expand=0&rev=48
2025-01-14 02:40:20 +00:00

42 lines
1.6 KiB
Diff

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