GNU bug report logs - #67143
[PATCH] gnu: Add python-pyreadstat 1.2.4.

Previous Next

Package: guix-patches;

Reported by: Troy Figiel <troy <at> troyfigiel.com>

Date: Mon, 13 Nov 2023 03:13:02 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <othacehe <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 67143 in the body.
You can then email your comments to 67143 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#67143; Package guix-patches. (Mon, 13 Nov 2023 03:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Troy Figiel <troy <at> troyfigiel.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 13 Nov 2023 03:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Troy Figiel <troy <at> troyfigiel.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Add python-pyreadstat 1.2.4.
Date: Sun, 12 Nov 2023 19:35:44 +0100
* gnu/packages/statistics.scm (python-pyreadstat): New variable.

Change-Id: I81ad6bf6a5644b783143a97466e12e1a127a7b9e
---
 gnu/local.mk                                  |  2 +
 .../python-pyreadstat-link-libiconv.patch     | 15 +++++++
 gnu/packages/statistics.scm                   | 45 +++++++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 gnu/packages/patches/python-pyreadstat-link-libiconv.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index e90df30068..734bec57c1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -61,6 +61,7 @@
 # Copyright © 2023 Andy Tai <atai <at> atai.org>
 # Copyright © 2023 B. Wilson <elaexuotee <at> wilsonb.com>
 # Copyright © 2023 gemmaro <gemmaro.dev <at> gmail.com>
+# Copyright © 2023 Troy Figiel <troy <at> troyfigiel.com>
 #
 # This file is part of GNU Guix.
 #
@@ -1759,6 +1760,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-louvain-fix-test.patch		\
   %D%/packages/patches/python-random2-getrandbits-test.patch		\
   %D%/packages/patches/python-poppler-qt5-fix-build.patch	\
+  %D%/packages/patches/python-pyreadstat-link-libiconv.patch	\
   %D%/packages/patches/python-pypdf-annotate-tests-appropriately.patch	\
   %D%/packages/patches/python-sip-include-dirs.patch	\
   %D%/packages/patches/python-sgmllib3k-assertions.patch	\
diff --git a/gnu/packages/patches/python-pyreadstat-link-libiconv.patch b/gnu/packages/patches/python-pyreadstat-link-libiconv.patch
new file mode 100644
index 0000000000..7efd71faeb
--- /dev/null
+++ b/gnu/packages/patches/python-pyreadstat-link-libiconv.patch
@@ -0,0 +1,15 @@
+To ensure libiconv can be found by Guix, we need to link the library.
+
+--- a/setup.py
++++ b/setup.py
+@@ -81,8 +81,7 @@ else:
+     libraries.extend(["m", "z"])
+     _platform = sys.platform
+     # Mac: iconv needs to be linked statically
+-    if _platform.lower().startswith("darwin"):
+-        libraries.append("iconv")
++    libraries.append("iconv")
+ 
+ # Extensions
+ sources.sort()
+
diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index d15732c839..4280906d2a 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2021 Frank Pursel <frank.pursel <at> gmail.com>
 ;;; Copyright © 2022 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2023 gemmaro <gemmaro.dev <at> gmail.com>
+;;; Copyright © 2023 Troy Figiel <troy <at> troyfigiel.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -7019,6 +7020,50 @@ (define-public readstat
 popular stats packages like SAS, Stata and SPSS.")
     (license license:expat)))
 
