Skip to content

Commit

Permalink
Merge pull request #19031 from boegel/20231017185930_new_pr_SNAP-ESA900
Browse files Browse the repository at this point in the history
{geo}[GCCcore/11.2.0] SNAP-ESA v9.0.0 + SNAP-ESA-python v9.0 w/ Python 2.7.18
  • Loading branch information
lexming authored Oct 23, 2023
2 parents c50d709 + be7f466 commit 3f0b015
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
easyblock = 'Bundle'

name = 'SNAP-ESA-python'
version = '9.0.0'
local_javasuffix = '-Java-%(javaver)s'
versionsuffix = local_javasuffix + '-Python-%(pyver)s'

homepage = 'https://step.esa.int/main/toolboxes/snap/'
description = "Python interface to the Sentinel Application Platform (SNAP) API"

toolchain = {'name': 'GCCcore', 'version': '11.2.0'}

dependencies = [
('Java', '11', '', SYSTEM),
('SNAP-ESA', version, local_javasuffix, SYSTEM),
('Python', '2.7.18'),
]

local_pysite = 'lib/python%(pyshortver)s/site-packages'
local_pyinstalldir = '%%(installdir)s/%s' % local_pysite

postinstallcmds = [
# Install snappy from SNAP-ESA
# snappy-conf is buggy and it hangs after doing the installation of snappy,
# start snappy-conf in a new SID and kill all processes of its PGID
# whenever it prints the final line starting with "or copy"
"mkdir -p %s" % local_pyinstalldir,
('LOG="$(mktemp -d)/snappy-conf.log"; mkfifo $LOG; trap "rm -f $LOG" EXIT;'
'setsid snappy-conf $EBROOTPYTHON/bin/python %s 2>&1 > $LOG & CONFPID=$!;'
'while read line; do echo "$line"; [ -z "${line##or copy*}" ] && kill -- -$CONFPID; done < $LOG;')
% local_pyinstalldir,
]

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

sanity_check_commands = ["python -c 'import snappy'"]

modextrapaths = {'PYTHONPATH': [local_pysite]}

local_javaopts = " -Dsnap.pythonExecutable=python"
local_javaopts += " -Dsnap.pythonModuleDir=%s" % local_pyinstalldir

# update $JAVA_TOOL_OPTIONS when module is loaded, use empty string as default value if $JAVA_TOOL_OPTIONS is not set
modluafooter = 'setenv("JAVA_TOOL_OPTIONS", (os.getenv("JAVA_TOOL_OPTIONS") or "") .. "%s")' % local_javaopts
# likewise, but when using Tcl as module syntax
local_tcl_JAVA_TOOL_OPTIONS = '[expr {[info exists ::env(JAVA_TOOL_OPTIONS)] ? $::env(JAVA_TOOL_OPTIONS) : ""}]'
modtclfooter = 'setenv JAVA_TOOL_OPTIONS [concat %s "%s"]' % (local_tcl_JAVA_TOOL_OPTIONS, local_javaopts)

moduleclass = 'geo'
71 changes: 71 additions & 0 deletions easybuild/easyconfigs/s/SNAP-ESA/SNAP-ESA-9.0.0-Java-11.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
easyblock = 'Binary'

name = 'SNAP-ESA'
version = '9.0.0'
versionsuffix = '-Java-%(javaver)s'

homepage = 'https://step.esa.int/main/toolboxes/snap/'
description = """
The Sentinel Application Platform (SNAP) is a common architecture for all
Sentinel Toolboxes being jointly developed by Brockmann Consult, SkyWatch and
C-S.
The SNAP architecture is ideal for Earth Observation processing and analysis
due to the following technological innovations: Extensibility, Portability,
Modular Rich Client Platform, Generic EO Data Abstraction, Tiled Memory
Management, and a Graph Processing Framework."""

toolchain = SYSTEM

local_installer = 'esa-snap_all_unix_%s.sh' % version.replace('.', '_')
local_varfile = 'SNAP-ESA-8.0-response.varfile'

source_urls = [
'https://download.esa.int/step/snap/%(version_major_minor)s/installers',
'https://step.esa.int/downloads/%(version_major_minor)s/installers',
]
sources = [local_installer]
patches = [(local_varfile, '.')]
checksums = [
{'esa-snap_all_unix_9_0_0.sh': 'ad6ef8c679c80c58660fe23ab5fb4974f9cd3ff4b119ad8e7e40dc79dbe03896'},
{'SNAP-ESA-8.0-response.varfile': '5ea98e3376bb3df52b9c4c99ab4986015296b815021e16486b58e4aad58e21a4'},
]

# The installation is executed with the bundled JRE 1.8.0_242 (Zulu)
# At runtime we switch to an external JDK (SNAP developers recommend any OpenJDK distribution)
dependencies = [
('Java', '11'),
]

install_cmd = "INSTALL4J_TEMP='%(builddir)s' "
install_cmd += "bash %s -dir '%%(installdir)s'" % local_installer
install_cmd += " -q -varfile '%s'" % local_varfile

postinstallcmds = [
# set paths
'sed -i "s|jdkhome.*|jdkhome=$JAVA_HOME|" %(installdir)s/etc/snap.conf',
'sed -i "s|#snap.home.*|snap.home=%(installdir)s|" %(installdir)s/etc/snap.properties',
# remove default maximum memory allocation pool
'sed -i "s|-J-Xmx[0-9G]* ||" %(installdir)s/etc/snap.conf',
# disable update checks
"echo 'snap.versionCheck.interval=NEVER' >> %(installdir)s/etc/snap.properties",
"sed -i 's|dpiaware=false|& -J-Dplugin.manager.check.interval=NEVER|' %(installdir)s/etc/snap.conf",
# (optional) update all modules to latest version
# the update command is buggy and it hangs after doing the update, kill it whenever it prints "updates=0"
# see issue https://senbox.atlassian.net/browse/SNAP-927
# ('LOG="$(mktemp -d)/snap-update.log"; mkfifo $LOG; trap "rm -f $LOG" EXIT;'
# 'SNAPCMD="%(installdir)s/bin/snap --nosplash --nogui --userdir "%(builddir)s/snap" --modules --update-all";'
# '$SNAPCMD 2>&1 > $LOG & SNAPPID=$!;'
# 'while read line; do echo "$line"; [ "$line" = "updates=0" ] && kill $SNAPPID; done < $LOG;'),
]

sanity_check_paths = {
'files': ['bin/snap', 'bin/gpt'],
'dirs': ['probavbox', 'rstb', 's1tbx', 's2tbx', 's3tbx', 'smos', 'snap'],
}

sanity_check_commands = [
"snap --nosplash --nogui --modules --help | grep 'Additional module options'",
"gpt -h",
]

moduleclass = 'geo'

0 comments on commit 3f0b015

Please sign in to comment.