Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iterate over subdirectories in order in find_egg_dir_for of bootstrap script, to ensure oldest vsc-install is picked #2819

Merged
merged 1 commit into from
Mar 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 15 additions & 7 deletions easybuild/scripts/bootstrap_eb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down