Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glib: support python 3.12 #24591

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions recipes/glib/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,56 @@ sources:
url: "https://download.gnome.org/sources/glib/2.75/glib-2.75.3.tar.xz"
sha256: "7c517d0aff456c35a039bce8a8df7a08ce95a8285b09d1849f8865f633f7f871"
patches:
"2.78.3":
- patch_file: "patches/remove-distutils-2.77.0.patch"
patch_type: bugfix
patch_description: remove distutils
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133
"2.78.1":
- patch_file: "patches/remove-distutils-2.77.0.patch"
patch_type: bugfix
patch_description: remove distutils
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133
"2.78.0":
- patch_file: "patches/remove-distutils-2.77.0.patch"
patch_type: bugfix
patch_description: remove distutils
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133
"2.77.3":
- patch_file: "patches/remove-distutils-2.77.0.patch"
patch_type: bugfix
patch_description: remove distutils
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133
"2.77.2":
- patch_file: "patches/remove-distutils-2.77.0.patch"
patch_type: bugfix
patch_description: remove distutils
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133
"2.77.1":
- patch_file: "patches/remove-distutils-2.77.0.patch"
patch_type: bugfix
patch_description: remove distutils
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133
"2.77.0":
- patch_file: "patches/remove-distutils-2.77.0.patch"
patch_type: bugfix
patch_description: remove distutils
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133
"2.76.3":
- patch_file: "patches/libintl-discovery.patch"
patch_type: bugfix
patch_description: fix libintl discovery
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3352
- patch_file: "patches/remove-distutils.patch"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this file also be versioned as 2.75 just like above? It wil make it less likely that it ends up dangling in the future :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't worry too much - we can use tooling to find dangling patches regardless of the filename, and they are not critical

patch_type: bugfix
patch_description: remove distutils
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133
"2.75.3":
- patch_file: "patches/libintl-discovery-2.75.3.patch"
patch_type: bugfix
patch_description: fix libintl discovery
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3352
- patch_file: "patches/remove-distutils.patch"
patch_type: bugfix
patch_description: remove distutils
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133
2 changes: 1 addition & 1 deletion recipes/glib/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def requirements(self):
self.requires("libiconv/1.17")

def build_requirements(self):
self.tool_requires("meson/1.2.2")
self.tool_requires("meson/[>=1.2.3]")
jcar87 marked this conversation as resolved.
Show resolved Hide resolved
if not self.conf.get("tools.gnu:pkg_config", check_type=str):
self.tool_requires("pkgconf/2.0.3")

Expand Down
51 changes: 51 additions & 0 deletions recipes/glib/all/patches/remove-distutils-2.77.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
diff --git a/gio/gdbus-2.0/codegen/utils.py b/gio/gdbus-2.0/codegen/utils.py
index 0204610..f8d758c 100644
--- a/gio/gdbus-2.0/codegen/utils.py
+++ b/gio/gdbus-2.0/codegen/utils.py
@@ -19,7 +19,7 @@
#
# Author: David Zeuthen <davidz@redhat.com>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:verymad: The original patch is yours, they stole your credit! hahaha 😄


-import distutils.version
+import re
import os
import sys

@@ -159,11 +159,35 @@ def lookup_brief_docs(annotations):
def version_cmp_key(key):
# If the 'since' version is 'UNRELEASED', compare higher than anything else
# If it is empty put a 0 in its place as this will
- # allow LooseVersion to work and will always compare lower.
+ # allow _parse_version() to work and will always compare lower.
if key[0] == "UNRELEASED":
v = "9999"
elif key[0]:
v = str(key[0])
else:
v = "0"
- return (distutils.version.LooseVersion(v), key[1])
+ return (_parse_version(v), key[1])
+
+
+def _parse_version(version):
+ """
+ Parse a version string into a list of integers and strings.
+
+ This function takes a version string and breaks it down into its component parts.
+ It separates numeric and non-numeric segments, converting numeric segments to integers.
+
+ Args:
+ version (str): The version string to parse.
+
+ Returns:
+ list: A list where each element is either an integer (for numeric parts)
+ or a string (for non-numeric parts).
+
+ Example:
+ >>> parseversion("1.2.3a")
+ [1, 2, 3, 'a']
+ >>> parseversion("2.0.0-rc1")
+ [2, 0, 0, 'rc1']
+ """
+ blocks = re.findall(r"(\d+|\w+)", version)
+ return [int(b) if b.isdigit() else b for b in blocks]
51 changes: 51 additions & 0 deletions recipes/glib/all/patches/remove-distutils.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
diff --git a/gio/gdbus-2.0/codegen/utils.py b/gio/gdbus-2.0/codegen/utils.py
index 95559d3..2b7a176 100644
--- a/gio/gdbus-2.0/codegen/utils.py
+++ b/gio/gdbus-2.0/codegen/utils.py
@@ -19,7 +19,7 @@
#
# Author: David Zeuthen <davidz@redhat.com>

-import distutils.version
+import re
import os
import sys

@@ -155,11 +155,35 @@ def lookup_brief_docs(annotations):
def version_cmp_key(key):
# If the 'since' version is 'UNRELEASED', compare higher than anything else
# If it is empty put a 0 in its place as this will
- # allow LooseVersion to work and will always compare lower.
+ # allow _parse_version() to work and will always compare lower.
if key[0] == "UNRELEASED":
v = "9999"
elif key[0]:
v = str(key[0])
else:
v = "0"
- return (distutils.version.LooseVersion(v), key[1])
+ return (_parse_version(v), key[1])
+
+
+def _parse_version(version):
+ """
+ Parse a version string into a list of integers and strings.
+
+ This function takes a version string and breaks it down into its component parts.
+ It separates numeric and non-numeric segments, converting numeric segments to integers.
+
+ Args:
+ version (str): The version string to parse.
+
+ Returns:
+ list: A list where each element is either an integer (for numeric parts)
+ or a string (for non-numeric parts).
+
+ Example:
+ >>> parseversion("1.2.3a")
+ [1, 2, 3, 'a']
+ >>> parseversion("2.0.0-rc1")
+ [2, 0, 0, 'rc1']
+ """
+ blocks = re.findall(r"(\d+|\w+)", version)
+ return [int(b) if b.isdigit() else b for b in blocks]
Loading