git: 3482259da6b9 - main - math/py-pyreadr: Add py-pyreadr 0.4.2

Po-Chuan Hsieh sunpoet at FreeBSD.org
Wed Jul 14 16:16:27 UTC 2021


The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3482259da6b939bedcde374ce94d3833a333a748

commit 3482259da6b939bedcde374ce94d3833a333a748
Author:     Po-Chuan Hsieh <sunpoet at FreeBSD.org>
AuthorDate: 2021-07-14 15:48:06 +0000
Commit:     Po-Chuan Hsieh <sunpoet at FreeBSD.org>
CommitDate: 2021-07-14 16:09:35 +0000

    math/py-pyreadr: Add py-pyreadr 0.4.2
    
    pyreadr is a python package to read and write R RData and Rds files into/from
    pandas dataframes. It does not need to have R or other external dependencies
    installed.
    
    WWW: https://github.com/ofajardo/pyreadr
---
 math/Makefile                                    |  1 +
 math/py-pyreadr/Makefile                         | 28 ++++++++++++++++++
 math/py-pyreadr/distinfo                         |  3 ++
 math/py-pyreadr/files/patch-pyreadr-librdata.c   | 36 ++++++++++++++++++++++++
 math/py-pyreadr/files/patch-pyreadr-librdata.pxd | 20 +++++++++++++
 math/py-pyreadr/files/patch-setup.py             | 23 +++++++++++++++
 math/py-pyreadr/pkg-descr                        |  5 ++++
 7 files changed, 116 insertions(+)

diff --git a/math/Makefile b/math/Makefile
index 480c044b041a..c02a3a998a8b 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -872,6 +872,7 @@
     SUBDIR += py-pynndescent
     SUBDIR += py-pyodeint
     SUBDIR += py-pyodesys
+    SUBDIR += py-pyreadr
     SUBDIR += py-pysmt
     SUBDIR += py-pystan
     SUBDIR += py-pysym
