mirror of
https://github.com/certbot/certbot.git
synced 2025-08-09 15:02:48 +03:00
Use venv over virtualenv in venv3 (#6922)
Fixes #6861. _venv_common.py is no longer executable. The reason for this is the venv creation logic is now different between Python 2 and Python 3. We could add code that branches on the Python version running the script, but I personally think that's unnecessary. --setuptools and --no-site-packages is no longer passed to virtualenv either. These flags were made noops in virtualenv 1.10 and 1.7 respectively, but all of CentOS 6, 7, Debian 8+, and Ubuntu 14.04+ have new enough versions of virtualenv where these flags are no longer necessary. They are not even accepted as flags to Python 3's venv module. Use of VENV_ARGS from test_sdists.sh was also removed because that environment variable hasn't done anything in a while. I ran test farm tests on test_apache2.sh and test_sdists.sh with these changes and they passed. * Fixes #6861. * _venv_common is no longer executable.
This commit is contained in:
@@ -1,41 +1,29 @@
|
||||
#!/usr/bin/env python
|
||||
# Developer virtualenv setup for Certbot client
|
||||
import os
|
||||
import sys
|
||||
|
||||
import _venv_common
|
||||
|
||||
REQUIREMENTS = [
|
||||
'-e acme[dev]',
|
||||
'-e .[dev,docs]',
|
||||
'-e certbot-apache',
|
||||
'-e certbot-dns-cloudflare',
|
||||
'-e certbot-dns-cloudxns',
|
||||
'-e certbot-dns-digitalocean',
|
||||
'-e certbot-dns-dnsimple',
|
||||
'-e certbot-dns-dnsmadeeasy',
|
||||
'-e certbot-dns-gehirn',
|
||||
'-e certbot-dns-google',
|
||||
'-e certbot-dns-linode',
|
||||
'-e certbot-dns-luadns',
|
||||
'-e certbot-dns-nsone',
|
||||
'-e certbot-dns-ovh',
|
||||
'-e certbot-dns-rfc2136',
|
||||
'-e certbot-dns-route53',
|
||||
'-e certbot-dns-sakuracloud',
|
||||
'-e certbot-nginx',
|
||||
'-e certbot-postfix',
|
||||
'-e letshelp-certbot',
|
||||
'-e certbot-compatibility-test',
|
||||
]
|
||||
def create_venv(venv_path):
|
||||
"""Create a Python 2 virtual environment at venv_path.
|
||||
|
||||
:param str venv_path: path where the venv should be created
|
||||
|
||||
"""
|
||||
python2 = _venv_common.find_python_executable(2)
|
||||
command = [sys.executable, '-m', 'virtualenv', '--python', python2, venv_path]
|
||||
_venv_common.subprocess_with_print(command)
|
||||
|
||||
|
||||
def main():
|
||||
def main(pip_args=None):
|
||||
if os.name == 'nt':
|
||||
raise ValueError('Certbot for Windows is not supported on Python 2.x.')
|
||||
|
||||
venv_args = '--python "{0}"'.format(_venv_common.find_python_executable(2))
|
||||
_venv_common.main('venv', venv_args, REQUIREMENTS)
|
||||
venv_path = _venv_common.prepare_venv_path('venv')
|
||||
create_venv(venv_path)
|
||||
_venv_common.install_packages(venv_path, pip_args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main(sys.argv[1:])
|
||||
|
Reference in New Issue
Block a user