summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2025-09-22 01:30:43 +0200
committerSharlatan Hellseher <sharlatanus@gmail.com>2025-09-22 20:41:21 +0100
commitebbcd92f0037b7cfaa7de18285a3a8e9039b696f (patch)
tree53edc0f6f99dc16121def1cb5a82ad65f51128eb
parent9b2381a5cea1f743bbf6b9619e7956a0bb0ecd87 (diff)
gnu: python-treelib: Remove python-six properly.
The package still used python-six. Luckily a PR was ready for its removal. * gnu/packages/python-xyz.scm (python-treelib)[source]: Add patch. * gnu/packages/patches/python-treelib-remove-python2-compat.patch: Add file. * gnu/local.mk: Record patch. Change-Id: I91a37770391cc72f158ade5b9619e80ab9a36bc7 Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/python-treelib-remove-python2-compat.patch129
-rw-r--r--gnu/packages/python-xyz.scm6
3 files changed, 134 insertions, 2 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 8016b3fa04..4fa5ca90d5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1201,6 +1201,7 @@ dist_patch_DATA = \
%D%/packages/patches/elfutils-tests-ptrace.patch \
%D%/packages/patches/elixir-path-length.patch \
%D%/packages/patches/elm-ghc9.2.patch \
+ %D%/packages/patches/python-treelib-remove-python2-compat.patch \
%D%/packages/patches/elm-offline-package-registry.patch \
%D%/packages/patches/elm-reactor-static-files.patch \
%D%/packages/patches/emacs-all-the-icons-remove-duplicate-rs.patch \
diff --git a/gnu/packages/patches/python-treelib-remove-python2-compat.patch b/gnu/packages/patches/python-treelib-remove-python2-compat.patch
new file mode 100644
index 0000000000..50659c21e9
--- /dev/null
+++ b/gnu/packages/patches/python-treelib-remove-python2-compat.patch
@@ -0,0 +1,129 @@
+From: Alexandre Detiste <alexandre.detiste@gmail.com>, ngraves@ngraves.fr
+
+diff --git a/pyproject.toml b/pyproject.toml
+index 98b5603..7b192a8 100644
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -35,7 +35,6 @@ include = [
+
+ [tool.poetry.dependencies]
+ python = "^3.7"
+-six = ">=1.13.0"
+
+ [tool.poetry.group.dev.dependencies]
+ # Testing dependencies - pytest for all Python versions
+diff --git a/treelib/__init__.py b/treelib/__init__.py
+index bed89cc..f164208 100644
+--- a/treelib/__init__.py
++++ b/treelib/__init__.py
+@@ -57,15 +57,6 @@ Common Use Cases:
+ - Abstract syntax trees
+ - Family trees and genealogy
+
+-Compatibility Note:
+- To ensure string compatibility between Python 2.x and 3.x, treelib follows
+- Python 3.x string handling conventions. All strings are handled as unicode.
+-
+- For Python 2.x users with non-ASCII characters, enable unicode literals:
+-
+- .. code-block:: python
+-
+- from __future__ import unicode_literals
+ """
+
+ from .node import Node # noqa: F401
+diff --git a/treelib/node.py b/treelib/node.py
+index cb79a01..64547f7 100644
+--- a/treelib/node.py
++++ b/treelib/node.py
+@@ -22,8 +22,6 @@ Note:
+ directly instantiated, as the Tree class manages the parent-child
+ relationships automatically.
+ """
+-from __future__ import unicode_literals
+-
+ import copy
+ import sys
+ import uuid
+@@ -40,7 +38,7 @@ else:
+ StrList = List[str] # Python 3.8 and earlier
+
+
+-class Node(object):
++class Node:
+ """
+ Elementary node object stored in Tree structures.
+
+diff --git a/treelib/tree.py b/treelib/tree.py
+index 39bbdb5..8042175 100644
+--- a/treelib/tree.py
++++ b/treelib/tree.py
+@@ -26,26 +26,13 @@ Key Features:
+ - Subtree operations and filtering
+ - Tree metrics and analysis tools
+ """
+-from __future__ import print_function, unicode_literals
+-
+-try:
+- from builtins import str as text
+-except ImportError:
+- from __builtin__ import str as text # type: ignore
+-
+ import codecs
+ import json
+ import sys
+ import uuid
+ from copy import deepcopy
+ from typing import Any, Callable, List, Optional, Union, cast
+-
+-from six import iteritems, python_2_unicode_compatible
+-
+-try:
+- from StringIO import StringIO # type: ignore
+-except ImportError:
+- from io import StringIO
++from io import StringIO
+
+ from .exceptions import (
+ DuplicatedNodeIdError,
+@@ -70,8 +57,7 @@ else:
+ __author__ = "chenxm"
+
+
+-@python_2_unicode_compatible
+-class Tree(object):
++class Tree():
+ """
+ Hierarchical tree data structure.
+
+@@ -220,7 +206,7 @@ class Tree(object):
+
+ if tree is not None:
+ self.root = tree.root
+- for nid, node in iteritems(tree.nodes):
++ for nid, node in tree.nodes.items():
+ new_node = deepcopy(node) if deep else node
+ self._nodes[nid] = new_node
+ if tree.identifier != self._identifier:
+@@ -1540,9 +1526,9 @@ class Tree(object):
+
+ set_joint = set(new_tree._nodes) & set(self._nodes) # joint keys
+ if set_joint:
+- raise ValueError("Duplicated nodes %s exists." % list(map(text, set_joint)))
++ raise ValueError("Duplicated nodes %s exists." % list(map(str, set_joint)))
+
+- for cid, node in iteritems(new_tree.nodes):
++ for cid, node in new_tree.nodes.items():
+ if deep:
+ node = deepcopy(new_tree[node])
+ self._nodes.update({cid: node})
+@@ -1909,7 +1895,7 @@ class Tree(object):
+ :return: None
+ """
+ cn = self[nid]
+- for attr, val in iteritems(attrs):
++ for attr, val in attrs.items():
+ if attr == "identifier":
+ # Updating node id meets following contraints:
+ # * Update node identifier property
+
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 64c6f816f1..f693be66e3 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -14660,13 +14660,15 @@ without using the configuration machinery.")
(version "1.8.0")
(source
(origin
- (method git-fetch) ; no tests in PyPI
+ (method git-fetch)
(uri (git-reference
(url "https://github.com/caesar0301/treelib")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
- (base32 "0jd3rdaq8v7ykb626cm1gxa03higqnn2pmnv46fc0lc55xbrkxlf"))))
+ (base32 "0jd3rdaq8v7ykb626cm1gxa03higqnn2pmnv46fc0lc55xbrkxlf"))
+ (patches
+ (search-patches "python-treelib-remove-python2-compat.patch"))))
(build-system pyproject-build-system)
(native-inputs (list python-poetry-core python-pytest))
(home-page "https://github.com/caesar0301/treelib")