Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
68057bc
[EB5] Remove Python 2
branfosj Mar 26, 2023
eab4067
remove py2 deprecation
branfosj Mar 26, 2023
c317efe
flake8 and unit tests
branfosj Mar 26, 2023
f9309b8
remove unecessary restrictions on requirements
branfosj Mar 29, 2023
870cd92
remove use of py2vs3 (pt1)
branfosj Mar 31, 2023
c207173
remove use of py2vs3 (pt2)
branfosj Mar 31, 2023
420a794
remove use of py2vs3 (pt3)
branfosj Mar 31, 2023
7fdea83
remove use of py2vs3 (pt4)
branfosj Mar 31, 2023
452be35
restore import
branfosj Mar 31, 2023
778c21d
need to raise the exception
branfosj Mar 31, 2023
43dd69a
revert change to check if this is the bit causing the test failures
branfosj Mar 31, 2023
59afb81
revert to last working state
branfosj Apr 2, 2023
5d93e85
string_type
branfosj Apr 2, 2023
39b2cd4
revert accidental deletion
branfosj Apr 2, 2023
e2f37a4
reload
branfosj Apr 2, 2023
efa35d5
OrderedDict
branfosj Apr 2, 2023
4c90e9c
Mapping
branfosj Apr 2, 2023
229bc9d
ascii_*
branfosj Apr 2, 2023
0a3090a
StringIO
branfosj Apr 2, 2023
b6e1f3e
do not edit bootstrap script
branfosj Apr 2, 2023
605eb25
urllib
branfosj Apr 2, 2023
8b4dbf9
configparser
branfosj Apr 2, 2023
6510b29
base/meta class
branfosj Apr 2, 2023
f35c2ec
traceback
branfosj Apr 2, 2023
00a84e7
urlopen/html parser
branfosj Apr 2, 2023
01befab
json loads
branfosj Apr 2, 2023
9583500
method name
branfosj Apr 2, 2023
9a6f51e
remove import
branfosj Apr 2, 2023
6294ecb
subprocess terminate and popen
branfosj Apr 2, 2023
0f7fd41
remove sort_looseversions tests
branfosj Apr 2, 2023
29ba208
f8
branfosj Apr 2, 2023
668acef
request
branfosj Apr 2, 2023
f5f58b9
Revert "request"
branfosj Apr 2, 2023
238a160
add deprecation warning
branfosj Apr 2, 2023
ed1e89e
request test
branfosj Apr 2, 2023
85fc1f5
request
branfosj Apr 2, 2023
60266d5
consider python3 before python
branfosj Apr 7, 2023
e9a6955
resolve conflict
branfosj Apr 7, 2023
63f10d0
Merge branch 'py2' of github.com:branfosj/easybuild-framework into py2
branfosj Apr 7, 2023
58d57d1
fix eb python test
branfosj Apr 7, 2023
4179997
Merge branch '5.0.x' into py2
boegel Apr 11, 2023
3aacca4
remove py2 from new apptainer container test
branfosj Apr 11, 2023
3c12303
use log.deprecated in py2vs3 module
boegel Apr 12, 2023
1d61bc0
Merge pull request #7 from boegel/py2
branfosj Apr 12, 2023
eb53b70
fix merge conflict
branfosj Apr 12, 2023
855db89
relocate subprocess_popen_text + subprocess_terminate to easybuild.to…
boegel Apr 12, 2023
9eb6ce2
avoid duplicate copies of create_base_metaclass + mk_wrapper_baseclas…
boegel Apr 12, 2023
117cd51
add #noqa to unused imports in py2vs3/*py
boegel Apr 12, 2023
2ab6d3b
add back python2_is_deprecated to py2vs3/__init__.py, to avoid broken…
boegel Apr 12, 2023
4c1dc23
Merge pull request #8 from boegel/py2
branfosj Apr 12, 2023
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
11 changes: 1 addition & 10 deletions .github/workflows/bootstrap_script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
matrix:
# Don't run for Python 3.8, 3.9 , people should just use `pip install easybuild`
python: [2.7, 3.6, 3.7]
python: [3.6, 3.7]
modules_tool:
# use variables defined by 'setup' job above, see also
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context
Expand All @@ -36,21 +36,12 @@ jobs:
lc_all: [""]
include:
# also test with module tools other than Lmod (only Tcl syntax)
- modules_tool: ${{needs.setup.outputs.modulesTcl}}
module_syntax: Tcl
python: 2.7
- modules_tool: ${{needs.setup.outputs.modulesTcl}}
module_syntax: Tcl
python: 3.6
- modules_tool: ${{needs.setup.outputs.modules3}}
module_syntax: Tcl
python: 2.7
- modules_tool: ${{needs.setup.outputs.modules3}}
module_syntax: Tcl
python: 3.6
- modules_tool: ${{needs.setup.outputs.modules4}}
module_syntax: Tcl
python: 2.7
- modules_tool: ${{needs.setup.outputs.modules4}}
module_syntax: Tcl
python: 3.6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/container_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-18.04
strategy:
matrix:
python: [2.7, 3.6]
python: [3.6]
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eb_command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
python: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11']

