From 0a6d9f4c550b3b29c12cb1c49d69e9cc5b582b75 Mon Sep 17 00:00:00 2001 From: Antonio Arena Date: Mon, 13 Apr 2020 21:22:29 +0300 Subject: Patch Mathematica (#16019) * Patch Mathematica Mathematica installer moves all files and directories from installation directory to a backup one. The problem is that it also moves .spack to this backup location. Once it's done it does not move .spack back where it was. My patch creates a copy of .spack to /tmp then moves it back right before exiting the install call. * Make lint happy * Use Spack native copy() As suggested in peer-review let's: - Copy .spack to stage directory so I don't have to use random - Use Spack native copy() to do these operations * Use join_path to create paths As per peer-review suggestion: - Use join_path to create paths - Use copy_tree since we're copying a directory that could have sub-directories --- var/spack/repos/builtin/packages/mathematica/package.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/var/spack/repos/builtin/packages/mathematica/package.py b/var/spack/repos/builtin/packages/mathematica/package.py index f7171c6081..8ef546200f 100644 --- a/var/spack/repos/builtin/packages/mathematica/package.py +++ b/var/spack/repos/builtin/packages/mathematica/package.py @@ -31,6 +31,9 @@ class Mathematica(Package): license_url = 'https://reference.wolfram.com/language/tutorial/RegistrationAndPasswords.html#857035062' def install(self, spec, prefix): + # Backup .spack because Mathematica moves it but never restores it + copy_tree(join_path(prefix, '.spack'), self.stage) + sh = which('sh') sh(self.stage.archive_file, '--', '-auto', '-verbose', '-targetdir={0}'.format(prefix), @@ -43,3 +46,6 @@ class Mathematica(Package): ln = which('ln') ws_path = os.path.join(prefix, 'Executables', 'wolframscript') ln('-s', ws_path, ws_link_path) + + # Move back .spack where it belongs + copy_tree(join_path(self.stage, '.spack'), prefix) -- cgit v1.2.3-70-g09d2