From 6972d1d3a3b19a431bed03454aa8c62423f6652f Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 22 Mar 2019 12:58:48 +0100 Subject: [PATCH] iterate over subdirectories in order in find_egg_dir_for of bootstrap script, to ensure oldest vsc-install is picked --- .travis.yml | 2 +- easybuild/scripts/bootstrap_eb.py | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 514b20745a..f67aa142e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -112,7 +112,7 @@ script: - EB_BOOTSTRAP_VERSION=$(grep '^EB_BOOTSTRAP_VERSION' $TRAVIS_BUILD_DIR/easybuild/scripts/bootstrap_eb.py | sed 's/[^0-9.]//g') - EB_BOOTSTRAP_SHA256SUM=$(sha256sum $TRAVIS_BUILD_DIR/easybuild/scripts/bootstrap_eb.py | cut -f1 -d' ') - EB_BOOTSTRAP_FOUND="$EB_BOOTSTRAP_VERSION $EB_BOOTSTRAP_SHA256SUM" - - EB_BOOTSTRAP_EXPECTED="20190112.01 51b89475ffd0f7dd2bf713e7984e7b35a627196af06d03c2cf75f6bcda8c54c0" + - EB_BOOTSTRAP_EXPECTED="20190322.01 4b00b89b2317e2e44fc56d0223e10239c1b4efc50f81fcd39eb73895bccbe927" - test "$EB_BOOTSTRAP_FOUND" = "$EB_BOOTSTRAP_EXPECTED" || (echo "Version check on bootstrap script failed $EB_BOOTSTRAP_FOUND" && exit 1) # test bootstrap script - python $TRAVIS_BUILD_DIR/easybuild/scripts/bootstrap_eb.py /tmp/$TRAVIS_JOB_ID/eb_bootstrap diff --git a/easybuild/scripts/bootstrap_eb.py b/easybuild/scripts/bootstrap_eb.py index e94727867f..e0c5c3105d 100644 --- a/easybuild/scripts/bootstrap_eb.py +++ b/easybuild/scripts/bootstrap_eb.py @@ -54,7 +54,7 @@ from hashlib import md5 -EB_BOOTSTRAP_VERSION = '20190112.01' +EB_BOOTSTRAP_VERSION = '20190322.01' # argparse preferrred, optparse deprecated >=2.7 HAVE_ARGPARSE = False @@ -173,19 +173,26 @@ def det_modules_path(install_path): def find_egg_dir_for(path, pkg): """Find full path of egg dir for given package.""" + res = None + for libdir in ['lib', 'lib64']: full_libpath = os.path.join(path, det_lib_path(libdir)) eggdir_regex = re.compile('%s-[0-9a-z.]+-py[0-9.]+.egg' % pkg.replace('-', '_')) - subdirs = (os.path.exists(full_libpath) and os.listdir(full_libpath)) or [] + subdirs = (os.path.exists(full_libpath) and sorted(os.listdir(full_libpath))) or [] for subdir in subdirs: if eggdir_regex.match(subdir): eggdir = os.path.join(full_libpath, subdir) - debug("Found egg dir for %s at %s" % (pkg, eggdir)) - return eggdir + if res is None: + debug("Found egg dir for %s at %s" % (pkg, eggdir)) + res = eggdir + else: + debug("Found another egg dir for %s at %s (ignoring it)" % (pkg, eggdir)) # no egg dir found - debug("Failed to determine egg dir path for %s in %s (subdirs: %s)" % (pkg, path, subdirs)) - return None + if res is None: + debug("Failed to determine egg dir path for %s in %s (subdirs: %s)" % (pkg, path, subdirs)) + + return res def prep(path): @@ -684,7 +691,8 @@ def stage2(tmpdir, templates, install_path, distribute_egg_dir, sourcepath): if res: pkg_url_part = res.group(1) else: - error("Failed to determine PyPI package URL for %s: %s\n" % (pkg, pkg_simple)) + error_msg = "Failed to determine PyPI package URL for %s using pattern '%s': %s\n" + error(error_msg % (pkg, pkg_url_part_regex.pattern, pkg_simple)) pkg_url = 'https://pypi.python.org/' + pkg_url_part pkg_urls.append(pkg_url)