diff options
Diffstat (limited to 'lib')
34 files changed, 141 insertions, 156 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index a3407b95d1..f7b1946c46 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -80,7 +80,6 @@ import inspect import platform as py_platform from llnl.util.lang import memoized, list_modules, key_ordering -from llnl.util.filesystem import join_path import llnl.util.tty as tty import spack.paths @@ -271,7 +270,7 @@ class OperatingSystem(object): filtered_path.append(p) # Check for a bin directory, add it if it exists - bin = join_path(p, 'bin') + bin = os.path.join(p, 'bin') if os.path.isdir(bin): filtered_path.append(os.path.realpath(bin)) diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index 5c4e913692..5ca6fe54e6 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -35,7 +35,7 @@ from contextlib import closing import yaml import llnl.util.tty as tty -from llnl.util.filesystem import mkdirp, join_path, install_tree +from llnl.util.filesystem import mkdirp, install_tree import spack import spack.cmd @@ -264,9 +264,9 @@ def build_tarball(spec, outdir, force=False, rel=False, unsigned=False, """ # set up some paths tarfile_name = tarball_name(spec, '.tar.gz') - tarfile_dir = join_path(outdir, "build_cache", - tarball_directory_name(spec)) - tarfile_path = join_path(tarfile_dir, tarfile_name) + tarfile_dir = os.path.join(outdir, "build_cache", + tarball_directory_name(spec)) + tarfile_path = os.path.join(tarfile_dir, tarfile_name) mkdirp(tarfile_dir) spackfile_path = os.path.join( outdir, "build_cache", tarball_path_name(spec, '.spack')) @@ -278,18 +278,18 @@ def build_tarball(spec, outdir, force=False, rel=False, unsigned=False, # need to copy the spec file so the build cache can be downloaded # without concretizing with the current spack packages # and preferences - spec_file = join_path(spec.prefix, ".spack", "spec.yaml") + spec_file = os.path.join(spec.prefix, ".spack", "spec.yaml") specfile_name = tarball_name(spec, '.spec.yaml') specfile_path = os.path.realpath( - join_path(outdir, "build_cache", specfile_name)) - indexfile_path = join_path(outdir, "build_cache", "index.html") + os.path.join(outdir, "build_cache", specfile_name)) + indexfile_path = os.path.join(outdir, "build_cache", "index.html") if os.path.exists(specfile_path): if force: os.remove(specfile_path) else: raise NoOverwriteException(str(specfile_path)) # make a copy of the install directory to work with - workdir = join_path(tempfile.mkdtemp(), os.path.basename(spec.prefix)) + workdir = os.path.join(tempfile.mkdtemp(), os.path.basename(spec.prefix)) install_tree(spec.prefix, workdir, symlinks=True) # create info for later relocation and create tar @@ -512,7 +512,7 @@ def extract_tarball(spec, filename, allow_root=False, unsigned=False, # the base of the install prefix is used when creating the tarball # so the pathname should be the same now that the directory layout # is confirmed - workdir = join_path(tmpdir, os.path.basename(spec.prefix)) + workdir = os.path.join(tmpdir, os.path.basename(spec.prefix)) # cleanup os.remove(tarfile_path) diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py index 0c9760faa5..21fe7c4c5b 100644 --- a/lib/spack/spack/build_systems/autotools.py +++ b/lib/spack/spack/build_systems/autotools.py @@ -32,7 +32,7 @@ from subprocess import PIPE from subprocess import check_call import llnl.util.tty as tty -from llnl.util.filesystem import working_dir, join_path, force_remove +from llnl.util.filesystem import working_dir, force_remove from spack.package import PackageBase, run_after, run_before from spack.util.executable import Executable @@ -177,7 +177,7 @@ class AutotoolsPackage(PackageBase): @property def configure_abs_path(self): # Absolute path to configure - configure_abs_path = join_path( + configure_abs_path = os.path.join( os.path.abspath(self.configure_directory), 'configure' ) return configure_abs_path @@ -220,7 +220,7 @@ class AutotoolsPackage(PackageBase): if 'pkgconfig' in spec: autoreconf_args += [ '-I', - join_path(spec['pkgconfig'].prefix, 'share', 'aclocal'), + os.path.join(spec['pkgconfig'].prefix, 'share', 'aclocal'), ] autoreconf_args += self.autoreconf_extra_args m.autoreconf(*autoreconf_args) diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py index 27b3e56a81..c60f649fa5 100644 --- a/lib/spack/spack/build_systems/cmake.py +++ b/lib/spack/spack/build_systems/cmake.py @@ -28,7 +28,7 @@ import os import platform import spack.build_environment -from llnl.util.filesystem import working_dir, join_path +from llnl.util.filesystem import working_dir from spack.util.environment import filter_system_paths from spack.directives import depends_on, variant from spack.package import PackageBase, InstallError, run_after @@ -208,7 +208,7 @@ class CMakePackage(PackageBase): :return: directory where to build the package """ - return join_path(self.stage.source_path, 'spack-build') + return os.path.join(self.stage.source_path, 'spack-build') def cmake_args(self): """Produces a list containing all the arguments that must be passed to diff --git a/lib/spack/spack/build_systems/intel.py b/lib/spack/spack/build_systems/intel.py index 0218be59bc..3a67da7e09 100644 --- a/lib/spack/spack/build_systems/intel.py +++ b/lib/spack/spack/build_systems/intel.py @@ -26,7 +26,7 @@ import os import xml.etree.ElementTree as ET -from llnl.util.filesystem import install, join_path +from llnl.util.filesystem import install from spack.package import PackageBase, run_after from spack.util.executable import Executable @@ -109,8 +109,8 @@ class IntelPackage(PackageBase): All Intel software shares the same license, so we store it in a common 'intel' directory.""" - return join_path(self.global_license_dir, 'intel', - os.path.basename(self.license_files[0])) + return os.path.join(self.global_license_dir, 'intel', + os.path.basename(self.license_files[0])) def configure(self, spec, prefix): """Writes the ``silent.cfg`` file used to configure the installation. @@ -186,7 +186,7 @@ class IntelPackage(PackageBase): @run_after('install') def save_silent_cfg(self): """Copies the silent.cfg configuration file to ``<prefix>/.spack``.""" - install('silent.cfg', join_path(self.prefix, '.spack')) + install('silent.cfg', os.path.join(self.prefix, '.spack')) # Check that self.prefix is there after installation run_after('install')(PackageBase.sanity_check_prefix) diff --git a/lib/spack/spack/build_systems/perl.py b/lib/spack/spack/build_systems/perl.py index 9e2bf0fddb..eb6d2f05a4 100644 --- a/lib/spack/spack/build_systems/perl.py +++ b/lib/spack/spack/build_systems/perl.py @@ -26,7 +26,6 @@ import inspect import os -from llnl.util.filesystem import join_path from spack.directives import depends_on, extends from spack.package import PackageBase, run_after from spack.util.executable import Executable @@ -88,7 +87,7 @@ class PerlPackage(PackageBase): elif os.path.isfile('Build.PL'): self.build_method = 'Build.PL' self.build_executable = Executable( - join_path(self.stage.source_path, 'Build')) + os.path.join(self.stage.source_path, 'Build')) else: raise RuntimeError('Unknown build_method for perl package') diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py index 93aeb1009a..6404ca81a3 100644 --- a/lib/spack/spack/cmd/install.py +++ b/lib/spack/spack/cmd/install.py @@ -135,9 +135,9 @@ def default_log_file(spec): """ fmt = 'test-{x.name}-{x.version}-{hash}.xml' basename = fmt.format(x=spec, hash=spec.dag_hash()) - dirname = fs.join_path(spack.paths.var_path, 'junit-report') + dirname = fs.os.path.join(spack.paths.var_path, 'junit-report') fs.mkdirp(dirname) - return fs.join_path(dirname, basename) + return fs.os.path.join(dirname, basename) def install_spec(cli_args, kwargs, spec): diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index f6f5a4d4dc..6d9742150e 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -27,7 +27,6 @@ import re import itertools import llnl.util.tty as tty -from llnl.util.filesystem import join_path import spack.error import spack.spec @@ -270,7 +269,7 @@ class Compiler(object): files = os.listdir(directory) for exe in files: - full_path = join_path(directory, exe) + full_path = os.path.join(directory, exe) prod = itertools.product(prefixes, compiler_names, suffixes) for pre, name, suf in prod: diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py index 3a5f4b73cb..3c62cc588f 100644 --- a/lib/spack/spack/database.py +++ b/lib/spack/spack/database.py @@ -51,7 +51,7 @@ from six import iteritems from yaml.error import MarkedYAMLError, YAMLError import llnl.util.tty as tty -from llnl.util.filesystem import join_path, mkdirp +from llnl.util.filesystem import mkdirp from llnl.util.lock import Lock, WriteTransaction, ReadTransaction import spack.store @@ -184,18 +184,18 @@ class Database(object): if db_dir is None: # If the db_dir is not provided, default to within the db root. - self._db_dir = join_path(self.root, _db_dirname) + self._db_dir = os.path.join(self.root, _db_dirname) else: # Allow customizing the database directory location for testing. self._db_dir = db_dir # Set up layout of database files within the db dir - self._old_yaml_index_path = join_path(self._db_dir, 'index.yaml') - self._index_path = join_path(self._db_dir, 'index.json') - self._lock_path = join_path(self._db_dir, 'lock') + self._old_yaml_index_path = os.path.join(self._db_dir, 'index.yaml') + self._index_path = os.path.join(self._db_dir, 'index.json') + self._lock_path = os.path.join(self._db_dir, 'lock') # This is for other classes to use to lock prefix directories. - self.prefix_lock_path = join_path(self._db_dir, 'prefix_lock') + self.prefix_lock_path = os.path.join(self._db_dir, 'prefix_lock') # Create needed directories and files if not os.path.exists(self._db_dir): diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py index eca984093d..2c270e7448 100644 --- a/lib/spack/spack/directives.py +++ b/lib/spack/spack/directives.py @@ -54,7 +54,6 @@ import re from six import string_types import llnl.util.lang -from llnl.util.filesystem import join_path import spack import spack.error @@ -530,7 +529,7 @@ def resource(**kwargs): # Check if the path falls within the main package stage area test_path = 'stage_folder_root' normalized_destination = os.path.normpath( - join_path(test_path, destination) + os.path.join(test_path, destination) ) # Normalized absolute path if test_path not in normalized_destination: diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py index 6c38b9f077..b392af01eb 100644 --- a/lib/spack/spack/directory_layout.py +++ b/lib/spack/spack/directory_layout.py @@ -29,7 +29,7 @@ import tempfile import yaml import re -from llnl.util.filesystem import join_path, mkdirp +from llnl.util.filesystem import mkdirp import spack.config import spack.spec @@ -239,22 +239,22 @@ class YamlDirectoryLayout(DirectoryLayout): def spec_file_path(self, spec): """Gets full path to spec file""" _check_concrete(spec) - return join_path(self.metadata_path(spec), self.spec_file_name) + return os.path.join(self.metadata_path(spec), self.spec_file_name) def metadata_path(self, spec): - return join_path(self.path_for_spec(spec), self.metadata_dir) + return os.path.join(self.path_for_spec(spec), self.metadata_dir) def build_log_path(self, spec): - return join_path(self.path_for_spec(spec), self.metadata_dir, - self.build_log_name) + return os.path.join(self.path_for_spec(spec), self.metadata_dir, + self.build_log_name) def build_env_path(self, spec): - return join_path(self.path_for_spec(spec), self.metadata_dir, - self.build_env_name) + return os.path.join(self.path_for_spec(spec), self.metadata_dir, + self.build_env_name) def build_packages_path(self, spec): - return join_path(self.path_for_spec(spec), self.metadata_dir, - self.packages_dir) + return os.path.join(self.path_for_spec(spec), self.metadata_dir, + self.packages_dir) def create_install_directory(self, spec): _check_concrete(spec) @@ -302,7 +302,7 @@ class YamlDirectoryLayout(DirectoryLayout): path_elems = ["*"] * len(self.path_scheme.split(os.sep)) path_elems += [self.metadata_dir, self.spec_file_name] - pattern = join_path(self.root, *path_elems) + pattern = os.path.join(self.root, *path_elems) spec_files = glob.glob(pattern) return [self.read_spec(s) for s in spec_files] @@ -356,8 +356,8 @@ class YamlExtensionsLayout(ExtensionsLayout): def extension_file_path(self, spec): """Gets full path to an installed package's extension file""" _check_concrete(spec) - return join_path(self.layout.metadata_path(spec), - self.extension_file_name) + return os.path.join(self.layout.metadata_path(spec), + self.extension_file_name) def extension_map(self, spec): """Defensive copying version of _extension_map() for external API.""" @@ -446,8 +446,8 @@ class YamlViewExtensionsLayout(YamlExtensionsLayout): def extension_file_path(self, spec): """Gets the full path to an installed package's extension file.""" _check_concrete(spec) - return join_path(self.root, self.layout.metadata_dir, spec.name, - self.extension_file_name) + return os.path.join(self.root, self.layout.metadata_dir, spec.name, + self.extension_file_name) def extendee_target_directory(self, extendee): return self.root diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index 7931dd65d2..423cccbb0b 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -49,7 +49,7 @@ from functools import wraps from six import string_types, with_metaclass import llnl.util.tty as tty -from llnl.util.filesystem import working_dir, mkdirp, join_path +from llnl.util.filesystem import working_dir, mkdirp import spack.config import spack.error @@ -1035,12 +1035,12 @@ class FsCache(object): if isinstance(fetcher, CacheURLFetchStrategy): return - dst = join_path(self.root, relativeDst) + dst = os.path.join(self.root, relativeDst) mkdirp(os.path.dirname(dst)) fetcher.archive(dst) def fetcher(self, targetPath, digest, **kwargs): - path = join_path(self.root, targetPath) + path = os.path.join(self.root, targetPath) return CacheURLFetchStrategy(path, digest, **kwargs) def destroy(self): diff --git a/lib/spack/spack/filesystem_view.py b/lib/spack/spack/filesystem_view.py index 51a673d486..c7646d1120 100644 --- a/lib/spack/spack/filesystem_view.py +++ b/lib/spack/spack/filesystem_view.py @@ -28,7 +28,6 @@ import re import shutil import sys -from llnl.util.filesystem import join_path from llnl.util.link_tree import LinkTree from llnl.util import tty @@ -390,8 +389,8 @@ class YamlFilesystemView(FilesystemView): tty.info(self._croot + 'Removed package: %s' % colorize_spec(spec)) def get_all_specs(self): - dotspack = join_path(self.root, - spack.store.layout.metadata_dir) + dotspack = os.path.join(self.root, + spack.store.layout.metadata_dir) if os.path.exists(dotspack): return list(filter(None, map(self.get_spec, os.listdir(dotspack)))) else: @@ -408,14 +407,14 @@ class YamlFilesystemView(FilesystemView): def get_path_meta_folder(self, spec): "Get path to meta folder for either spec or spec name." - return join_path(self.root, - spack.store.layout.metadata_dir, - getattr(spec, "name", spec)) + return os.path.join(self.root, + spack.store.layout.metadata_dir, + getattr(spec, "name", spec)) def get_spec(self, spec): dotspack = self.get_path_meta_folder(spec) - filename = join_path(dotspack, - spack.store.layout.spec_file_name) + filename = os.path.join(dotspack, + spack.store.layout.spec_file_name) try: with open(filename, "r") as f: diff --git a/lib/spack/spack/hooks/__init__.py b/lib/spack/spack/hooks/__init__.py index 66386c6d22..8a4b8ada76 100644 --- a/lib/spack/spack/hooks/__init__.py +++ b/lib/spack/spack/hooks/__init__.py @@ -42,9 +42,9 @@ features. """ import imp +import os.path import spack.paths -from llnl.util.filesystem import join_path from llnl.util.lang import memoized, list_modules @@ -53,7 +53,7 @@ def all_hook_modules(): modules = [] for name in list_modules(spack.paths.hooks_path): mod_name = __name__ + '.' + name - path = join_path(spack.paths.hooks_path, name) + ".py" + path = os.path.join(spack.paths.hooks_path, name) + ".py" mod = imp.load_source(mod_name, path) modules.append(mod) diff --git a/lib/spack/spack/hooks/licensing.py b/lib/spack/spack/hooks/licensing.py index 02c27b1ec0..6c4224b47c 100644 --- a/lib/spack/spack/hooks/licensing.py +++ b/lib/spack/spack/hooks/licensing.py @@ -26,7 +26,7 @@ import os import spack import llnl.util.tty as tty -from llnl.util.filesystem import join_path, mkdirp +from llnl.util.filesystem import mkdirp def pre_install(spec): @@ -156,7 +156,7 @@ def symlink_license(pkg): """Create local symlinks that point to the global license file.""" target = pkg.global_license_file for filename in pkg.license_files: - link_name = join_path(pkg.prefix, filename) + link_name = os.path.join(pkg.prefix, filename) link_name = os.path.abspath(link_name) license_dir = os.path.dirname(link_name) if not os.path.exists(license_dir): diff --git a/lib/spack/spack/mirror.py b/lib/spack/spack/mirror.py index 56b02831d6..14e4b482ef 100644 --- a/lib/spack/spack/mirror.py +++ b/lib/spack/spack/mirror.py @@ -33,7 +33,7 @@ to download packages directly from a mirror (e.g., on an intranet). import sys import os import llnl.util.tty as tty -from llnl.util.filesystem import mkdirp, join_path +from llnl.util.filesystem import mkdirp import spack.config import spack.error @@ -97,7 +97,7 @@ Spack not to expand it with the following syntax: def mirror_archive_path(spec, fetcher, resourceId=None): """Get the relative path to the spec's archive within a mirror.""" - return join_path( + return os.path.join( spec.name, mirror_archive_filename(spec, fetcher, resourceId)) @@ -222,12 +222,12 @@ def add_single_spec(spec, mirror_root, categories, **kwargs): fetcher = stage.fetcher if ii == 0: # create a subdirectory for the current package@version - archive_path = os.path.abspath(join_path( + archive_path = os.path.abspath(os.path.join( mirror_root, mirror_archive_path(spec, fetcher))) name = spec.cformat("$_$@") else: resource = stage.resource - archive_path = os.path.abspath(join_path( + archive_path = os.path.abspath(os.path.join( mirror_root, mirror_archive_path(spec, fetcher, resource.name))) name = "{resource} ({pkg}).".format( diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 9e4150b9b3..3fdaf56b8d 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -69,7 +69,7 @@ import spack.util.web import spack.multimethod import spack.binary_distribution as binary_distribution -from llnl.util.filesystem import mkdirp, join_path, touch +from llnl.util.filesystem import mkdirp, touch from llnl.util.filesystem import working_dir, install_tree, install from llnl.util.lang import memoized from llnl.util.link_tree import LinkTree @@ -1226,17 +1226,17 @@ class PackageBase(with_metaclass(PackageMeta, object)): # Install fake command mkdirp(self.prefix.bin) - touch(join_path(self.prefix.bin, command)) - chmod('+x', join_path(self.prefix.bin, command)) + touch(os.path.join(self.prefix.bin, command)) + chmod('+x', os.path.join(self.prefix.bin, command)) # Install fake header file mkdirp(self.prefix.include) - touch(join_path(self.prefix.include, header + '.h')) + touch(os.path.join(self.prefix.include, header + '.h')) # Install fake shared and static libraries mkdirp(self.prefix.lib) for suffix in [dso_suffix, '.a']: - touch(join_path(self.prefix.lib, library + suffix)) + touch(os.path.join(self.prefix.lib, library + suffix)) # Install fake man page mkdirp(self.prefix.man.man1) @@ -1516,7 +1516,7 @@ class PackageBase(with_metaclass(PackageMeta, object)): else: source_path = self.stage.source_path if install_source and os.path.isdir(source_path): - src_target = join_path( + src_target = os.path.join( self.spec.prefix, 'share', self.name, 'src') tty.msg('Copying source to {0}'.format(src_target)) install_tree(self.stage.source_path, src_target) @@ -1762,7 +1762,7 @@ class PackageBase(with_metaclass(PackageMeta, object)): if self.installed: return spack.store.layout.build_log_path(self.spec) else: - return join_path(self.stage.source_path, 'spack-build.out') + return os.path.join(self.stage.source_path, 'spack-build.out') @property def module(self): @@ -2305,7 +2305,7 @@ def dump_packages(spec, path): # Locate the dependency package in the install tree and find # its provenance information. source = spack.store.layout.build_packages_path(node) - source_repo_root = join_path(source, node.namespace) + source_repo_root = os.path.join(source, node.namespace) # There's no provenance installed for the source package. Skip it. # User can always get something current from the builtin repo. @@ -2322,7 +2322,7 @@ def dump_packages(spec, path): node.name) # Create a destination repository - dest_repo_root = join_path(path, node.namespace) + dest_repo_root = os.path.join(path, node.namespace) if not os.path.exists(dest_repo_root): spack.repo.create_repo(dest_repo_root) repo = spack.repo.Repo(dest_repo_root) diff --git a/lib/spack/spack/platforms/cray.py b/lib/spack/spack/platforms/cray.py index 92f2254429..80bf023ab2 100644 --- a/lib/spack/spack/platforms/cray.py +++ b/lib/spack/spack/platforms/cray.py @@ -30,7 +30,6 @@ from spack.util.executable import which from spack.architecture import Platform, Target, NoPlatformError from spack.operating_systems.cray_frontend import CrayFrontend from spack.operating_systems.cnl import Cnl -from llnl.util.filesystem import join_path from spack.util.module_cmd import get_module_cmd, unload_module @@ -110,7 +109,7 @@ class Cray(Platform): unload_module(module) env.set('CRAYPE_LINK_TYPE', 'dynamic') - cray_wrapper_names = join_path(build_env_path, 'cray') + cray_wrapper_names = os.path.join(build_env_path, 'cray') if os.path.isdir(cray_wrapper_names): env.prepend_path('PATH', cray_wrapper_names) diff --git a/lib/spack/spack/repo.py b/lib/spack/spack/repo.py index dd6b6ac71d..d0cf1b0ce1 100644 --- a/lib/spack/spack/repo.py +++ b/lib/spack/spack/repo.py @@ -47,7 +47,7 @@ import yaml import llnl.util.lang import llnl.util.tty as tty -from llnl.util.filesystem import mkdirp, join_path, install +from llnl.util.filesystem import mkdirp, install import spack import spack.config @@ -142,7 +142,7 @@ class FastPackageChecker(Mapping): cache = {} for pkg_name in os.listdir(self.packages_path): # Skip non-directories in the package root. - pkg_dir = join_path(self.packages_path, pkg_name) + pkg_dir = os.path.join(self.packages_path, pkg_name) # Warn about invalid names that look like packages. if not valid_module_name(pkg_name): @@ -635,18 +635,18 @@ class Repo(object): raise BadRepoError(msg) # Validate repository layout. - self.config_file = join_path(self.root, repo_config_name) + self.config_file = os.path.join(self.root, repo_config_name) check(os.path.isfile(self.config_file), "No %s found in '%s'" % (repo_config_name, root)) - self.packages_path = join_path(self.root, packages_dir_name) + self.packages_path = os.path.join(self.root, packages_dir_name) check(os.path.isdir(self.packages_path), "No directory '%s' found in '%s'" % (repo_config_name, root)) # Read configuration and validate namespace config = self._read_config() check('namespace' in config, '%s must define a namespace.' - % join_path(root, repo_config_name)) + % os.path.join(root, repo_config_name)) self.namespace = config['namespace'] check(re.match(r'[a-zA-Z][a-zA-Z0-9_.]+', self.namespace), @@ -899,7 +899,7 @@ class Repo(object): """Get the directory name for a particular package. This is the directory that contains its package.py file.""" self._check_namespace(spec) - return join_path(self.packages_path, spec.name) + return os.path.join(self.packages_path, spec.name) @_autospec def filename_for_package_name(self, spec): @@ -913,7 +913,7 @@ class Repo(object): """ self._check_namespace(spec) pkg_dir = self.dirname_for_package_name(spec.name) - return join_path(pkg_dir, package_file_name) + return os.path.join(pkg_dir, package_file_name) @property def _pkg_checker(self): diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index 9c384d8aec..0c460ddf5f 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -35,7 +35,7 @@ from six.moves.urllib.parse import urljoin import llnl.util.tty as tty import llnl.util.lock -from llnl.util.filesystem import mkdirp, join_path, can_access +from llnl.util.filesystem import mkdirp, can_access from llnl.util.filesystem import remove_if_dead_link, remove_linked_tree import spack.paths @@ -216,7 +216,7 @@ class Stage(object): if path is not None: self.path = path else: - self.path = join_path(spack.paths.stage_path, self.name) + self.path = os.path.join(spack.paths.stage_path, self.name) # Flag to decide whether to delete the stage folder on exit or not self.keep = keep @@ -229,7 +229,7 @@ class Stage(object): if self.name not in Stage.stage_locks: sha1 = hashlib.sha1(self.name.encode('utf-8')).digest() lock_id = prefix_bits(sha1, bit_length(sys.maxsize)) - stage_lock_path = join_path(spack.paths.stage_path, '.lock') + stage_lock_path = os.path.join(spack.paths.stage_path, '.lock') Stage.stage_locks[self.name] = llnl.util.lock.Lock( stage_lock_path, lock_id, 1) @@ -546,7 +546,7 @@ class ResourceStage(Stage): if not isinstance(placement, dict): placement = {'': placement} - target_path = join_path( + target_path = os.path.join( root_stage.source_path, resource.destination) try: @@ -558,8 +558,8 @@ class ResourceStage(Stage): raise for key, value in iteritems(placement): - destination_path = join_path(target_path, value) - source_path = join_path(self.source_path, key) + destination_path = os.path.join(target_path, value) + source_path = os.path.join(self.source_path, key) if not os.path.exists(destination_path): tty.info('Moving resource stage\n\tsource : ' @@ -665,7 +665,7 @@ def purge(): """Remove all build directories in the top-level stage path.""" if os.path.isdir(spack.paths.stage_path): for stage_dir in os.listdir(spack.paths.stage_path): - stage_path = join_path(spack.paths.stage_path, stage_dir) + stage_path = os.path.join(spack.paths.stage_path, stage_dir) remove_linked_tree(stage_path) diff --git a/lib/spack/spack/test/build_environment.py b/lib/spack/spack/test/build_environment.py index 653a283b1b..504febffac 100644 --- a/lib/spack/spack/test/build_environment.py +++ b/lib/spack/spack/test/build_environment.py @@ -26,16 +26,15 @@ import os import pytest from spack.paths import build_env_path -from llnl.util.filesystem import join_path from spack.build_environment import dso_suffix, _static_to_shared_library from spack.util.executable import Executable @pytest.fixture def build_environment(): - cc = Executable(join_path(build_env_path, "cc")) - cxx = Executable(join_path(build_env_path, "c++")) - fc = Executable(join_path(build_env_path, "fc")) + cc = Executable(os.path.join(build_env_path, "cc")) + cxx = Executable(os.path.join(build_env_path, "c++")) + fc = Executable(os.path.join(build_env_path, "fc")) realcc = "/bin/mycc" prefix = "/spack-test-prefix" diff --git a/lib/spack/spack/test/cc.py b/lib/spack/spack/test/cc.py index 25bb01cd05..adc5bfd71b 100644 --- a/lib/spack/spack/test/cc.py +++ b/lib/spack/spack/test/cc.py @@ -32,7 +32,7 @@ import tempfile import shutil from spack.paths import build_env_path -from llnl.util.filesystem import mkdirp, join_path +from llnl.util.filesystem import mkdirp from spack.util.executable import Executable # Complicated compiler test command @@ -54,11 +54,11 @@ test_command = [ class CompilerWrapperTest(unittest.TestCase): def setUp(self): - self.cc = Executable(join_path(build_env_path, "cc")) - self.ld = Executable(join_path(build_env_path, "ld")) - self.cpp = Executable(join_path(build_env_path, "cpp")) - self.cxx = Executable(join_path(build_env_path, "c++")) - self.fc = Executable(join_path(build_env_path, "fc")) + self.cc = Executable(os.path.join(build_env_path, "cc")) + self.ld = Executable(os.path.join(build_env_path, "ld")) + self.cpp = Executable(os.path.join(build_env_path, "cpp")) + self.cxx = Executable(os.path.join(build_env_path, "c++")) + self.fc = Executable(os.path.join(build_env_path, "fc")) self.realcc = "/bin/mycc" self.prefix = "/spack-test-prefix" @@ -82,20 +82,20 @@ class CompilerWrapperTest(unittest.TestCase): # Make some fake dependencies self.tmp_deps = tempfile.mkdtemp() - self.dep1 = join_path(self.tmp_deps, 'dep1') - self.dep2 = join_path(self.tmp_deps, 'dep2') - self.dep3 = join_path(self.tmp_deps, 'dep3') - self.dep4 = join_path(self.tmp_deps, 'dep4') + self.dep1 = os.path.join(self.tmp_deps, 'dep1') + self.dep2 = os.path.join(self.tmp_deps, 'dep2') + self.dep3 = os.path.join(self.tmp_deps, 'dep3') + self.dep4 = os.path.join(self.tmp_deps, 'dep4') - mkdirp(join_path(self.dep1, 'include')) - mkdirp(join_path(self.dep1, 'lib')) + mkdirp(os.path.join(self.dep1, 'include')) + mkdirp(os.path.join(self.dep1, 'lib')) - mkdirp(join_path(self.dep2, 'lib64')) + mkdirp(os.path.join(self.dep2, 'lib64')) - mkdirp(join_path(self.dep3, 'include')) - mkdirp(join_path(self.dep3, 'lib64')) + mkdirp(os.path.join(self.dep3, 'include')) + mkdirp(os.path.join(self.dep3, 'lib64')) - mkdirp(join_path(self.dep4, 'include')) + mkdirp(os.path.join(self.dep4, 'include')) if 'SPACK_DEPENDENCIES' in os.environ: del os.environ['SPACK_DEPENDENCIES'] diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py index 88f0247cfa..a5448797bd 100644 --- a/lib/spack/spack/test/cmd/install.py +++ b/lib/spack/spack/test/cmd/install.py @@ -318,7 +318,7 @@ def test_junit_output_with_failures(tmpdir, exc_typename, msg): @pytest.mark.disable_clean_stage_check @pytest.mark.parametrize('exc_typename,msg', [ -# ('RuntimeError', 'something weird happened'), + ('RuntimeError', 'something weird happened'), ('KeyboardInterrupt', 'Ctrl-C strikes again') ]) def test_junit_output_with_errors( diff --git a/lib/spack/spack/test/directory_layout.py b/lib/spack/spack/test/directory_layout.py index ac12381e75..2277196a05 100644 --- a/lib/spack/spack/test/directory_layout.py +++ b/lib/spack/spack/test/directory_layout.py @@ -28,8 +28,6 @@ This test verifies that the Spack directory layout works properly. import os import pytest -from llnl.util.filesystem import join_path - import spack.paths import spack.repo from spack.directory_layout import YamlDirectoryLayout @@ -213,7 +211,7 @@ def test_handle_unknown_package( # enough to read a spec from the spec file. for spec, path in installed_specs.items(): spec_from_file = layout.read_spec( - join_path(path, '.spack', 'spec.yaml')) + os.path.join(path, '.spack', 'spec.yaml')) # To satisfy these conditions, directory layouts need to # read in concrete specs from their install dirs somehow. diff --git a/lib/spack/spack/test/git_fetch.py b/lib/spack/spack/test/git_fetch.py index 127096b52b..dc925286ba 100644 --- a/lib/spack/spack/test/git_fetch.py +++ b/lib/spack/spack/test/git_fetch.py @@ -26,7 +26,7 @@ import os import pytest -from llnl.util.filesystem import working_dir, join_path, touch +from llnl.util.filesystem import working_dir, touch import spack.repo import spack.config @@ -103,7 +103,7 @@ def test_fetch(type_of_test, with working_dir(pkg.stage.source_path): assert h('HEAD') == h(t.revision) - file_path = join_path(pkg.stage.source_path, t.file) + file_path = os.path.join(pkg.stage.source_path, t.file) assert os.path.isdir(pkg.stage.source_path) assert os.path.isfile(file_path) diff --git a/lib/spack/spack/test/hg_fetch.py b/lib/spack/spack/test/hg_fetch.py index 7c3878e9f9..e36f1ebb84 100644 --- a/lib/spack/spack/test/hg_fetch.py +++ b/lib/spack/spack/test/hg_fetch.py @@ -26,7 +26,7 @@ import os import pytest -from llnl.util.filesystem import working_dir, join_path, touch +from llnl.util.filesystem import working_dir, touch import spack.repo import spack.config @@ -75,7 +75,7 @@ def test_fetch( with working_dir(pkg.stage.source_path): assert h() == t.revision - file_path = join_path(pkg.stage.source_path, t.file) + file_path = os.path.join(pkg.stage.source_path, t.file) assert os.path.isdir(pkg.stage.source_path) assert os.path.isfile(file_path) diff --git a/lib/spack/spack/test/llnl/util/lock.py b/lib/spack/spack/test/llnl/util/lock.py index 5c30650a23..c84573e75e 100644 --- a/lib/spack/spack/test/llnl/util/lock.py +++ b/lib/spack/spack/test/llnl/util/lock.py @@ -72,7 +72,7 @@ from multiprocessing import Process import pytest -from llnl.util.filesystem import join_path, touch +from llnl.util.filesystem import touch from spack.util.multiproc import Barrier from llnl.util.lock import Lock, WriteTransaction, ReadTransaction, LockError @@ -180,7 +180,7 @@ def private_lock_path(lock_dir): For other modes, it is the same as a shared lock. """ - lock_file = join_path(lock_dir, 'lockfile') + lock_file = os.path.join(lock_dir, 'lockfile') if mpi: lock_file += '.%s' % comm.rank yield lock_file @@ -189,7 +189,7 @@ def private_lock_path(lock_dir): @pytest.fixture def lock_path(lock_dir): """This lock is shared among all processes in a multiproc test.""" - lock_file = join_path(lock_dir, 'lockfile') + lock_file = os.path.join(lock_dir, 'lockfile') yield lock_file diff --git a/lib/spack/spack/test/make_executable.py b/lib/spack/spack/test/make_executable.py index 23df9ca1e4..e6593b8ffa 100644 --- a/lib/spack/spack/test/make_executable.py +++ b/lib/spack/spack/test/make_executable.py @@ -32,7 +32,6 @@ import shutil import tempfile import unittest -from llnl.util.filesystem import join_path from spack.build_environment import MakeExecutable from spack.util.environment import path_put_first @@ -42,7 +41,7 @@ class MakeExecutableTest(unittest.TestCase): def setUp(self): self.tmpdir = tempfile.mkdtemp() - make_exe = join_path(self.tmpdir, 'make') + make_exe = os.path.join(self.tmpdir, 'make') with open(make_exe, 'w') as f: f.write('#!/bin/sh\n') f.write('echo "$@"') diff --git a/lib/spack/spack/test/mirror.py b/lib/spack/spack/test/mirror.py index 5b397cc129..2df15c1486 100644 --- a/lib/spack/spack/test/mirror.py +++ b/lib/spack/spack/test/mirror.py @@ -26,8 +26,6 @@ import filecmp import os import pytest -from llnl.util.filesystem import join_path - import spack.repo import spack.mirror import spack.util.executable @@ -66,7 +64,7 @@ def set_up_package(name, repository, url_attr): def check_mirror(): with Stage('spack-mirror-test') as stage: - mirror_root = join_path(stage.path, 'test-mirror') + mirror_root = os.path.join(stage.path, 'test-mirror') # register mirror with spack config mirrors = {'spack-mirror-test': 'file://' + mirror_root} spack.config.set('mirrors', mirrors) @@ -77,7 +75,7 @@ def check_mirror(): # check that there are subdirs for each package for name in repos: - subdir = join_path(mirror_root, name) + subdir = os.path.join(mirror_root, name) assert os.path.isdir(subdir) files = os.listdir(subdir) @@ -96,7 +94,7 @@ def check_mirror(): original_path = mock_repo.path if 'svn' in name: # have to check out the svn repo to compare. - original_path = join_path( + original_path = os.path.join( mock_repo.path, 'checked_out') svn = which('svn', required=True) diff --git a/lib/spack/spack/test/packages.py b/lib/spack/spack/test/packages.py index 5c71a81101..2d9878ed96 100644 --- a/lib/spack/spack/test/packages.py +++ b/lib/spack/spack/test/packages.py @@ -22,10 +22,9 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## +import os.path import pytest -from llnl.util.filesystem import join_path - import spack.repo from spack.paths import mock_packages_path from spack.util.naming import mod_to_class @@ -45,7 +44,7 @@ class TestPackage(object): def test_package_filename(self): repo = spack.repo.Repo(mock_packages_path) filename = repo.filename_for_package_name('mpich') - assert filename == join_path( + assert filename == os.path.join( mock_packages_path, 'packages', 'mpich', @@ -55,7 +54,7 @@ class TestPackage(object): def test_nonexisting_package_filename(self): repo = spack.repo.Repo(mock_packages_path) filename = repo.filename_for_package_name('some-nonexisting-package') - assert filename == join_path( + assert filename == os.path.join( mock_packages_path, 'packages', 'some-nonexisting-package', diff --git a/lib/spack/spack/test/stage.py b/lib/spack/spack/test/stage.py index 01b4fa9e90..0d76fe5ede 100644 --- a/lib/spack/spack/test/stage.py +++ b/lib/spack/spack/test/stage.py @@ -28,7 +28,7 @@ import collections import pytest -from llnl.util.filesystem import join_path, working_dir +from llnl.util.filesystem import working_dir import spack.paths import spack.stage @@ -43,9 +43,9 @@ def check_expand_archive(stage, stage_name, mock_archive): assert archive_name in os.listdir(stage_path) assert archive_dir in os.listdir(stage_path) - assert join_path(stage_path, archive_dir) == stage.source_path + assert os.path.join(stage_path, archive_dir) == stage.source_path - readme = join_path(stage_path, archive_dir, 'README.txt') + readme = os.path.join(stage_path, archive_dir, 'README.txt') assert os.path.isfile(readme) with open(readme) as file: 'hello world!\n' == file.read() @@ -55,7 +55,7 @@ def check_fetch(stage, stage_name): archive_name = 'test-files.tar.gz' stage_path = get_stage_path(stage, stage_name) assert archive_name in os.listdir(stage_path) - assert join_path(stage_path, archive_name) == stage.fetcher.archive_file + assert os.path.join(stage_path, archive_name) == stage.fetcher.archive_file def check_destroy(stage, stage_name): diff --git a/lib/spack/spack/test/svn_fetch.py b/lib/spack/spack/test/svn_fetch.py index 323fb7ddf8..fc86c0ae0d 100644 --- a/lib/spack/spack/test/svn_fetch.py +++ b/lib/spack/spack/test/svn_fetch.py @@ -26,7 +26,7 @@ import os import pytest -from llnl.util.filesystem import join_path, touch, working_dir +from llnl.util.filesystem import touch, working_dir import spack.repo import spack.config @@ -75,7 +75,7 @@ def test_fetch( with working_dir(pkg.stage.source_path): assert h() == t.revision - file_path = join_path(pkg.stage.source_path, t.file) + file_path = os.path.join(pkg.stage.source_path, t.file) assert os.path.isdir(pkg.stage.source_path) assert os.path.isfile(file_path) diff --git a/lib/spack/spack/test/test_activations.py b/lib/spack/spack/test/test_activations.py index 34e5c8d0b3..dcccbaa05d 100644 --- a/lib/spack/spack/test/test_activations.py +++ b/lib/spack/spack/test/test_activations.py @@ -22,15 +22,13 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## +import os +import pytest import spack -from llnl.util.filesystem import join_path from spack.directory_layout import YamlDirectoryLayout from spack.filesystem_view import YamlFilesystemView -import os -import pytest - class FakeExtensionPackage(object): def __init__(self, name, prefix): @@ -97,7 +95,7 @@ def python_and_extension_dirs(tmpdir): create_dir_structure(ext_prefix, ext_dirs) easy_install_location = 'lib/python2.7/site-packages/easy-install.pth' - with open(join_path(ext_prefix, easy_install_location), 'w') as F: + with open(str(ext_prefix.join(easy_install_location)), 'w') as F: F.write("""path/to/ext1.egg path/to/setuptools.egg""") @@ -137,10 +135,10 @@ def test_python_activation_with_files(tmpdir, python_and_extension_dirs): python_pkg = python_spec.package python_pkg.activate(ext_pkg) - assert os.path.exists(join_path(python_prefix, 'bin/py-ext-tool')) + assert os.path.exists(os.path.join(python_prefix, 'bin/py-ext-tool')) easy_install_location = 'lib/python2.7/site-packages/easy-install.pth' - with open(join_path(python_prefix, easy_install_location), 'r') as F: + with open(os.path.join(python_prefix, easy_install_location), 'r') as F: easy_install_contents = F.read() assert 'ext1.egg' in easy_install_contents @@ -163,9 +161,9 @@ def test_python_activation_view(tmpdir, python_and_extension_dirs): python_pkg = python_spec.package python_pkg.activate(ext_pkg, extensions_layout=view.extensions_layout) - assert not os.path.exists(join_path(python_prefix, 'bin/py-ext-tool')) + assert not os.path.exists(os.path.join(python_prefix, 'bin/py-ext-tool')) - assert os.path.exists(join_path(view_dir, 'bin/py-ext-tool')) + assert os.path.exists(os.path.join(view_dir, 'bin/py-ext-tool')) @pytest.fixture() @@ -247,7 +245,7 @@ def test_perl_activation_with_files(tmpdir, perl_and_extension_dirs): perl_pkg = perl_spec.package perl_pkg.activate(ext_pkg) - assert os.path.exists(join_path(perl_prefix, 'bin/perl-ext-tool')) + assert os.path.exists(os.path.join(perl_prefix, 'bin/perl-ext-tool')) def test_perl_activation_view(tmpdir, perl_and_extension_dirs): @@ -266,6 +264,6 @@ def test_perl_activation_view(tmpdir, perl_and_extension_dirs): perl_pkg = perl_spec.package perl_pkg.activate(ext_pkg, extensions_layout=view.extensions_layout) - assert not os.path.exists(join_path(perl_prefix, 'bin/perl-ext-tool')) + assert not os.path.exists(os.path.join(perl_prefix, 'bin/perl-ext-tool')) - assert os.path.exists(join_path(view_dir, 'bin/perl-ext-tool')) + assert os.path.exists(os.path.join(view_dir, 'bin/perl-ext-tool')) diff --git a/lib/spack/spack/util/file_cache.py b/lib/spack/spack/util/file_cache.py index 37e2bcf0a6..d0551faff9 100644 --- a/lib/spack/spack/util/file_cache.py +++ b/lib/spack/spack/util/file_cache.py @@ -25,7 +25,7 @@ import os import shutil -from llnl.util.filesystem import mkdirp, join_path +from llnl.util.filesystem import mkdirp from llnl.util.lock import Lock, ReadTransaction, WriteTransaction from spack.error import SpackError @@ -57,7 +57,7 @@ class FileCache(object): def destroy(self): """Remove all files under the cache root.""" for f in os.listdir(self.root): - path = join_path(self.root, f) + path = os.path.join(self.root, f) if os.path.isdir(path): shutil.rmtree(path, True) else: @@ -65,14 +65,14 @@ class FileCache(object): def cache_path(self, key): """Path to the file in the cache for a particular key.""" - return join_path(self.root, key) + return os.path.join(self.root, key) def _lock_path(self, key): """Path to the file in the cache for a particular key.""" keyfile = os.path.basename(key) keydir = os.path.dirname(key) - return join_path(self.root, keydir, '.' + keyfile + '.lock') + return os.path.join(self.root, keydir, '.' + keyfile + '.lock') def _get_lock(self, key): """Create a lock for a key, if necessary, and return a lock object.""" |