~ruther/guix-local

65c15f0af83a6e5eef8cded6993edc1fe7e7d471 — Nicolas Graves 4 months ago 1e98883
gnu: python-norns: Switch to pyproject.

* gnu/packages/patches/python-norns-nose.patch: New file.
* gnu/local.mk: Record patch.
* gnu/packages/python-xyz.scm (python-norns):
[source]: Switch to git-fetch.  Add patch.
[build-system]: Switch to pyproject-build-system.
[propagated-inputs]: Remove python-setuptools, replace python-nose by
python-pynose.
[native-inputs]: Add python-setuptools.  Remove python-wheel.

Change-Id: Idf13cbf9cb1b224d4e502a5ebd8573540604eeed
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
3 files changed, 100 insertions(+), 9 deletions(-)

M gnu/local.mk
A gnu/packages/patches/python-norns-nose.patch
M gnu/packages/python-xyz.scm
M gnu/local.mk => gnu/local.mk +1 -0
@@ 2053,6 2053,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/python-louvain-fix-test.patch		\
  %D%/packages/patches/python-matplotlib-fix-legend-loc-best-test.patch	\
  %D%/packages/patches/python-mohawk-pytest.patch	\
  %D%/packages/patches/python-norns-nose.patch			\
  %D%/packages/patches/python-numpy-gcc-14.patch		\
  %D%/packages/patches/python-random2-getrandbits-test.patch		\
  %D%/packages/patches/python-pillow-use-zlib-1.3.patch	\

A gnu/packages/patches/python-norns-nose.patch => gnu/packages/patches/python-norns-nose.patch +86 -0
@@ 0,0 1,86 @@
From acefbee3c0cefea291c4dfc8c2d4751c7bd9190c Mon Sep 17 00:00:00 2001
From: Andrew Robbins <andrew@robbinsa.me>
Date: Fri, 14 Mar 2025 12:58:30 -0400
Subject: [PATCH 1/3] use modern importlib.resources

---
 norns/cfg.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/norns/cfg.py b/norns/cfg.py
index 5868f56..c2170d9 100644
--- a/norns/cfg.py
+++ b/norns/cfg.py
@@ -5,7 +5,7 @@
     from UserDict import DictMixin
 except ImportError:
     from collections.abc import MutableMapping as DictMixin
-import pkg_resources
+import importlib.resources
 
 from norns.exceptions import ConfigError
 
@@ -49,8 +49,9 @@ def __init__(self, name=None, config_file=None, default=None):
         
         if default and (not self.config_file or 
                 not os.path.exists(self.config_file)):
-            self.config_file = pkg_resources.resource_filename(name, default)
-        
+            self.config_file = importlib.resources.files(name) /  default
+            #self.config_file = importlib.resources.as_file(config_traversable) 
+       
         if not self.config_file or not os.path.exists(self.config_file):
             raise ConfigError("please provide name or config_file")
         

From 332464e266536144d33e02ccb7c65d1078fd68db Mon Sep 17 00:00:00 2001
From: Andrew Robbins <andrew@robbinsa.me>
Date: Fri, 14 Mar 2025 12:58:43 -0400
Subject: [PATCH 2/3] bump version

---
 norns/__about__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/norns/__about__.py b/norns/__about__.py
index 06ea00e..7de2db7 100644
--- a/norns/__about__.py
+++ b/norns/__about__.py
@@ -1,3 +1,3 @@
 """Metadata"""
-__version__ = '0.1.4'
+__version__ = '0.1.6'
 __author__ = "Simon van Heeringen"

From 0caea8432132fc002761b53b05652514e5359e3f Mon Sep 17 00:00:00 2001
From: Andrew Robbins <andrew@robbinsa.me>
Date: Fri, 14 Mar 2025 14:58:50 -0400
Subject: [PATCH 3/3] use pynose as nose is not maintained

---
 requirements.txt | 2 +-
 setup.py         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/requirements.txt b/requirements.txt
index 992ab2a..d3920be 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
-nose
+pynose
 appdirs
 pyyaml>=5.1
diff --git a/setup.py b/setup.py
index d9f5aec..0c68475 100644
--- a/setup.py
+++ b/setup.py
@@ -28,7 +28,7 @@
 }
 
 requires = [
-    'nose',
+    'pynose',
     'appdirs',
     'pyyaml',
 ]

M gnu/packages/python-xyz.scm => gnu/packages/python-xyz.scm +13 -9
@@ 11187,16 11187,20 @@ parser for Node.js.")
  (package
    (name "python-norns")
    (version "0.1.6")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "norns" version))
              (sha256
               (base32
                "1r1lcq59v6l75wkbp7mypanr69a6fv6m58v6dw3v6b4vwz5nqg0z"))))
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/simonvh/norns")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0x488xd2dp1clnzpb3gikx416g0fh1bjs25bwi0jmsvqmd80hmb0"))
       (patches
        (search-patches "python-norns-nose.patch"))))
    (build-system pyproject-build-system)
    (propagated-inputs (list python-appdirs python-nose python-pyyaml
                             python-setuptools))
    (native-inputs (list python-wheel))
    (propagated-inputs (list python-appdirs python-pynose python-pyyaml))
    (native-inputs (list python-setuptools))
    (home-page "https://github.com/simonvh/norns")
    (synopsis "Simple YAML-based config module")
    (description "This package provides a simple YAML-based config module.")