steps:
- uses: actions/checkout@v3
Expand All @@ -30,10 +30,4 @@ jobs:

- name: Run flake8 to verify PEP8-compliance of Python code
run: |
# don't check py2vs3/py3.py when testing with Python 2, and vice versa
if [[ "${{ matrix.python-version }}" =~ "2." ]]; then
py_excl=py3
else
py_excl=py2
fi
flake8 --exclude ./easybuild/tools/py2vs3/${py_excl}.py
flake8
9 changes: 1 addition & 8 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python: [2.7, 3.6]
python: [3.6]
modules_tool:
# use variables defined by 'setup' job above, see also
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context
Expand All @@ -46,9 +46,6 @@ jobs:
module_syntax: Lua
include:
# Test different Python 3 versions with Lmod 8.x (with both Lua and Tcl module syntax)
- python: 3.5
modules_tool: ${{needs.setup.outputs.lmod8}}
module_syntax: Lua
- python: 3.7
modules_tool: ${{needs.setup.outputs.lmod8}}
module_syntax: Lua
Expand Down Expand Up @@ -205,10 +202,6 @@ jobs:
# create file owned by root but writable by anyone (used by test_copy_file)
sudo touch /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
sudo chmod o+w /tmp/file_to_overwrite_for_easybuild_test_copy_file.txt
# silence deprecation warning when using Python 2, since it breaks a bunch of tests
if [ "${{matrix.python}}" == '2.7' ]; then
export TEST_EASYBUILD_SILENCE_DEPRECATION_WARNINGS=python2
fi
# run test suite
python -O -m test.framework.suite 2>&1 | tee test_framework_suite.log
# try and make sure output of running tests is clean (no printed messages/warnings)
Expand Down
4 changes: 0 additions & 4 deletions easybuild/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
from easybuild.tools.robot import check_conflicts, dry_run, missing_deps, resolve_dependencies, search_easyconfigs
from easybuild.tools.package.utilities import check_pkg_support
from easybuild.tools.parallelbuild import submit_jobs
from easybuild.tools.py2vs3 import python2_is_deprecated
from easybuild.tools.repository.repository import init_repository
from easybuild.tools.systemtools import check_easybuild_deps
from easybuild.tools.testing import create_test_report, overall_test_report, regtest, session_state
Expand Down Expand Up @@ -603,9 +602,6 @@ def main(args=None, logfile=None, do_build=None, testing=False, modtool=None):
eb_go, cfg_settings = set_up_configuration(args=args, logfile=logfile, testing=testing)
options, orig_paths = eb_go.options, eb_go.args

if 'python2' not in build_option('silence_deprecation_warnings'):
python2_is_deprecated()

global _log
(build_specs, _log, logfile, robot_path, search_query, eb_tmpdir, try_to_generate,
from_pr_list, tweaked_ecs_paths) = cfg_settings
Expand Down
31 changes: 2 additions & 29 deletions easybuild/tools/py2vs3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,13 @@
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
#
import sys

# all functionality provided by the py2 and py3 modules is made available via the easybuild.tools.py2vs3 namespace
if sys.version_info[0] >= 3:
from easybuild.tools.py2vs3.py3 import * # noqa
else:
from easybuild.tools.py2vs3.py2 import * # noqa
# all functionality provided by the py3 modules is made available via the easybuild.tools.py2vs3 namespace
from easybuild.tools.py2vs3.py3 import * # noqa


# based on six's 'with_metaclass' function
# see also https://stackoverflow.com/questions/18513821/python-metaclass-understanding-the-with-metaclass
def create_base_metaclass(base_class_name, metaclass, *bases):
"""Create new class with specified metaclass based on specified base class(es)."""
return metaclass(base_class_name, bases, {})


def python2_is_deprecated():
"""
Print warning when using Python 2, since the support for running EasyBuild with it is deprecated.
"""
if sys.version_info[0] == 2:
full_py_ver = '.'.join(str(x) for x in sys.version_info[:3])
warning_lines = [
"Running EasyBuild with Python v2.x is deprecated, found Python v%s." % full_py_ver,
"Support for running EasyBuild with Python v2.x will be removed in EasyBuild v5.0.",
'',
"It is strongly recommended to start using Python v3.x for running EasyBuild,",
"see https://docs.easybuild.io/en/latest/Python-2-3-compatibility.html for more information.",
]
max_len = max(len(x) for x in warning_lines)
for i in range(len(warning_lines)):
line_len = len(warning_lines[i])
warning_lines[i] = '!!! ' + warning_lines[i] + ' ' * (max_len - line_len) + ' !!!'
max_len = max(len(x) for x in warning_lines)
warning_lines.insert(0, '!' * max_len)
warning_lines.append('!' * max_len)
sys.stderr.write('\n\n' + '\n'.join(warning_lines) + '\n\n\n')
111 changes: 0 additions & 111 deletions easybuild/tools/py2vs3/py2.py

