#7 Update to 3.0.0~a6~202306288d57ce2 to add support for Python 3.12
Merged 9 months ago by thrnciar. Opened 10 months ago by thrnciar.
rpms/ thrnciar/python-astroid python3.12  into  rawhide

@@ -1,45 +0,0 @@ 

- From 593136cc7549f1da3207f8582ce1e7c87d78a946 Mon Sep 17 00:00:00 2001

- From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= <thrnciar@redhat.com>

- Date: Thu, 13 Apr 2023 15:25:29 +0200

- Subject: [PATCH] Skip test_ctypes_redefined_types_members test on Python 3.12

- 

- ---

-  astroid/const.py           | 1 +

-  tests/brain/test_ctypes.py | 2 ++

-  2 files changed, 3 insertions(+)

- 

- diff --git a/astroid/const.py b/astroid/const.py

- index 52360cf..1e76e7c 100644

- --- a/astroid/const.py

- +++ b/astroid/const.py

- @@ -11,6 +11,7 @@ PY38_PLUS = sys.version_info >= (3, 8)

-  PY39_PLUS = sys.version_info >= (3, 9)

-  PY310_PLUS = sys.version_info >= (3, 10)

-  PY311_PLUS = sys.version_info >= (3, 11)

- +PY312_PLUS = sys.version_info >= (3, 12)

-  BUILTINS = "builtins"  # TODO Remove in 2.8

-  

-  WIN32 = sys.platform == "win32"

- diff --git a/tests/brain/test_ctypes.py b/tests/brain/test_ctypes.py

- index fe8b254..e8f61a8 100644

- --- a/tests/brain/test_ctypes.py

- +++ b/tests/brain/test_ctypes.py

- @@ -7,6 +7,7 @@ import sys

-  import pytest

-  

-  from astroid import extract_node, nodes

- +from astroid.const import PY312_PLUS

-  

-  pytestmark = pytest.mark.skipif(

-      hasattr(sys, "pypy_version_info"),

- @@ -56,6 +57,7 @@ pytestmark = pytest.mark.skipif(

-          ("c_wchar", "str", "u"),

-      ],

-  )

- +@pytest.mark.skipif(PY312_PLUS, reason="The test doesn't work with  Python 3.12 or higher")

-  def test_ctypes_redefined_types_members(c_type, builtin_type, type_code):

