diff options
author | Harmen Stoppels <me@harmenstoppels.nl> | 2024-09-02 13:55:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-02 11:55:40 +0000 |
commit | 20565ba8ab592f3c03f8cdd30a1b99ecd33f0e4b (patch) | |
tree | 230cec8d84927198da5053baf8d1b314eee54055 /lib | |
parent | c47a3ee05b748c56425010cda8022e9af79d03ff (diff) | |
download | spack-20565ba8ab592f3c03f8cdd30a1b99ecd33f0e4b.tar.gz spack-20565ba8ab592f3c03f8cdd30a1b99ecd33f0e4b.tar.bz2 spack-20565ba8ab592f3c03f8cdd30a1b99ecd33f0e4b.tar.xz spack-20565ba8ab592f3c03f8cdd30a1b99ecd33f0e4b.zip |
remove dead code: fs.is_writable_dir was used on file (#46166)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/directory_layout.py | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py index 923e89cf77..1baedd2b75 100644 --- a/lib/spack/spack/directory_layout.py +++ b/lib/spack/spack/directory_layout.py @@ -14,7 +14,6 @@ from contextlib import contextmanager from pathlib import Path import llnl.util.filesystem as fs -import llnl.util.tty as tty from llnl.util.symlink import readlink import spack.config @@ -152,20 +151,9 @@ class DirectoryLayout: def spec_file_path(self, spec): """Gets full path to spec file""" _check_concrete(spec) - # Attempts to convert to JSON if possible. - # Otherwise just returns the YAML. yaml_path = os.path.join(self.metadata_path(spec), self._spec_file_name_yaml) json_path = os.path.join(self.metadata_path(spec), self.spec_file_name) - if os.path.exists(yaml_path) and fs.can_write_to_dir(yaml_path): - self.write_spec(spec, json_path) - try: - os.remove(yaml_path) - except OSError as err: - tty.debug("Could not remove deprecated {0}".format(yaml_path)) - tty.debug(err) - elif os.path.exists(yaml_path): - return yaml_path - return json_path + return yaml_path if os.path.exists(yaml_path) else json_path def deprecated_file_path(self, deprecated_spec, deprecator_spec=None): """Gets full path to spec file for deprecated spec @@ -199,17 +187,7 @@ class DirectoryLayout: deprecated_spec.dag_hash() + "_" + self.spec_file_name, ) - if os.path.exists(yaml_path) and fs.can_write_to_dir(yaml_path): - self.write_spec(deprecated_spec, json_path) - try: - os.remove(yaml_path) - except (IOError, OSError) as err: - tty.debug("Could not remove deprecated {0}".format(yaml_path)) - tty.debug(err) - elif os.path.exists(yaml_path): - return yaml_path - - return json_path + return yaml_path if os.path.exists(yaml_path) else json_path @contextmanager def disable_upstream_check(self): |