1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-19 00:13:33 +00:00

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
This commit is contained in:
Po-Chuan Hsieh 2021-07-14 23:48:06 +08:00
parent fa80f820cf
commit 3482259da6
No known key found for this signature in database
GPG Key ID: 9A4BD10F002DD04B
7 changed files with 116 additions and 0 deletions

View File

@ -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

28
math/py-pyreadr/Makefile Normal file
View File

@ -0,0 +1,28 @@
# Created by: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
PORTNAME= pyreadr
PORTVERSION= 0.4.2
CATEGORIES= math python
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
MAINTAINER= sunpoet@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>

3
math/py-pyreadr/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1625585424
SHA256 (pyreadr-0.4.2.tar.gz) = a878d0ee60ae8eff7d58ddb24ae6bfbec23b824040dc9fb3529b7104f039210f
SIZE (pyreadr-0.4.2.tar.gz) = 1179813

View File

@ -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>

View File

@ -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

View File

@ -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')

View File

@ -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