2019-12-31 14:36:56 +08:00
|
|
|
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
|
2019-05-31 01:21:16 +08:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
|
|
|
|
from spack import *
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
class Mathematica(Package):
|
|
|
|
"""Mathematica: high-powered computation with thousands of Wolfram Language
|
|
|
|
functions, natural language input, real-world data, mobile support.
|
|
|
|
|
|
|
|
Note: A manual download is required for Mathematica.
|
|
|
|
Spack will search your current directory for the download file.
|
|
|
|
Alternatively, add this file to a mirror so that Spack can find it.
|
|
|
|
For instructions on how to set up a mirror, see
|
|
|
|
http://spack.readthedocs.io/en/latest/mirrors.html"""
|
|
|
|
|
|
|
|
homepage = "https://www.wolfram.com/mathematica/"
|
|
|
|
url = 'file://{0}/Mathematica_12.0.0_LINUX.sh'.format(os.getcwd())
|
|
|
|
|
2019-11-27 02:22:31 +08:00
|
|
|
version('12.0.0',
|
|
|
|
sha256='b9fb71e1afcc1d72c200196ffa434512d208fa2920e207878433f504e58ae9d7',
|
2019-05-31 01:21:16 +08:00
|
|
|
expand=False)
|
|
|
|
|
2019-11-27 02:22:31 +08:00
|
|
|
# Licensing
|
|
|
|
license_required = True
|
|
|
|
license_comment = '#'
|
|
|
|
license_files = ['Configuration/Licensing/mathpass']
|
|
|
|
license_url = 'https://reference.wolfram.com/language/tutorial/RegistrationAndPasswords.html#857035062'
|
|
|
|
|
2019-05-31 01:21:16 +08:00
|
|
|
def install(self, spec, prefix):
|
2020-04-14 02:22:29 +08:00
|
|
|
# Backup .spack because Mathematica moves it but never restores it
|
|
|
|
copy_tree(join_path(prefix, '.spack'), self.stage)
|
|
|
|
|
2019-05-31 01:21:16 +08:00
|
|
|
sh = which('sh')
|
|
|
|
sh(self.stage.archive_file, '--', '-auto', '-verbose',
|
|
|
|
'-targetdir={0}'.format(prefix),
|
|
|
|
'-execdir={0}'.format(prefix.bin),
|
|
|
|
'-selinux=y')
|
2019-11-27 02:22:31 +08:00
|
|
|
# This is what most people would use on a cluster but the installer
|
|
|
|
# does not symlink it
|
|
|
|
ws_link_path = os.path.join(prefix.bin, 'wolframscript')
|
|
|
|
if not os.path.exists(ws_link_path):
|
|
|
|
ln = which('ln')
|
|
|
|
ws_path = os.path.join(prefix, 'Executables', 'wolframscript')
|
|
|
|
ln('-s', ws_path, ws_link_path)
|
2020-04-14 02:22:29 +08:00
|
|
|
|
|
|
|
# Move back .spack where it belongs
|
|
|
|
copy_tree(join_path(self.stage, '.spack'), prefix)
|