+(define-public python-pyreadstat
+  (package
+    (name "python-pyreadstat")
+    (version "1.2.4")
+    ;; No tests in the PyPI tarball.
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/Roche/pyreadstat")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0zysrzixvqw2lwwykxqg5yj8a0zyv5s2bmk22x30f4rj2hgvq1pv"))
+       (patches (search-patches "python-pyreadstat-link-libiconv.patch"))))
+    (arguments
+     '(#:phases (modify-phases %standard-phases
+                  (add-before 'check 'change-home-dir
+                    (lambda _
+                      ;; test_sav_expand and test_sav_write_basic_expanduser need a
+                      ;; home directory with write permissions.
+                      (setenv "HOME" "/tmp")))
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        ;; The source also contains tests/test_version.py
+                        ;; which checks the version in __init__.py against the
+                        ;; one in setup.py. Since this requires texlive
+                        ;; dependencies to run and is also not mentioned in
+                        ;; how_to_test.md, this test is skipped.
+                        (invoke "python" "tests/test_basic.py")))))))
+    (build-system python-build-system)
+    (propagated-inputs (list python-pandas))
+    (inputs (list libiconv zlib))
+    (native-inputs (list python-cython-3))
+    (home-page "https://github.com/Roche/pyreadstat")
+    (synopsis
+     "Read and write SAS, SPSS and Stata files into/from pandas data frames")
+    (description
+     "A Python package to read and write SAS (sas7bdat, sas7bcat, xport/xpt),
+SPSS (sav, zsav, por) and Stata (dta) files into/from pandas data frames.  It
+is a wrapper around the C library readstat.")
+    (license license:asl2.0)))
+
 (define-public r-quantpsyc
   (package
     (name "r-quantpsyc")
-- 
2.40.1





Information forwarded to guix-patches <at> gnu.org:
bug#67143; Package guix-patches. (Sun, 07 Jan 2024 16:50:01 GMT) Full text and rfc822 format available.

Message #8 received at 67143 <at> debbugs.gnu.org (full text, mbox):

From: Troy Figiel <troy <at> troyfigiel.com>
To: 67143 <at> debbugs.gnu.org
Subject: Re: [bug#67143] [PATCH] gnu: Add python-pyreadstat 1.2.4.
Date: Sun, 07 Jan 2024 17:48:55 +0100
I noticed that the first few patches I sent to Guix, were sent without a
base-commit. I have rebased the patch that follows on master and given
it a base-commit.

Best wishes,

Troy




Information forwarded to guix-patches <at> gnu.org:
bug#67143; Package guix-patches. (Sun, 07 Jan 2024 16:51:01 GMT) Full text and rfc822 format available.

Message #11 received at 67143 <at> debbugs.gnu.org (full text, mbox):

From: Troy Figiel <troy <at> troyfigiel.com>
To: 67143 <at> debbugs.gnu.org
Subject: [PATCH v2] gnu: Add python-pyreadstat.
Date: Sun, 7 Jan 2024 17:40:35 +0100
* gnu/packages/statistics.scm (python-pyreadstat): New variable.
---
 gnu/local.mk                                  |  2 +
 .../python-pyreadstat-link-libiconv.patch     | 15 +++++++
 gnu/packages/statistics.scm                   | 45 +++++++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 gnu/packages/patches/python-pyreadstat-link-libiconv.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3548b5eb3d..09c4dbaa46 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -62,6 +62,7 @@
 # Copyright © 2023 B. Wilson <elaexuotee <at> wilsonb.com>
 # Copyright © 2023 gemmaro <gemmaro.dev <at> gmail.com>
 # Copyright © 2023 Herman Rimm <herman <at> rimm.ee>
+# Copyright © 2023 Troy Figiel <troy <at> troyfigiel.com>
 #
 # This file is part of GNU Guix.
 #
@@ -1775,6 +1776,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-louvain-fix-test.patch		\
   %D%/packages/patches/python-random2-getrandbits-test.patch		\
   %D%/packages/patches/python-poppler-qt5-fix-build.patch	\
+  %D%/packages/patches/python-pyreadstat-link-libiconv.patch	\
   %D%/packages/patches/python-pypdf-annotate-tests-appropriately.patch	\
   %D%/packages/patches/python-pytorch2-system-libraries.patch	\
   %D%/packages/patches/python-sip-include-dirs.patch	\
diff --git a/gnu/packages/patches/python-pyreadstat-link-libiconv.patch b/gnu/packages/patches/python-pyreadstat-link-libiconv.patch
new file mode 100644
index 0000000000..7efd71faeb
--- /dev/null
+++ b/gnu/packages/patches/python-pyreadstat-link-libiconv.patch
@@ -0,0 +1,15 @@
+To ensure libiconv can be found by Guix, we need to link the library.
+
+--- a/setup.py
++++ b/setup.py
+@@ -81,8 +81,7 @@ else:
+     libraries.extend(["m", "z"])
+     _platform = sys.platform
+     # Mac: iconv needs to be linked statically
+-    if _platform.lower().startswith("darwin"):
+-        libraries.append("iconv")
++    libraries.append("iconv")
+ 
+ # Extensions
+ sources.sort()
+
diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index 712b1a9c37..906ec456b6 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2021 Frank Pursel <frank.pursel <at> gmail.com>
 ;;; Copyright © 2022 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2023 gemmaro <gemmaro.dev <at> gmail.com>
+;;; Copyright © 2023 Troy Figiel <troy <at> troyfigiel.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -6919,6 +6920,50 @@ (define-public readstat
 popular stats packages like SAS, Stata and SPSS.")
     (license license:expat)))
 
+(define-public python-pyreadstat
+  (package
+    (name "python-pyreadstat")
+    (version "1.2.4")
+    ;; No tests in the PyPI tarball.
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/Roche/pyreadstat")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0zysrzixvqw2lwwykxqg5yj8a0zyv5s2bmk22x30f4rj2hgvq1pv"))
+       (patches (search-patches "python-pyreadstat-link-libiconv.patch"))))
+    (arguments
+     '(#:phases (modify-phases %standard-phases
+                  (add-before 'check 'change-home-dir
+                    (lambda _
+                      ;; test_sav_expand and test_sav_write_basic_expanduser need a
+                      ;; home directory with write permissions.
+                      (setenv "HOME" "/tmp")))
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        ;; The source also contains tests/test_version.py
+                        ;; which checks the version in __init__.py against the
+                        ;; one in setup.py. Since this requires texlive
+                        ;; dependencies to run and is also not mentioned in
+                        ;; how_to_test.md, this test is skipped.
+                        (invoke "python" "tests/test_basic.py")))))))
+    (build-system python-build-system)
+    (propagated-inputs (list python-pandas))
+    (inputs (list libiconv zlib))
+    (native-inputs (list python-cython-3))
+    (home-page "https://github.com/Roche/pyreadstat")
+    (synopsis
+     "Read and write SAS, SPSS and Stata files into/from Pandas DataFrames")
+    (description
+     "This Python package can be used to read and write SAS, SPSS and Stata
+files into/from Pandas DataFrames.  It is a wrapper around the C library
+@code{readstat}.")
+    (license license:asl2.0)))
+
 (define-public r-quantpsyc
   (package
     (name "r-quantpsyc")

base-commit: 5f8a993aa85554ca09bd27139230d7664107e1b6
-- 
2.42.0





Reply sent to Mathieu Othacehe <othacehe <at> gnu.org>:
You have taken responsibility. (Tue, 09 Jan 2024 09:16:01 GMT) Full text and rfc822 format available.

Notification sent to Troy Figiel <troy <at> troyfigiel.com>:
bug acknowledged by developer. (Tue, 09 Jan 2024 09:16:01 GMT) Full text and rfc822 format available.

Message #16 received at 67143-done <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Troy Figiel <troy <at> troyfigiel.com>
Cc: 67143-done <at> debbugs.gnu.org
Subject: Re: [bug#67143] [PATCH v2] gnu: Add python-pyreadstat.
Date: Tue, 09 Jan 2024 10:14:58 +0100
Hello,

> * gnu/packages/statistics.scm (python-pyreadstat): New variable.
> ---
>  gnu/local.mk                                  |  2 +
>  .../python-pyreadstat-link-libiconv.patch     | 15 +++++++

You need to comment those in the commit message as well.

I fixed that and applied,

Thanks,

Mathieu




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 06 Feb 2024 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 93 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.