From 85726ec4286f6c8bdf20915005651a8e22dd7d6c Mon Sep 17 00:00:00 2001 From: Matthew-Supernaw-NOAA Date: Thu, 12 Oct 2023 15:00:48 -0400 Subject: [PATCH] switched to python --- DESCRIPTION | 19 ++++++++----------- clean.py | 8 ++++++++ clean.sh | 1 - configure | 2 +- run.py | 35 +++++++++++++++++++++++++++++++++++ run.sh | 12 ------------ 6 files changed, 52 insertions(+), 25 deletions(-) create mode 100644 clean.py delete mode 100755 clean.sh create mode 100644 run.py delete mode 100755 run.sh diff --git a/DESCRIPTION b/DESCRIPTION index b21fee4a..8d0f357c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,22 +1,19 @@ Package: processR Title: Concurrent processing in R Version: 1.0 -Authors@R: +Authors@R: person("Matthew", "Supernaw", , "matthew.supernaw@noaa.gov", role = c("aut", "cre")) Description: A multi-process package for R. License: GPL (>= 2) URL: https://github.com/nmfs-fish-tools/processR BugReports: https://github.com/nmfs-fish-tools/processR/issues -Depends: - R (>= 4.0.0) -Imports: - BH, - methods, - Rcpp (>= 1.0.10), - RInside -LinkingTo: - Rcpp, - RInside +Depends: R (>= 4.0.0) +Imports: BH, methods, Rcpp (>= 1.0.10), RInside +LinkingTo: Rcpp, RInside Encoding: UTF-8 RoxygenNote: 7.2.3 SystemRequirements: C++17 +NeedsCompilation: yes +Packaged: 2023-10-12 17:23:54 UTC; mattadmin +Author: Matthew Supernaw [aut, cre] +Maintainer: Matthew Supernaw diff --git a/clean.py b/clean.py new file mode 100644 index 00000000..ffbe82de --- /dev/null +++ b/clean.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +from pydefs.do_rm import do_rm + +do_rm('processRCMake_1.tar.gz') +do_rm('processRCMake.Rcheck') +do_rm('_library') +do_rm('mytest.Rout') diff --git a/clean.sh b/clean.sh deleted file mode 100755 index bd55bfb7..00000000 --- a/clean.sh +++ /dev/null @@ -1 +0,0 @@ -#!/bin/bash -e \ No newline at end of file diff --git a/configure b/configure index 9db93000..af2c62d8 100755 --- a/configure +++ b/configure @@ -7,7 +7,7 @@ which cmake RBIN=$(which R) -echo R --version +echo $(R --version) RHOME=$(${RBIN} --slave --no-save -e 'cat(R.home())') RUSER=$(${RBIN} --slave --no-save -e 'cat(Sys.getenv("R_LIBS_USER"))') diff --git a/run.py b/run.py new file mode 100644 index 00000000..1f92e8ba --- /dev/null +++ b/run.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +from pydefs.do_call import do_call + +import os +import platform +import subprocess +import sys + +do_call([sys.executable, 'clean.py']) + +if platform.system() == 'Windows': + do_call(['where', 'cmake'], fix_message='Install cmake, add cmake to PATH') + do_call(['where', 'R'], fix_message='Install R, add R.exe to PATH') + do_call(['where', 'sh'], fix_message='Install Rtools, add sh.exe to PATH') + do_call(['where', 'g++'], fix_message='Install Rtools, add g++.exe to PATH') +else: + do_call(['which', 'cmake']) + +local_library = os.path.join(os.getcwd(), '_library') +os.mkdir(local_library) + +packname = 'ProcessRCMake_1.0.tar.gz' + +logfiles = ['00install.out'] +logfiles = [os.path.join('ProcessRCMake.Rcheck', x) for x in logfiles] + +do_call(['R', 'CMD', 'build', '.']) +do_call(['R', 'CMD', 'check', packname], info_files=logfiles) +do_call(['R', 'CMD', 'INSTALL', '-l', local_library, packname]) + +result_out = os.path.join(os.getcwd(), 'mytest.Rout') +os.environ['R_LIBS_USER'] = local_library + + diff --git a/run.sh b/run.sh deleted file mode 100755 index 554b11e5..00000000 --- a/run.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -e - -set -x - -./clean.sh - -mkdir _library - -R CMD build . -R CMD INSTALL -l _library processR_0.0.1.tar.gz -#R CMD BATCH mytest.R || echo "mytest failed" -