-      """Test that the "value" and "_type_" member of each redefined types are

-      correct.

- -- 

- 2.39.2

- 

file modified
+11 -28
@@ -1,11 +1,8 @@ 

- # Remove when globs in setup.py work.

- %{?python_disable_dependency_generator}

- 

  %global srcname     astroid

+ %global commit      8d57ce2f3e226c2ac3cdd7f6a57dac2dd5ec5a4b

+ %global shortcommit %(c=%{commit}; echo ${c:0:7})

  

- %global forgeurl https://github.com/PyCQA/astroid

- Version:        2.15.4

- %forgemeta

+ Version:        3.0.0~a6~20230628%{shortcommit}

  

  Name:           python-astroid

  # Note: please check that this doesn't break pylint before committing and building! -GC
@@ -13,27 +10,12 @@ 

  Summary:        Common base representation of python source code for pylint and other projects

  License:        LGPL-2.1-or-later

  URL:            https://pypi.org/project/astroid/

- Source0:        %{forgesource}

- 

- # Python3.12 compatibility: Temporarily disable failing test

- # Upstream issue: https://github.com/pylint-dev/astroid/issues/2116

- Patch:          Skip-test_ctypes_redefined_types_members-test-on-Pyt.patch

+ Source0:        https://github.com/pylint-dev/%{srcname}/archive/%{commit}/%{srcname}-%{commit}.tar.gz

  

  BuildArch:      noarch

  

- BuildRequires:  pyproject-rpm-macros

  BuildRequires:  python3-devel

- BuildRequires:  python3-setuptools

- BuildRequires:  python3-setuptools_scm

- BuildRequires:  python3-wheel

- BuildRequires:  python3-pip

- BuildRequires:  python3-lazy-object-proxy

  BuildRequires:  python3-pytest

- BuildRequires:  python3-pytest-runner

- BuildRequires:  python3-six

- BuildRequires:  python3-typed_ast >= 1.3.0

- BuildRequires:  python3-wrapt

- BuildRequires:  git-core

  

  %global _description %{expand:

  The aim of this module is to provide a common base representation of python
@@ -50,23 +32,24 @@ 

  %package -n python3-%{srcname}

  Summary:        %{summary}

  %{?python_provide:%python_provide python3-%{srcname}}

- Requires:  python3-lazy-object-proxy

- Requires:  python3-wrapt

- Requires:  python3-typed_ast

- Requires:  python3-six

  

  %description -n python3-%{srcname} %_description

  

  %prep

- %autosetup -n %{srcname}-%{version} -p1

- sed -i /six/d astroid/__pkginfo__.py

+ %autosetup -n %{srcname}-%{commit} -p1

+ 

+ %generate_buildrequires

+ %pyproject_buildrequires

  

  %build

  %pyproject_wheel

  

  %install

  %pyproject_install

+ # https://github.com/pylint-dev/astroid/pull/2156#issuecomment-1612640531

  rm -rf %{buildroot}%{python3_sitelib}/tests

+ rm %{buildroot}%{python3_sitelib}/requirements*

+ rm %{buildroot}%{python3_sitelib}/tox.ini

  

  

  %check

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- SHA512 (astroid-2.15.4.tar.gz) = 1725676cd55fde0359e7210b917663fa82a87bbec052fda27a80a08e7d2308ab1de7a5c1f1a052fd76575d9945d55743e6c23684754e03e84bb2facb51f2a5a2

+ SHA512 (astroid-8d57ce2f3e226c2ac3cdd7f6a57dac2dd5ec5a4b.tar.gz) = e4a36c02fb79cfa5266f438803bd3aeda5d3bd160b78bc5df356357f9cc3ffd8a866e118f44c209282f78649fdaa2eb736da9356bfc7863448631d335455541e

no initial comment

rebased onto 4a17506

10 months ago

If 2.15.5 was not yet released, this should probably be 2.15.4^20230628%{shortcommit} or similar.

Also note that Python reports this as version 3.0.0, alpha 6.

I belive the RPM Version tag should be 3.0.0~a6~^20230628%{shortcommit} as a pre-release snapshot of the alpha6 prerelease of version 3.0.0.

The sed -i /six/d astroid/__pkginfo__.py line is outdated. There is no line with "six" in it in that file.

The %forgemeta and %forgeurl appear unused now.

All of the manual runtime Requires (and the use of %{?python_disable_dependency_generator}) seem outdated. There are no runtime dependencies.

All of the manual runtime Requires seem outdated...

This makes me think that some of the manual BuildRequires are outdated as well. PErhaps using %pyproject_buildrequires + adding pytest manually should do it.

rebased onto 7a5c089

10 months ago

I've addressed all remarks mentioned above.

I'm sorry, I've amended my comment after sending it. I believe the version might need to be 3.0.0~a6~^20230628%{shortcommit} (note the ^ symbol after the second ~). CCing @music who might know better than me.

The %version macro in Source URL is causing some problems now:

error: Bad file: /builddir/build/SOURCES/astroid-3.0.0~a6~202306288d57ce2.tar.gz: No such file or directory

I'm sorry, I've amended my comment after sending it. I believe the version might need to be 3.0.0~a6~^20230628%{shortcommit} (note the ^ symbol after the second ~). CCing @music who might know better than me.

Ugh, I really dislike that version string, but it seems to be reasonably well supported by the origin of the snapshot, and it should sort correctly. I don’t know what else to suggest.

Related: https://pagure.io/packaging-committee/issue/1210

For the source URL, replacing %{version} with %{commit} should suffice.

Is there a reason why You don't want to treat this as a post-a5 snapshot instead of this weird pre-a6 snapshot? It would make the version string more straightforward.

Is there a reason why You don't want to treat this as a post-a5 snapshot instead of this weird pre-a6 snapshot? It would make the version string more straightforward.

For me, the reason is that upstream has already bumped the embedded version to a6, so treating it as a post-a5 snapshot would result in a mismatch between the RPM version and the generated Python virtual Provides versions. I grant that such a mismatch is unlikely to cause any serious problems.

True enough. However I'm still not sure why you're using a caret ^ at all then? This is packaging a pre-release snapshot, and the release it's for just happens to be an alpha.

True enough. However I'm still not sure why you're using a caret ^ at all then? This is packaging a pre-release snapshot, and the release it's for just happens to be an alpha.

You’re suggesting 3.0.0~a6~20230628%{shortcommit}, if I understand correctly? This seems like it could work as well, and would sort correctly.

The current packaging guidelines say that a snapshot must be versioned with a caret (^), but they also implicitly assume that all snapshots are post-release. This is why I asked for clarification in https://pagure.io/packaging-committee/issue/1210; your suggestion seems to correspond to the first option I mentioned there, although the pre-release-snapshot-of-a-named-pre-release situation in this package adds an extra layer of noise.

Yeah that doesn't make sense. It's probably a mistake in the guidelines that was introduced when ^ was documented ...

rebased onto 8ec9614

9 months ago

Amended the source and commit message.

Pull-Request has been merged by thrnciar

9 months ago