comparison contrib/automation/hgautomation/linux.py @ 48845:5c8148cd7f13

automation: drop support for Python 2.7 in Linux environment We stop installing Python 2.7 via pyenv. We stop installing the system Python 2 packages. We delete support for running tests on Python 2.7. Differential Revision: https://phab.mercurial-scm.org/D12262
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 19 Feb 2022 18:18:35 -0700
parents d953a42b157d
children 905bc9d0a149
comparison
equal deleted inserted replaced
48844:d79f0ce95c47 48845:5c8148cd7f13
23 'ubuntu18.04', 23 'ubuntu18.04',
24 'ubuntu19.04', 24 'ubuntu19.04',
25 } 25 }
26 26
27 INSTALL_PYTHONS = r''' 27 INSTALL_PYTHONS = r'''
28 PYENV2_VERSIONS="2.7.17 pypy2.7-7.2.0"
29 PYENV3_VERSIONS="3.5.10 3.6.13 3.7.10 3.8.10 3.9.5 pypy3.5-7.0.0 pypy3.6-7.3.3 pypy3.7-7.3.3" 28 PYENV3_VERSIONS="3.5.10 3.6.13 3.7.10 3.8.10 3.9.5 pypy3.5-7.0.0 pypy3.6-7.3.3 pypy3.7-7.3.3"
30 29
31 git clone https://github.com/pyenv/pyenv.git /hgdev/pyenv 30 git clone https://github.com/pyenv/pyenv.git /hgdev/pyenv
32 pushd /hgdev/pyenv 31 pushd /hgdev/pyenv
33 git checkout 328fd42c3a2fbf14ae46dae2021a087fe27ba7e2 32 git checkout 328fd42c3a2fbf14ae46dae2021a087fe27ba7e2
43 42
44 VIRTUALENV_SHA256=f78d81b62d3147396ac33fc9d77579ddc42cc2a98dd9ea38886f616b33bc7fb2 43 VIRTUALENV_SHA256=f78d81b62d3147396ac33fc9d77579ddc42cc2a98dd9ea38886f616b33bc7fb2
45 VIRTUALENV_TARBALL=virtualenv-16.7.5.tar.gz 44 VIRTUALENV_TARBALL=virtualenv-16.7.5.tar.gz
46 wget -O ${VIRTUALENV_TARBALL} --progress dot:mega https://files.pythonhosted.org/packages/66/f0/6867af06d2e2f511e4e1d7094ff663acdebc4f15d4a0cb0fed1007395124/${VIRTUALENV_TARBALL} 45 wget -O ${VIRTUALENV_TARBALL} --progress dot:mega https://files.pythonhosted.org/packages/66/f0/6867af06d2e2f511e4e1d7094ff663acdebc4f15d4a0cb0fed1007395124/${VIRTUALENV_TARBALL}
47 echo "${VIRTUALENV_SHA256} ${VIRTUALENV_TARBALL}" | sha256sum --check - 46 echo "${VIRTUALENV_SHA256} ${VIRTUALENV_TARBALL}" | sha256sum --check -
48
49 for v in ${PYENV2_VERSIONS}; do
50 pyenv install -v ${v}
51 ${PYENV_ROOT}/versions/${v}/bin/python get-pip.py
52 ${PYENV_ROOT}/versions/${v}/bin/pip install ${VIRTUALENV_TARBALL}
53 ${PYENV_ROOT}/versions/${v}/bin/pip install -r /hgdev/requirements-py2.txt
54 done
55 47
56 for v in ${PYENV3_VERSIONS}; do 48 for v in ${PYENV3_VERSIONS}; do
57 pyenv install -v ${v} 49 pyenv install -v ${v}
58 ${PYENV_ROOT}/versions/${v}/bin/python get-pip.py 50 ${PYENV_ROOT}/versions/${v}/bin/python get-pip.py
59 51
70 esac 62 esac
71 63
72 ${PYENV_ROOT}/versions/${v}/bin/pip install -r /hgdev/${REQUIREMENTS} 64 ${PYENV_ROOT}/versions/${v}/bin/pip install -r /hgdev/${REQUIREMENTS}
73 done 65 done
74 66
75 pyenv global ${PYENV2_VERSIONS} ${PYENV3_VERSIONS} system 67 pyenv global ${PYENV3_VERSIONS} system
76 '''.lstrip().replace( 68 '''.lstrip().replace(
77 '\r\n', '\n' 69 '\r\n', '\n'
78 ) 70 )
79 71
80 INSTALL_PYOXIDIZER = r''' 72 INSTALL_PYOXIDIZER = r'''
272 libsqlite3-dev \ 264 libsqlite3-dev \
273 libssl-dev \ 265 libssl-dev \
274 netbase \ 266 netbase \
275 ntfs-3g \ 267 ntfs-3g \
276 nvme-cli \ 268 nvme-cli \
277 pyflakes \
278 pyflakes3 \ 269 pyflakes3 \
279 pylint \
280 pylint3 \ 270 pylint3 \
281 python-all-dev \
282 python-dev \
283 python-docutils \
284 python-fuzzywuzzy \
285 python-pygments \
286 python-subversion \
287 python-vcr \
288 python3-boto3 \ 271 python3-boto3 \
289 python3-dev \ 272 python3-dev \
290 python3-docutils \ 273 python3-docutils \
291 python3-fuzzywuzzy \ 274 python3-fuzzywuzzy \
292 python3-pygments \ 275 python3-pygments \
593 """Run tests on a remote Linux machine via an SSH client.""" 576 """Run tests on a remote Linux machine via an SSH client."""
594 test_flags = test_flags or [] 577 test_flags = test_flags or []
595 578
596 print('running tests') 579 print('running tests')
597 580
598 if python_version == 'system2': 581 if python_version == 'system3':
599 python = '/usr/bin/python2'
600 elif python_version == 'system3':
601 python = '/usr/bin/python3' 582 python = '/usr/bin/python3'
602 elif python_version.startswith('pypy'): 583 elif python_version.startswith('pypy'):
603 python = '/hgdev/pyenv/shims/%s' % python_version 584 python = '/hgdev/pyenv/shims/%s' % python_version
604 else: 585 else:
605 python = '/hgdev/pyenv/shims/python%s' % python_version 586 python = '/hgdev/pyenv/shims/python%s' % python_version