diff --git a/math/py-pyreadr/Makefile b/math/py-pyreadr/Makefile
new file mode 100644
index 000000000000..958593b53240
--- /dev/null
+++ b/math/py-pyreadr/Makefile
@@ -0,0 +1,28 @@
+# Created by: Po-Chuan Hsieh <sunpoet at FreeBSD.org>
+
+PORTNAME=	pyreadr
+PORTVERSION=	0.4.2
+CATEGORIES=	math python
+MASTER_SITES=	CHEESESHOP
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	sunpoet at FreeBSD.org
+COMMENT=	Read/write R RData and Rds files into/from pandas data frames
+
+LICENSE=	AGPLv3+
+
+LIB_DEPENDS=	librdata.so:math/librdata
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pandas>=0.24.0:math/py-pandas@${PY_FLAVOR}
+
+USES=		localbase python
+USE_PYTHON=	autoplist concurrent cython distutils
+
+post-patch:
+# Clean up bundled libraries
+	@${RM} -fr ${WRKSRC}/pyreadr/libs/
+	@${RM} -fr ${WRKSRC}/win_libs/
+
+post-install:
+	${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/pyreadr/librdata${PYTHON_EXT_SUFFIX}.so
+
+.include <bsd.port.mk>
diff --git a/math/py-pyreadr/distinfo b/math/py-pyreadr/distinfo
new file mode 100644
index 000000000000..387a4e68e566
--- /dev/null
+++ b/math/py-pyreadr/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1625585424
+SHA256 (pyreadr-0.4.2.tar.gz) = a878d0ee60ae8eff7d58ddb24ae6bfbec23b824040dc9fb3529b7104f039210f
+SIZE (pyreadr-0.4.2.tar.gz) = 1179813
diff --git a/math/py-pyreadr/files/patch-pyreadr-librdata.c b/math/py-pyreadr/files/patch-pyreadr-librdata.c
new file mode 100644
index 000000000000..d708f7f8dadb
--- /dev/null
+++ b/math/py-pyreadr/files/patch-pyreadr-librdata.c
@@ -0,0 +1,36 @@
+--- pyreadr/librdata.c.orig	2021-06-07 07:39:42 UTC
++++ pyreadr/librdata.c
+@@ -4,8 +4,6 @@
+ {
+     "distutils": {
+         "depends": [
+-            "pyreadr/libs/librdata/src/rdata.h",
+-            "pyreadr/libs/librdata/src/rdata_io_unistd.h"
+         ],
+         "extra_compile_args": [
+             "-DHAVE_ZLIB",
+@@ -23,13 +21,6 @@
+         "name": "pyreadr.librdata",
+         "sources": [
+             "pyreadr/librdata.pyx",
+-            "pyreadr/libs/librdata/src/CKHashTable.c",
+-            "pyreadr/libs/librdata/src/rdata_bits.c",
+-            "pyreadr/libs/librdata/src/rdata_error.c",
+-            "pyreadr/libs/librdata/src/rdata_io_unistd.c",
+-            "pyreadr/libs/librdata/src/rdata_parser.c",
+-            "pyreadr/libs/librdata/src/rdata_read.c",
+-            "pyreadr/libs/librdata/src/rdata_write.c"
+         ]
+     },
+     "module_name": "pyreadr.librdata"
+@@ -645,8 +636,8 @@ static CYTHON_INLINE float __PYX_NAN() {
+ #include <time.h>
+ #include <stdint.h>
+ #include <sys/types.h>
+-#include "libs/librdata/src/rdata.h"
+-#include "libs/librdata/src/rdata_io_unistd.h"
++#include <rdata.h>
++#include <rdata_io_unistd.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <fcntl.h>
diff --git a/math/py-pyreadr/files/patch-pyreadr-librdata.pxd b/math/py-pyreadr/files/patch-pyreadr-librdata.pxd
new file mode 100644
index 000000000000..7b09086fc162
--- /dev/null
+++ b/math/py-pyreadr/files/patch-pyreadr-librdata.pxd
@@ -0,0 +1,20 @@
+--- pyreadr/librdata.pxd.orig	2020-12-09 08:50:11 UTC
++++ pyreadr/librdata.pxd
+@@ -11,7 +11,7 @@ cdef extern from '<sys/types.h>':
+ cdef extern from 'Python.h':
+     object PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len)
+ 
+-cdef extern from 'libs/librdata/src/rdata.h':
++cdef extern from '<rdata.h>':
+ 
+     cdef enum rdata_type_t 'rdata_type_e':
+         RDATA_TYPE_STRING
+@@ -128,7 +128,7 @@ cdef extern from 'libs/librdata/src/rdata.h':
+     rdata_error_t rdata_end_table(rdata_writer_t *writer, int32_t row_count, const char *datalabel);
+     rdata_error_t rdata_end_file(rdata_writer_t *writer);
+ 
+-cdef extern from 'libs/librdata/src/rdata_io_unistd.h':
++cdef extern from '<rdata_io_unistd.h>':
+     cdef struct rdata_unistd_io_ctx_t 'rdata_unistd_io_ctx_s':
+         int fd
+ 
diff --git a/math/py-pyreadr/files/patch-setup.py b/math/py-pyreadr/files/patch-setup.py
new file mode 100644
index 000000000000..546a07909986
--- /dev/null
+++ b/math/py-pyreadr/files/patch-setup.py
@@ -0,0 +1,23 @@
+--- setup.py.orig	2021-06-07 06:47:51 UTC
++++ setup.py
+@@ -13,7 +13,6 @@ from setuptools import setup, Extension
+ from Cython.Build import cythonize
+ 
+ librdata_source_files = []
+-librdata_source_files += glob.glob('pyreadr/libs/librdata/src/*.c')
+ librdata_source_files += ['pyreadr/librdata.pyx']
+ 
+ library_dirs = []
+@@ -52,10 +51,11 @@ elif platform.system() == 'Windows':
+     libraries.append('bz2')
+     libraries.append('lzma')
+     
+-elif platform.system() == 'Linux':
++elif platform.system() == 'FreeBSD' or platform.system() == 'Linux':
+     libraries.append('z')
+     libraries.append('bz2')
+     libraries.append('lzma')
++    libraries.append('rdata')
+     #extra_compile_args.append("--std=gnu99")
+ else:
+     raise RuntimeError('Unsupported OS')
diff --git a/math/py-pyreadr/pkg-descr b/math/py-pyreadr/pkg-descr
new file mode 100644
index 000000000000..f3758a909c25
--- /dev/null
+++ b/math/py-pyreadr/pkg-descr
@@ -0,0 +1,5 @@
+pyreadr is a python package to read and write R RData and Rds files into/from
+pandas dataframes. It does not need to have R or other external dependencies
+installed.
+
+WWW: https://github.com/ofajardo/pyreadr


More information about the dev-commits-ports-main mailing list