easyblock = 'Bundle'

name = 'ELIC_R'
version = '1'
versionsuffix = '-R-%(rver)s'

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

toolchain = {'name': 'foss', 'version': '2019a'}

dependencies = [
    ('R', '3.6.0'),
    ('GEOS', '3.7.2', '-Python-3.7.2'),
    ('GDAL', '3.0.0', '-Python-3.7.2'),
    ('PostgreSQL', '11.3', '-Python-3.7.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)")

# CRAN packages on which these Bioconductor packages depend are available in R module on which this depends
# !! order of packages is important !!
# packages updated on Oct 9th 2019
exts_list = [
    ('rgdal', '1.4-4'),
    ('gdalUtils', '2.0.1.14'),
    ('ncdf4', '1.16.1'),
    ('gdtools', '0.1.9'),
    ('leaflet', '2.0.2'),
    ('satellite', '1.0.1'),
    ('sf', '0.7-7'),
    ('svglite', '1.2.2'),
    ('leafem', '0.0.1'),
    ('leafpop', '0.0.1'),
    ('mapview', '2.7.0'),
    ('MuMIn', '1.43.6'),
    ('intervals', '0.15.1'),
    ('spacetime', '1.2-2'),
    ('gstat', '2.0-3'),
    ('RNetCDF', '1.9-1'),
    ('automap', '1.0-14'),
    ('clhs', '0.7-2'),
    ('rasterVis', '0.45'),
    ('reporttools', '1.1.2'),
    ('rgeos', '0.4-3'),
    ('RandomFieldsUtils', '0.5.3'),
    ('RandomFields', '3.3.6'),
    ('rworldmap', '1.3-6'),
    ('rworldxtra', '1.01'),
    ('colorRamps', '2.3'),
    ('mapdata', '2.3.0'),
    ('mapproj', '1.2.6'),
    ('RPostgreSQL', '0.6-2'),
    ('getPass', '0.2-2'),
    ('stringdist', '0.9.5.2'),
    ('here', '0.1'),
    ('svMisc', '1.1.0'),
    ('networkD3', '0.4'),
    ('cmsaf', '1.9.5'),
    ('treemap', '2.4-2'),
    ('RPostgres', '1.1.1'),
    ('nzelect', '0.4.0'),
    ('wordcloud', '2.6'),
    ('ngram', '3.0.4'),
    ('rtweet', '0.6.9'),
    ('lettercase', '0.13.1'),
    ('xgboost', '0.90.0.2'),
    ('rts', '1.0-49'),
    ('RgoogleMaps', '1.4.4'),
    ('ggmap', '3.0.0'),
    ('packrat','0.5.0'),
    ('rsconnect', '0.8.13'),
    ('rpostgis', '1.4.2'),
    ('aws.signature', '0.5.2'),
    ('aws.s3', '0.3.21'),
    ('geosphere', '1.5-10'),
    ('fuzzyjoin', '0.1.4'),
    ('refinr', '0.3.1'),
    ('x13binary', '1.1.39-2'),
    ('seasonal', '1.7.0'),
    ('mitools', '2.4'),
    ('survey', '3.36'),
    ('hts','5.1.5'),
    ('thief', '0.3'),
    ('forecastHybrid', '4.2.17'),
    ('ggseas', '0.5.4'),
    ('sysfonts', '0.8'),
    ('showtextdb', '2.0'),
    ('showtext', '0.7'),
    ('BiocManager', '1.30.4'),
    ('rvcheck', '0.1.5'),
    ('scatterpie', '0.1.3'),
    ('velox', '0.2.0'),
    ('rlist', '0.4.6.1'),
    ('measurements', '1.4.0'),
    ('shinyFiles', '0.7.3'),
    ('shinyjs', '1.0'),
    ('colourpicker', '1.0'),
    ('qpdf', '1.1'),
    ('fda', '2.4.8'),
    ('fda.usc', '1.5.0'),
    # MAJ
    ('backports', '1.1.5'),
    ('deldir', '0.1-23'),
    ('digest', '0.6.21'),
    ('ellipsis', '0.3.0'),
    ('ggplot2', '3.2.1'),
    ('gstat', '2.0-3'),
    ('pillar', '1.4.2'),
    ('pkgconfig', '2.0.3'),
    ('Rcpp', '1.0.2'),
    ('rlang', '0.4.0'),
    ('spatstat', '1.61-0'),
    ('vctrs', '0.2.0'),
    ('zoo', '1.8-6'),
    # TO TEST
    ('countrycode', '1.1.0'),
    ('itcSegment', '0.8'),
    ('owmr', '0.8.1'),
    ('rwunderground', '0.1.8'),
    ('corrplot', '0.84'),
    ('prettymapr', '0.2.2'),
    ('prospectr', '0.1.3'),
    ('rosm', '0.2.5'),
    ('rpart.plot', '3.0.8'),
    ('varhandle', '2.0.4'),
    ('expint', '0.1-6'),
    ('actuar', '2.3-3'),
    ('nortest', '1.0-4'),
    ('fasterize', '1.0.0'),
    ('spdep', '1.1-3'),
    ('yaImpute', '1.0-31'),
    ('SpatialPack', '0.3-8'),
    ('EnvStats', '2.3.1'),
    ('spatialEco', '1.2-1'),
    ('snakecase', '0.11.0'),
    # NA
    #('spptest', NA
    #('package_vector', NA
    #('countriesHigh', NA
    #('pdftools', '2.2'), deb: libpoppler-cpp-dev OR rpm: poppler-cpp-devel
    #('ggExtra', NA
]

modextrapaths = {'R_LIBS': ''}

postinstallcmds = [
    "cd %(installdir)s && " +
    'Rscript -e "install.packages(\'remotes\', repos=\'https://www.freestatistics.org/cran/\', lib=\'%(installdir)s\')"; Rscript -e "library(remotes); install_github(\'myllym/GET\', lib=\'%(installdir)s\')"'
]

sanity_check_paths = {
    'files': [],
    'dirs': ['ncdf4', 'sf', 'mapview'],
}

moduleclass = 'numlib'
