Skip to content

Commit

Permalink
Trac #29441: upgrade rpy2 package 2.8.2 -> 3.3.5, upgrade R to 3.6.3,…
Browse files Browse the repository at this point in the history
… add new dependencies

Main changes:
- [[https://pypi.org/project/rpy2/]], supports python >= 3.6
- `cygwin.patch` does not apply anymore
- [[https://pypi.org/project/cffi/|cffi>=1.13.1]] is a new dependency,
we install latest 1.14.0 (supports python >= 3.2)
- [[https://pypi.org/project/pycparser/|pycparser]] is a new dependency
(required by cffi, supports python >= 3.4)
- [[https://pypi.org/project/tzlocal/]] is a new dependency, we install
latest 2.1 (supports python >= 2.7)
- [[https://pypi.org/project/pytz/]] is a new dependency, we update to
latest 2020.1 (supports python >= 2.4)

- add small patches to `setup.py` that
  - disables printing on `stdout` (that perturbs `pip`) - accepted
upstream
  - removes the build dependency on `pytest`
- some more dependencies (pytest, numpy, tzlocal) conditional on
SAGE_CHECK!=no

tarballs: see `checksums.ini` (to download automatically, use
`./configure --enable-download-from-upstream-url`)

Upstream issues and PR
- rpy2/rpy2#670
- ​rpy2/rpy2#716

URL: https://trac.sagemath.org/29441
Reported by: vdelecroix
Ticket author(s): Vincent Delecroix, Matthias Koeppe
Reviewer(s): Emmanuel Charpentier, Dima Pasechnik
  • Loading branch information
Release Manager committed Jul 29, 2020
2 parents 2fd5c17 + 54d0f99 commit a901400
Show file tree
Hide file tree
Showing 31 changed files with 213 additions and 128 deletions.
15 changes: 15 additions & 0 deletions build/pkgs/cffi/SPKG.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
= cffi =

== Description ==

development website: https://foss.heptapod.net/pypy/cffi
documentation website: https://cffi.readthedocs.io/en/latest/
PyPI page: https://pypi.org/project/cffi/

== License ==

* MIT

== Upstream Contact ==

* https://foss.heptapod.net/pypy/cffi
5 changes: 5 additions & 0 deletions build/pkgs/cffi/checksums.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tarball=cffi-VERSION.tar.gz
sha1=2a8f05a7d51d77ef1e641cb359a54e4d8fa019cb
md5=74845f8d2b7b583dd9a3574f402edf39
cksum=1594930691
upstream_url=https://pypi.io/packages/source/c/cffi/cffi-VERSION.tar.gz
5 changes: 5 additions & 0 deletions build/pkgs/cffi/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$(PYTHON) | $(PYTHON_TOOLCHAIN)

----------
All lines of this file are ignored except the first.
It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile.
1 change: 1 addition & 0 deletions build/pkgs/cffi/package-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.14.0
1 change: 1 addition & 0 deletions build/pkgs/cffi/spkg-install.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd src && sdh_pip_install .
1 change: 1 addition & 0 deletions build/pkgs/cffi/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
standard
15 changes: 15 additions & 0 deletions build/pkgs/pycparser/SPKG.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
= pycparser =

== Description ==

development website: https://github.com/eliben/pycparser
PyPI page: https://pypi.org/project/pycparser/

== License ==

* BSD

== Upstream Contact ==

* https://github.com/eliben/pycparser

5 changes: 5 additions & 0 deletions build/pkgs/pycparser/checksums.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tarball=pycparser-VERSION.tar.gz
sha1=0ae93d89b69fab48af3a407a2f8663bcea270c3d
md5=b8f88de737db8c346ee8d31c07c7a25a
cksum=3289554032
upstream_url=https://pypi.io/packages/source/p/pycparser/pycparser-VERSION.tar.gz
5 changes: 5 additions & 0 deletions build/pkgs/pycparser/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$(PYTHON) | $(PYTHON_TOOLCHAIN)

----------
All lines of this file are ignored except the first.
It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile.
1 change: 1 addition & 0 deletions build/pkgs/pycparser/package-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.20
1 change: 1 addition & 0 deletions build/pkgs/pycparser/spkg-install.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd src && sdh_pip_install .
1 change: 1 addition & 0 deletions build/pkgs/pycparser/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
standard
9 changes: 5 additions & 4 deletions build/pkgs/pytz/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tarball=pytz-VERSION.tar.bz2
sha1=8a01d7f19c8b8b189827e026b76c51be4b537b89
md5=4b91594c440aa20c76ac92043efa75e1
cksum=591864951
tarball=pytz-VERSION.tar.gz
sha1=60f6db35e92688c4701c16bd3d2b9cbfac1fd604
md5=0349106ac02f2bfe565dd6d5594e3a15
cksum=1599443821
upstream_url=https://pypi.io/packages/source/p/pytz/pytz-VERSION.tar.gz
2 changes: 1 addition & 1 deletion build/pkgs/pytz/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2018.7
2020.1
7 changes: 4 additions & 3 deletions build/pkgs/r/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tarball=R-VERSION.tar.gz
sha1=8eda2af51d63877fcc6674274b6801af605173c5
md5=90d23d138cee26d275da14b58296e521
cksum=1222866983
sha1=d2383dabc0d6c70f8a0171a0fb1bfdc31ddb5b52
md5=506c9576ba33e1262ad5b5624db9d96a
cksum=2403187565
upstream_url=https://cran.r-project.org/src/base/R-3/R-VERSION.tar.gz
2 changes: 1 addition & 1 deletion build/pkgs/r/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.2.p0
3.6.3
8 changes: 8 additions & 0 deletions build/pkgs/r/spkg-install.in
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ fi
# See patches/R.sh.patch
export SAGE_BUILDING_R=yes

R_HOME="$SAGE_LOCAL"/lib/R
# Set LDFLAGS as it is done in sage-env for $SAGE_LOCAL/lib
LDFLAGS="-L$R_HOME/lib -Wl,-rpath,$R_HOME/lib $LDFLAGS"
if [ "$UNAME" = "Linux" ]; then
LDFLAGS="-Wl,-rpath-link,$R_HOME/lib $LDFLAGS"
fi
export LDFLAGS

config() {
sdh_configure --enable-R-shlib --with-recommended-packages \
--with-readline=yes --with-x=$XSUPPORT \
Expand Down
7 changes: 4 additions & 3 deletions build/pkgs/rpy2/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tarball=rpy2-VERSION.tar.gz
sha1=24f7c538a734618dfcf2343304729c0b1e429717
md5=729946166b43103db7697e69db8c5c45
cksum=3858682977
sha1=af1c7ffe900233ac5add5195f106299bd72fd575
md5=8a5db07798763b9c6672b5f80451b944
cksum=828149660
upstream_url=https://pypi.io/packages/source/r/rpy2/rpy2-VERSION.tar.gz
2 changes: 1 addition & 1 deletion build/pkgs/rpy2/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(PYTHON) r six | $(PYTHON_TOOLCHAIN)
$(PYTHON) r cffi tzlocal pytz | $(PYTHON_TOOLCHAIN) pycparser $(and $(filter-out no,$(SAGE_CHECK_rpy2)), pytest numpy)

----------
All lines of this file are ignored except the first.
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/rpy2/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.8.2.p1
3.3.5
89 changes: 89 additions & 0 deletions build/pkgs/rpy2/patches/716.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
From 87d0f82e2f4be94893881913018ca9085c0ff8e5 Mon Sep 17 00:00:00 2001
From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
Date: Fri, 3 Jul 2020 12:47:41 -0700
Subject: [PATCH] setup.py: Print CFFI configuration messages only on build

---
setup.py | 44 ++++++++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/setup.py b/setup.py
index e4337838..7fead893 100755
--- a/setup.py
+++ b/setup.py
@@ -21,6 +21,7 @@
from rpy2 import situation

from setuptools import setup
+from distutils.command.build import build as du_build

PACKAGE_NAME = 'rpy2'
pack_version = __import__('rpy2').__version__
@@ -111,7 +112,6 @@ def get_r_c_extension_status():


cffi_mode = situation.get_cffi_mode()
-print('cffi mode: %s' % cffi_mode)
c_extension_status = get_r_c_extension_status()
if cffi_mode == situation.CFFI_MODE.ABI:
cffi_modules = ['rpy2/_rinterface_cffi_build.py:ffibuilder_abi']
@@ -135,6 +135,30 @@ def get_r_c_extension_status():
# This should never happen.
raise ValueError('Invalid value for cffi_mode')

+class build(du_build):
+
+ def run(self):
+ print('cffi mode: %s' % cffi_mode)
+
+ du_build.run(self)
+
+ print('---')
+ print(cffi_mode)
+ if cffi_mode in (situation.CFFI_MODE.ABI,
+ situation.CFFI_MODE.BOTH,
+ situation.CFFI_MODE.ANY):
+ print('ABI mode interface built.')
+ if cffi_mode in (situation.CFFI_MODE.API,
+ situation.CFFI_MODE.BOTH):
+ print('API mode interface built.')
+ if cffi_mode == situation.CFFI_MODE.ANY:
+ if c_extension_status == COMPILATION_STATUS.OK:
+ print('API mode interface built.')
+ else:
+ print('API mode interface not built because: %s' % c_extension_status)
+ print('To change the API/ABI build mode, set or modify the environment '
+ 'variable RPY2_CFFI_MODE.')
+
LONG_DESCRIPTION = """
Python interface to the R language.

@@ -168,6 +192,7 @@ def get_r_c_extension_status():
install_requires=requires + ['cffi>=1.10.0'],
setup_requires=['cffi>=1.10.0'],
cffi_modules=cffi_modules,
+ cmdclass = dict(build=build),
package_dir=pack_dir,
packages=([PACKAGE_NAME] +
['{pack_name}.{x}'.format(pack_name=PACKAGE_NAME, x=x)
@@ -193,20 +218,3 @@ def get_r_c_extension_status():
package_data={'rpy2': ['rinterface_lib/R_API.h',
'rinterface_lib/R_API_eventloop.h']}
)
-
- print('---')
- print(cffi_mode)
- if cffi_mode in (situation.CFFI_MODE.ABI,
- situation.CFFI_MODE.BOTH,
- situation.CFFI_MODE.ANY):
- print('ABI mode interface built and installed.')
- if cffi_mode in (situation.CFFI_MODE.API,
- situation.CFFI_MODE.BOTH):
- print('API mode interface built and installed.')
- if cffi_mode == situation.CFFI_MODE.ANY:
- if c_extension_status == COMPILATION_STATUS.OK:
- print('API mode interface built and installed.')
- else:
- print('API mode interface not build because: %s' % c_extension_status)
- print('To change the API/ABI build mode, set or modify the environment '
- 'variable RPY2_CFFI_MODE.')
108 changes: 0 additions & 108 deletions build/pkgs/rpy2/patches/cygwin.patch

This file was deleted.

13 changes: 13 additions & 0 deletions build/pkgs/rpy2/patches/setup-no-pytest.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/setup.py b/setup.py
index a9f96f8..7ba69a1 100755
--- a/setup.py
+++ b/setup.py
@@ -142,7 +142,7 @@ ipython.
if __name__ == '__main__':
pack_dir = {PACKAGE_NAME: os.path.join(package_prefix, 'rpy2')}

- requires = ['pytest', 'jinja2', 'pytz', 'tzlocal']
+ requires = ['jinja2', 'pytz', 'tzlocal']

setup(
name=PACKAGE_NAME,
1 change: 1 addition & 0 deletions build/pkgs/rpy2/spkg-check.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
6 changes: 0 additions & 6 deletions build/pkgs/rpy2/spkg-install.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
if [ -z "$SAGE_LOCAL" ]; then
echo >&2 "SAGE_LOCAL undefined ... exiting"
echo >&2 "Maybe run 'sage --sh'?"
exit 1
fi

set -e

cd src
Expand Down
16 changes: 16 additions & 0 deletions build/pkgs/tzlocal/SPKG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pytz
====

Description
-----------

World Timezone Definitions for Python


Special Update/Build Instructions
---------------------------------

The upstream tarball was repackaged after sanitizing the file
permissions with

$ chmod go-w
5 changes: 5 additions & 0 deletions build/pkgs/tzlocal/checksums.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tarball=tzlocal-VERSION.tar.gz
sha1=7d2d590f68849e6b6371210bd808b40ec5619faf
md5=c0877603ff9de71cd8ca6ee2b50d2ebd
cksum=950088034
upstream_url=https://pypi.io/packages/source/t/tzlocal/tzlocal-VERSION.tar.gz
5 changes: 5 additions & 0 deletions build/pkgs/tzlocal/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$(PYTHON) | $(PYTHON_TOOLCHAIN)

----------
All lines of this file are ignored except the first.
It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile.
1 change: 1 addition & 0 deletions build/pkgs/tzlocal/package-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1
1 change: 1 addition & 0 deletions build/pkgs/tzlocal/spkg-install.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd src && sdh_pip_install .
1 change: 1 addition & 0 deletions build/pkgs/tzlocal/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
standard

0 comments on commit a901400

Please sign in to comment.