Changeset: 65581bae6c3a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=65581bae6c3a
Modified Files:
        monetdb5/extras/rapi/rapi.c
        testing/Mtest.py.in
Branch: Jun2020
Log Message:

Incompatible change in R 4.0.0.


diffs (105 lines):

diff --git a/monetdb5/extras/rapi/rapi.c b/monetdb5/extras/rapi/rapi.c
--- a/monetdb5/extras/rapi/rapi.c
+++ b/monetdb5/extras/rapi/rapi.c
@@ -30,6 +30,7 @@
 
 #define USE_RINTERNALS 1
 
+#include <Rversion.h>
 #include <Rembedded.h>
 #include <Rdefines.h>
 #include <Rinternals.h>
@@ -110,25 +111,28 @@ static char *RAPIinitialize(void) {
        // set some command line arguments
        {
                structRstart rp;
-               Rstart Rp = &rp;
                char *rargv[] = { "R", "--slave", "--vanilla" };
                int stat = 0;
 
-               R_DefParams(Rp);
-               Rp->R_Slave = (Rboolean) TRUE;
-               Rp->R_Quiet = (Rboolean) TRUE;
-               Rp->R_Interactive = (Rboolean) FALSE;
-               Rp->R_Verbose = (Rboolean) FALSE;
-               Rp->LoadSiteFile = (Rboolean) FALSE;
-               Rp->LoadInitFile = (Rboolean) FALSE;
-               Rp->RestoreAction = SA_NORESTORE;
-               Rp->SaveAction = SA_NOSAVE;
-               Rp->NoRenviron = TRUE;
+               R_DefParams(&rp);
+#if R_VERSION >= R_Version(4,0,0)
+               rp.R_NoEcho = (Rboolean) TRUE;
+#else
+               rp.R_Slave = (Rboolean) TRUE;
+#endif
+               rp.R_Quiet = (Rboolean) TRUE;
+               rp.R_Interactive = (Rboolean) FALSE;
+               rp.R_Verbose = (Rboolean) FALSE;
+               rp.LoadSiteFile = (Rboolean) FALSE;
+               rp.LoadInitFile = (Rboolean) FALSE;
+               rp.RestoreAction = SA_NORESTORE;
+               rp.SaveAction = SA_NOSAVE;
+               rp.NoRenviron = TRUE;
                stat = Rf_initialize_R(2, rargv);
                if (stat < 0) {
                        return "Rf_initialize failed";
                }
-               R_SetParams(Rp);
+               R_SetParams(&rp);
        }
 
        /* disable stack checking, because threads will throw it off */
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -3657,8 +3657,29 @@ def main(argv) :
         dft['MALCLIENT']      = "'mclient -lmal -ftest -tnone -Eutf-8'"
         dft['SQLCLIENT']      = "'mclient -lsql -ftest -tnone -Eutf-8'"
         dft['SQLDUMP']        = "'msqldump -q'"
-        dft['RCLIENT']        = "'R --vanilla --slave'"
-        dft['RUBYCLIENT']        = "'ruby'"
+        dft['RUBYCLIENT']     = "'ruby'"
+
+        r_noecho = '--no-echo'
+        if CheckExec('R'):
+            proc = process.Popen(['R', '--version'],
+                                 stdout = process.PIPE, stderr = process.PIPE,
+                                 universal_newlines = True)
+            r_out, r_err = proc.communicate()
+            res = re.search(r'R version (?P<major>\d+)\.', r_out)
+            if res is not None and int(res.group('major')) < 4:
+                r_noecho = '--slave'
+            if CONDITIONALS['HAVE_LIBR']:
+                proc = process.Popen(['R', r_noecho, '--no-save', 
'--no-restore',
+                                      '-e', 
'print(Sys.getenv("R_LIBS_USER"))'],
+                                     stdout = process.PIPE, stderr = 
process.PIPE,
+                                     universal_newlines = True)
+                r_out, r_err = proc.communicate()
+                res = re.search(r'\[\d+\] "(?P<dir>.*)"', r_out)
+                if res is not None:
+                    rdir = os.path.expanduser(res.group('dir'))
+                    if not os.path.exists(rdir):
+                        os.makedirs(rdir)
+        dft['RCLIENT'] = "'R --vanilla {}'".format(r_noecho)
 
     #par = {}
     # get current environment
@@ -3883,17 +3904,6 @@ def main(argv) :
             CONDITIONALS['HAVE_PERL'] = '#'
         else:
             print('Perl available, but MonetDB driver or DBI module not 
available')
-    if CONDITIONALS['HAVE_LIBR'] and CheckExec('R'):
-        proc = process.Popen(['R', '--slave', '--no-save', '--no-restore',
-                              '-e', 'print(Sys.getenv("R_LIBS_USER"))'],
-                             stdout = process.PIPE, stderr = process.PIPE,
-                             universal_newlines = True)
-        r_out, r_err = proc.communicate()
-        res = re.search(r'\[\d+\] "(?P<dir>.*)"', r_out)
-        if res is not None:
-            rdir = os.path.expanduser(res.group('dir'))
-            if not os.path.exists(rdir):
-                os.makedirs(rdir)
     if CheckExec('php'):
         phpcmd = ['php']
         if 'PHP_INCPATH' in os.environ:
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to