Skip to content

Commit e082752

Browse files
authored
Merge pull request #4294 from easybuilders/4.8.x
release EasyBuild v4.8.0
2 parents 21d8ebc + 6e245e5 commit e082752

File tree

19 files changed

+308
-65
lines changed

19 files changed

+308
-65
lines changed

.github/workflows/container_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
runs-on: ubuntu-22.04
1515
strategy:
1616
matrix:
17-
python: [2.7, 3.7]
17+
python: [3.7]
1818
fail-fast: false
1919
steps:
2020
- uses: actions/checkout@v3
2121

2222
- name: set up Python
23-
uses: actions/setup-python@v3
23+
uses: actions/setup-python@v4
2424
with:
2525
python-version: ${{matrix.python}}
2626
architecture: x64

.github/workflows/container_tests_apptainer.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ jobs:
1414
runs-on: ubuntu-22.04
1515
strategy:
1616
matrix:
17-
python: [2.7, 3.7]
17+
python: [3.7]
1818
apptainer: [1.0.0, 1.1.7]
1919
fail-fast: false
2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
2222

2323
- name: set up Python
24-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v3
2525
with:
2626
python-version: ${{matrix.python}}
2727
architecture: x64

.github/workflows/eb_command.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
runs-on: ubuntu-20.04
1515
strategy:
1616
matrix:
17-
python: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
17+
python: [3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
1818
fail-fast: false
1919
steps:
2020
- uses: actions/checkout@v3
2121

2222
- name: set up Python
23-
uses: actions/setup-python@v3
23+
uses: actions/setup-python@v4
2424
with:
2525
python-version: ${{matrix.python}}
2626
architecture: x64

.github/workflows/linting.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ jobs:
1313
runs-on: ubuntu-20.04
1414
strategy:
1515
matrix:
16-
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
16+
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
1717

1818
steps:
1919
- uses: actions/checkout@v3
2020

2121
- name: set up Python
22-
uses: actions/setup-python@v3
22+
uses: actions/setup-python@v4
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525

.github/workflows/unit_tests.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ubuntu-20.04
2626
strategy:
2727
matrix:
28-
python: [2.7, 3.6]
28+
python: [3.6]
2929
modules_tool:
3030
# use variables defined by 'setup' job above, see also
3131
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context
@@ -81,7 +81,7 @@ jobs:
8181
- uses: actions/checkout@v3
8282

8383
- name: set up Python
84-
uses: actions/setup-python@v3
84+
uses: actions/setup-python@v4
8585
with:
8686
python-version: ${{matrix.python}}
8787
architecture: x64
@@ -207,10 +207,6 @@ jobs:
207207
# create file owned by root but writable by anyone (used by test_copy_file)
208208
sudo touch /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
209209
sudo chmod o+w /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
210-
# silence deprecation warning when using Python 2, since it breaks a bunch of tests
211-
if [ "${{matrix.python}}" == '2.7' ]; then
212-
export TEST_EASYBUILD_SILENCE_DEPRECATION_WARNINGS=python2
213-
fi
214210
# run test suite
215211
python -O -m test.framework.suite 2>&1 | tee test_framework_suite.log
216212
# try and make sure output of running tests is clean (no printed messages/warnings)

RELEASE_NOTES

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ For more detailed information, please see the git log.
44
These release notes can also be consulted at https://easybuild.readthedocs.io/en/latest/Release_notes.html.
55

66

7+
v4.8.0 (7 July 2023)
8+
--------------------
9+
10+
feature release
11+
12+
- various enhancements, including:
13+
- use version suffixes in PR title instead of Python versions when using --new-pr (#4253 + #4286)
14+
- add script to find updated ECs for installed module (#4271)
15+
- various bug fixes, including:
16+
- fix regex for extracting glibc version from output of '`ldd --version`' in Gentoo Linux (#4290)
17+
- allow versionsuffix to be set to None in `det_full_ec_version` (#4292)
18+
- other changes:
19+
- stop running tests with Python 2.7 since it is no longer supported in GitHub Action (#4267)
20+
- replace imp.load_source by leveraging importlib.util.module_from_spec when using Python 3 (#4280)
21+
22+
723
v4.7.2 (27 May 2023)
824
--------------------
925

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
GREEN='\033[0;32m'
6+
RED='\033[0;31m'
7+
YELLOW='\033[0;33m'
8+
NC='\033[0m'
9+
10+
function printError {
11+
echo -e "${RED}$@${NC}"
12+
}
13+
14+
verbose=0
15+
function printVerbose {
16+
(( verbose == 0 )) || echo "$@"
17+
}
18+
19+
function checkModule {
20+
moduleFolder="$1"
21+
moduleName="$(basename "$(dirname "$moduleFolder")")"
22+
moduleVersion="$(basename "$moduleFolder")"
23+
moduleStr="$moduleName/$moduleVersion"
24+
printVerbose "Processing $moduleStr"
25+
ec_glob=( "$moduleFolder/easybuild/"*.eb )
26+
if [[ ! -e "${ec_glob[@]}" ]]; then
27+
printError "=== Did not find installed EC for $moduleStr"
28+
return
29+
fi
30+
ec_installed="$ec_glob"
31+
ec_filename=$(basename "$ec_installed")
32+
# Try with most likely location first for speed
33+
first_letter=${ec_filename:0:1}
34+
letterPath=$easyconfigFolder/${first_letter,,}
35+
if [[ -d "$letterPath" ]]; then
36+
ec_new="$(find "$letterPath" -type f -name "$ec_filename")"
37+
else
38+
ec_new=
39+
fi
40+
# Fallback if not found
41+
[[ -n "$ec_new" ]] || ec_new="$(find "$easyconfigFolder" -type f -name "$ec_filename")"
42+
if [[ -z "$ec_new" ]]; then
43+
printError "=== Did not find new EC $ec_filename"
44+
elif [[ ! -e "$ec_new" ]]; then
45+
printError "=== Found multiple new ECs: $ec_new"
46+
elif ! out=$(diff "$ec_installed" "$ec_new"); then
47+
echo -e "${YELLOW}=== Needs updating: ${GREEN}${ec_installed}${YELLOW} vs ${GREEN}${ec_new}${NC}"
48+
if ((showDiff == 1)); then
49+
echo "$out"
50+
fi
51+
fi
52+
}
53+
54+
ecDefaultFolder=
55+
if path=$(which eb 2>/dev/null); then
56+
path=$(dirname "$path")
57+
for p in "$path" "$(dirname "$path")"; do
58+
if [ -d "$p/easybuild/easyconfigs" ]; then
59+
ecDefaultFolder=$p
60+
break
61+
fi
62+
done
63+
fi
64+
65+
function usage {
66+
echo "Usage: $(basename "$0") [--verbose] [--diff] --loaded|--modules INSTALLPATH --easyconfigs EC-FOLDER"
67+
echo
68+
echo "Check installed modules against the source EasyConfig (EC) files to determine which have changed."
69+
echo "Can either check the currently loaded modules or all modules installed in a specific location"
70+
echo
71+
echo "--verbose Verbose status output while checking"
72+
echo "--loaded Check only currently loaded modules"
73+
echo "--diff Show diff of changed module files"
74+
echo "--modules INSTALLPATH Check all modules in the specified (software) installpath, i.e. the root of module-binaries"
75+
echo "--easyconfigs EC-FOLDER Path to the folder containg the current/updated EasyConfigs. ${ecDefaultFolder:+Defaults to $ecDefaultFolder}"
76+
exit 0
77+
}
78+
79+
checkLoadedModules=0
80+
showDiff=0
81+
modulesFolder=""
82+
easyconfigFolder=$ecDefaultFolder
83+
84+
while [[ $# -gt 0 ]]; do
85+
case "$1" in
86+
-h|--help)
87+
usage;;
88+
-v|--verbose)
89+
verbose=1;;
90+
-d|--diff)
91+
showDiff=1;;
92+
-l|--loaded)
93+
checkLoadedModules=1;;
94+
-m|--modules)
95+
modulesFolder="$2"
96+
shift;;
97+
-e|--easyconfigs)
98+
easyconfigFolder="$2"
99+
shift;;
100+
*)
101+
printError "Unknown argument: $1"
102+
exit 1;;
103+
esac
104+
shift
105+
done
106+
107+
if [ -z "$easyconfigFolder" ]; then
108+
printError "Folder to easyconfigs not given!" && exit 1
109+
fi
110+
if [ -z "$modulesFolder" ]; then
111+
if (( checkLoadedModules == 0 )); then
112+
printError "Need either --modules or --loaded to specify what to check!" && exit 1
113+
fi
114+
elif (( checkLoadedModules == 1 )); then
115+
printError "Cannot specify --modules and --loaded!" && exit 1
116+
fi
117+
118+
if [ -d "$easyconfigFolder/easybuild/easyconfigs" ]; then
119+
easyconfigFolder="$easyconfigFolder/easybuild/easyconfigs"
120+
fi
121+
122+
if (( checkLoadedModules == 1 )); then
123+
for varname in $(compgen -A variable | grep '^EBROOT'); do
124+
checkModule "${!varname}"
125+
done
126+
else
127+
for module in "$modulesFolder"/*/*/easybuild; do
128+
checkModule "$(dirname "$module")"
129+
done
130+
fi

easybuild/tools/filetools.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import difflib
4545
import glob
4646
import hashlib
47-
import imp
4847
import inspect
4948
import itertools
5049
import os
@@ -66,7 +65,7 @@
6665
from easybuild.tools.config import DEFAULT_WAIT_ON_LOCK_INTERVAL, ERROR, GENERIC_EASYBLOCK_PKG, IGNORE, WARN
6766
from easybuild.tools.config import build_option, install_path
6867
from easybuild.tools.output import PROGRESS_BAR_DOWNLOAD_ONE, start_progress_bar, stop_progress_bar, update_progress_bar
69-
from easybuild.tools.py2vs3 import HTMLParser, std_urllib, string_type
68+
from easybuild.tools.py2vs3 import HTMLParser, load_source, std_urllib, string_type
7069
from easybuild.tools.utilities import natural_keys, nub, remove_unwanted_chars, trace_msg
7170

7271
try:
@@ -2801,7 +2800,7 @@ def install_fake_vsc():
28012800
def get_easyblock_class_name(path):
28022801
"""Make sure file is an easyblock and get easyblock class name"""
28032802
fn = os.path.basename(path).split('.')[0]
2804-
mod = imp.load_source(fn, path)
2803+
mod = load_source(fn, path)
28052804
clsmembers = inspect.getmembers(mod, inspect.isclass)
28062805
for cn, co in clsmembers:
28072806
if co.__module__ == mod.__name__:

easybuild/tools/github.py

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,45 @@ def new_branch_github(paths, ecs, commit_msg=None):
15811581
return res
15821582

15831583

1584+
def det_pr_title(ecs):
1585+
"""
1586+
Create title for PR based on first easyconfigs
1587+
:param ecs: list of parsed easyconfigs
1588+
"""
1589+
1590+
# only use most common toolchain(s) in toolchain label of PR title
1591+
toolchains = ['%(name)s/%(version)s' % ec['toolchain'] for ec in ecs]
1592+
toolchains_counted = sorted([(toolchains.count(tc), tc) for tc in nub(toolchains)])
1593+
toolchain_label = ','.join([tc for (cnt, tc) in toolchains_counted if cnt == toolchains_counted[-1][0]])
1594+
1595+
# only use most common module class(es) in moduleclass label of PR title
1596+
classes = [ec['moduleclass'] for ec in ecs]
1597+
classes_counted = sorted([(classes.count(c), c) for c in nub(classes)])
1598+
class_label = ','.join([tc for (cnt, tc) in classes_counted if cnt == classes_counted[-1][0]])
1599+
1600+
names_and_versions = nub(["%s v%s" % (ec.name, ec.version) for ec in ecs])
1601+
if len(names_and_versions) <= 3:
1602+
main_title = ', '.join(names_and_versions)
1603+
else:
1604+
main_title = ', '.join(names_and_versions[:3] + ['...'])
1605+
1606+
title = "{%s}[%s] %s" % (class_label, toolchain_label, main_title)
1607+
1608+
# Find all suffixes
1609+
suffixes = []
1610+
for ec in ecs:
1611+
if 'versionsuffix' in ec and ec['versionsuffix']:
1612+
suffixes.append(ec['versionsuffix'].strip('-').replace('-', ' '))
1613+
if suffixes:
1614+
suffixes = sorted(nub(suffixes))
1615+
if len(suffixes) <= 2:
1616+
title += ' w/ ' + ', '.join(suffixes)
1617+
else:
1618+
title += ' w/ ' + ', '.join(suffixes[:2] + ['...'])
1619+
1620+
return title
1621+
1622+
15841623
@only_if_module_is_available('git', pkgname='GitPython')
15851624
def new_pr_from_branch(branch_name, title=None, descr=None, pr_target_repo=None, pr_metadata=None, commit_msg=None):
15861625
"""
@@ -1691,42 +1730,10 @@ def new_pr_from_branch(branch_name, title=None, descr=None, pr_target_repo=None,
16911730

16921731
labels = det_pr_labels(file_info, pr_target_repo)
16931732

1694-
if pr_target_repo == GITHUB_EASYCONFIGS_REPO:
1695-
# only use most common toolchain(s) in toolchain label of PR title
1696-
toolchains = ['%(name)s/%(version)s' % ec['toolchain'] for ec in file_info['ecs']]
1697-
toolchains_counted = sorted([(toolchains.count(tc), tc) for tc in nub(toolchains)])
1698-
toolchain_label = ','.join([tc for (cnt, tc) in toolchains_counted if cnt == toolchains_counted[-1][0]])
1699-
1700-
# only use most common module class(es) in moduleclass label of PR title
1701-
classes = [ec['moduleclass'] for ec in file_info['ecs']]
1702-
classes_counted = sorted([(classes.count(c), c) for c in nub(classes)])
1703-
class_label = ','.join([tc for (cnt, tc) in classes_counted if cnt == classes_counted[-1][0]])
1704-
17051733
if title is None:
17061734
if pr_target_repo == GITHUB_EASYCONFIGS_REPO:
17071735
if file_info['ecs'] and all(file_info['new']) and not deleted_paths:
1708-
# mention software name/version in PR title (only first 3)
1709-
names_and_versions = nub(["%s v%s" % (ec.name, ec.version) for ec in file_info['ecs']])
1710-
if len(names_and_versions) <= 3:
1711-
main_title = ', '.join(names_and_versions)
1712-
else:
1713-
main_title = ', '.join(names_and_versions[:3] + ['...'])
1714-
1715-
title = "{%s}[%s] %s" % (class_label, toolchain_label, main_title)
1716-
1717-
# if Python is listed as a dependency, then mention Python version(s) in PR title
1718-
pyver = []
1719-
for ec in file_info['ecs']:
1720-
# iterate over all dependencies (incl. build dependencies & multi-deps)
1721-
for dep in ec.dependencies():
1722-
if dep['name'] == 'Python':
1723-
# check whether Python is listed as a multi-dep if it's marked as a build dependency
1724-
if dep['build_only'] and 'Python' not in ec['multi_deps']:
1725-
continue
1726-
else:
1727-
pyver.append(dep['version'])
1728-
if pyver:
1729-
title += " w/ Python %s" % ' + '.join(sorted(nub(pyver)))
1736+
title = det_pr_title(file_info['ecs'])
17301737
elif pr_target_repo == GITHUB_EASYBLOCKS_REPO:
17311738
if file_info['eb_names'] and all(file_info['new']) and not deleted_paths:
17321739
plural = 's' if len(file_info['eb_names']) > 1 else ''

easybuild/tools/hooks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
* Kenneth Hoste (Ghent University)
3131
"""
3232
import difflib
33-
import imp
3433
import os
3534

3635
from easybuild.base import fancylogger
36+
from easybuild.tools.py2vs3 import load_source
3737
from easybuild.tools.build_log import EasyBuildError, print_msg
3838
from easybuild.tools.config import build_option
3939

@@ -123,7 +123,7 @@ def load_hooks(hooks_path):
123123
_log.info("Importing hooks implementation from %s...", hooks_path)
124124
try:
125125
# import module that defines hooks, and collect all functions of which name ends with '_hook'
126-
imported_hooks = imp.load_source(hooks_filename, hooks_path)
126+
imported_hooks = load_source(hooks_filename, hooks_path)
127127
for attr in dir(imported_hooks):
128128
if attr.endswith(HOOK_SUFF):
129129
hook = getattr(imported_hooks, attr)

0 commit comments

Comments
 (0)