This file was deleted.

15 changes: 6 additions & 9 deletions eb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
# @author: Kenneth Hoste (Ghent University)
# @author: Pieter De Baets (Ghent University)
# @author: Jens Timmerman (Ghent University)
# @author: Simon Branford (University of Birmingham)

keyboard_interrupt() {
echo "Keyboard interrupt!"
Expand All @@ -40,9 +41,8 @@ keyboard_interrupt() {

trap keyboard_interrupt SIGINT

# Python 2.6+ or 3.5+ required
REQ_MIN_PY2VER=6
REQ_MIN_PY3VER=5
# Python 3.6+ required
REQ_MIN_PY3VER=6

EASYBUILD_MAIN='easybuild.main'

Expand All @@ -60,7 +60,7 @@ PYTHON=
# - EB_INSTALLPYTHON is set when EasyBuild is installed as a module (by EasyBuild). It is set to the PYTHON
# used during that installation (for example, you could override PYTHON using EB_PYTHON at installation
# time, this variable preserves that choice).
for python_cmd in "${EB_PYTHON}" "${EB_INSTALLPYTHON}" 'python' 'python3' 'python2'; do
for python_cmd in "${EB_PYTHON}" "${EB_INSTALLPYTHON}" 'python' 'python3'; do

# Only consider non-empty values, i.e. continue if e.g. $EB_PYTHON is not set
[ -n "${python_cmd}" ] || continue
Expand All @@ -76,10 +76,7 @@ for python_cmd in "${EB_PYTHON}" "${EB_INSTALLPYTHON}" 'python' 'python3' 'pytho
pyver_maj=$(echo "${pyver}" | cut -f1 -d'.')
pyver_min=$(echo "${pyver}" | cut -f2 -d'.')

if [ "${pyver_maj}" -eq 2 ] && [ "${pyver_min}" -ge "${REQ_MIN_PY2VER}" ]; then
verbose "'${python_cmd}' version: ${pyver}, which matches Python 2 version requirement (>= 2.${REQ_MIN_PY2VER})"
PYTHON="${python_cmd}"
elif [ "${pyver_maj}" -eq 3 ] && [ "${pyver_min}" -ge "${REQ_MIN_PY3VER}" ]; then
if [ "${pyver_maj}" -eq 3 ] && [ "${pyver_min}" -ge "${REQ_MIN_PY3VER}" ]; then
verbose "'${python_cmd}' version: ${pyver}, which matches Python 3 version requirement (>= 3.${REQ_MIN_PY3VER})"
PYTHON="${python_cmd}"
fi
Expand All @@ -106,7 +103,7 @@ done

if [ -z "${PYTHON}" ]; then
echo -n "ERROR: No compatible 'python' command found via \$PATH " >&2
echo "(EasyBuild requires Python 2.${REQ_MIN_PY2VER}+ or 3.${REQ_MIN_PY3VER}+)" >&2
echo "(EasyBuild requires Python 3.${REQ_MIN_PY3VER}+)" >&2
exit 1
else
verbose "Selected Python command: ${python_cmd} ($(command -v "${python_cmd}"))"
Expand Down
15 changes: 4 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ keyring
keyrings.alt

# GitPython 3.1.15 deprecates Python 3.5
GitPython==3.1.14; python_version >= '3.0' and python_version < '3.6'
GitPython; python_version >= '3.6' or python_version <= '3.0'
GitPython==3.1.14; python_version < '3.6'
GitPython; python_version >= '3.6'

# autopep8
# stick to older autopep8 with Python 2.7, since autopep8 1.7.0 requires pycodestyle>=2.9.1 (which is Python 3 only)
autopep8<1.7.0; python_version < '3.0'
autopep8; python_version >= '3.0'
autopep8

# PyYAML
PyYAML
Expand All @@ -20,18 +18,13 @@ PyYAML
# flake8 is a superset of pycodestyle
flake8

# 2.6.7 uses invalid Python 2 syntax
GC3Pie!=2.6.7; python_version < '3.0'
GC3Pie; python_version >= '3.0' and python_version < '3.11'
GC3Pie; python_version < '3.11'
python-graph-dot
python-hglib
requests

archspec

# cryptography 3.4.0 no longer supports Python 2.7
cryptography==3.3.2; python_version == '2.7'
cryptography; python_version >= '3.5' and python_version < '3.11'

# rich is only supported for Python 3.6+
rich; python_version >= '3.6'
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ def find_rel_test():
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
Expand Down