mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
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>
This commit is contained in:
parent
9156f680aa
commit
7c156003e8
3 changed files with 134 additions and 2 deletions
|
@ -1201,6 +1201,7 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/elfutils-tests-ptrace.patch \
|
%D%/packages/patches/elfutils-tests-ptrace.patch \
|
||||||
%D%/packages/patches/elixir-path-length.patch \
|
%D%/packages/patches/elixir-path-length.patch \
|
||||||
%D%/packages/patches/elm-ghc9.2.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-offline-package-registry.patch \
|
||||||
%D%/packages/patches/elm-reactor-static-files.patch \
|
%D%/packages/patches/elm-reactor-static-files.patch \
|
||||||
%D%/packages/patches/emacs-all-the-icons-remove-duplicate-rs.patch \
|
%D%/packages/patches/emacs-all-the-icons-remove-duplicate-rs.patch \
|
||||||
|
|
129
gnu/packages/patches/python-treelib-remove-python2-compat.patch
Normal file
129
gnu/packages/patches/python-treelib-remove-python2-compat.patch
Normal file
|
@ -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
|
||||||
|
|
|
@ -14636,13 +14636,15 @@ without using the configuration machinery.")
|
||||||
(version "1.8.0")
|
(version "1.8.0")
|
||||||
(source
|
(source
|
||||||
(origin
|
(origin
|
||||||
(method git-fetch) ; no tests in PyPI
|
(method git-fetch)
|
||||||
(uri (git-reference
|
(uri (git-reference
|
||||||
(url "https://github.com/caesar0301/treelib")
|
(url "https://github.com/caesar0301/treelib")
|
||||||
(commit (string-append "v" version))))
|
(commit (string-append "v" version))))
|
||||||
(file-name (git-file-name name version))
|
(file-name (git-file-name name version))
|
||||||
(sha256
|
(sha256
|
||||||
(base32 "0jd3rdaq8v7ykb626cm1gxa03higqnn2pmnv46fc0lc55xbrkxlf"))))
|
(base32 "0jd3rdaq8v7ykb626cm1gxa03higqnn2pmnv46fc0lc55xbrkxlf"))
|
||||||
|
(patches
|
||||||
|
(search-patches "python-treelib-remove-python2-compat.patch"))))
|
||||||
(build-system pyproject-build-system)
|
(build-system pyproject-build-system)
|
||||||
(native-inputs (list python-poetry-core python-pytest))
|
(native-inputs (list python-poetry-core python-pytest))
|
||||||
(home-page "https://github.com/caesar0301/treelib")
|
(home-page "https://github.com/caesar0301/treelib")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue