easyblock = 'Bundle'

name = 'ELIC_R'
version = '1'

homepage = 'https://gogs.elic.ucl.ac.be'
description = """This repo provides additional Python and R extensions for ELIC ecosystem."""

toolchain = {'name': 'foss', 'version': '2020b'}

dependencies = [
    ('R', '4.0.5'),
    ('GDAL', '3.2.1'),
    ('PostgreSQL', '13.2'),
]

exts_default_options = {
    'source_urls': [
        'https://cran.r-project.org/src/contrib/Archive/%(name)s',  # package archive
        'https://cran.r-project.org/src/contrib/',  # current version of packages
        'https://cran.freestatistics.org/src/contrib',  # mirror alternative for current packages
    ],
    'source_tmpl': '%(name)s_%(version)s.tar.gz'
}

exts_defaultclass = 'RPackage'
exts_filter = ("R -q --no-save", "library(%(ext_name)s)")

modextrapaths = {'R_LIBS': ''}

postinstallcmds = [
    "cd %(installdir)s && " +
    'Rscript -e "install.packages(c(\'rgdal\', \'gdalUtils\', \'ncdf4\', \'gdtools\', \'leaflet\', \'satellite\', \'sf\', \'svglite\', \'leafem\', \'leafpop\', \'mapview\', \'MuMIn\', \'intervals\', \'spacetime\', \'gstat\', \'RNetCDF\', \'automap\', \'clhs\', \'reporttools\', \'rgeos\', \'RandomFieldsUtils\', \'RandomFields\', \'rworldmap\', \'rworldxtra \', \'colorRamps\', \'mapdata\', \'mapproj\', \'RPostgreSQL\', \'getPass\', \'stringdist\', \'here\', \'svMisc\', \'networkD3\', \'cmsaf\', \'RPostgres\', \'nzelect\', \'wordcloud\', \'ngram\', \'rtweet\', \'lettercase\', \'xgboost\', \'rts\', \'RgoogleMaps\', \'packrat\', \'rsconnect\', \'rpostgis\', \'aws.signature\', \'aws.s3\', \'geosphere\', \'fuzzyjoin\', \'refinr\', \'x13binary\', \'seasonal\', \'mitools\', \'survey\', \'sysfonts\', \'showtextdb\', \'showtext\', \'BiocManager\', \'rvcheck\', \'scatterpie\', \'velox\', \'rlist\', \'measurements\', \'qpdf\', \'fda\', \'fda.usc\', \'gstat\', \'countrycode\', \'itcSegment\', \'owmr\', \'rwunderground\', \'corrplot\', \'prettymapr\', \'prospectr\', \'rosm\', \'rpart.plot\', \'varhandle\', \'expint\', \'actuar\'), repos=\'https://www.freestatistics.org/cran/\', lib=\'%(installdir)s\')" && ' +
    'Rscript -e "install.packages(c(\'treemap\', \'ggmap\', \'hts\', \'thief\', \'forecastHybrid\', \'ggseas\', \'colourpicker\', \'bsplus\', \'profvis\'), repos=\'https://www.freestatistics.org/cran/\', lib=\'%(installdir)s\')" && ' +
    'Rscript -e "library(remotes); install_github(\'myllym/GET\', lib=\'%(installdir)s\')" && ' +
    'Rscript -e "install.packages(c(\'shinyFiles\', \'shinyjs\', \'shinyhelper\', \'shinycssloaders\', \'shinyWidgets\', \'shinyBS\'), repos=\'http://cran.rstudio.com/\', lib=\'%(installdir)s\')" && ' +
    'Rscript -e "install.packages(c(\'jsonlite\', \'readxl\', \'tidyverse\', \'data.table\', \'lubridate\', \'stringdist\', \'stringi\', \'aws.s3\', \'snakecase\', \'fuzzyjoin\', \'Matrix\', \'RSelenium\'), repos=\'https://www.freestatistics.org/cran/\', lib=\'%(installdir)s\')"'
]

sanity_check_paths = {
    'files': [],
    'dirs': ['RPostgreSQL'],
}

moduleclass = 'numlib'
