mirror of
https://github.com/certbot/certbot.git
synced 2025-08-09 15:02:48 +03:00
Certbot relies heavily on bash scripts to deploy a development environment and to execute tests. This is fine for Linux systems, including Travis, but problematic for Windows machines. This PR converts all theses scripts into Python, to make them platform independant. As a consequence, tox-win.ini is not needed anymore, and tox can be run indifferently on Windows or on Linux using a common tox.ini. AppVeyor is updated accordingly to execute tests for acme, certbot and all dns plugins. Other tests are not executed as they are for Docker, unsupported Apache/Nginx/Postfix plugins (for now) or not relevant for Windows (explicit Linux distribution tests or pylint). Another PR will be done on certbot website to update how a dev environment can be set up. * Replace several shell scripts by python equivalent. * Correction on tox coverage * Extend usage of new python scripts * Various corrections * Replace venv construction bash scripts by python equivalents * Update tox.ini * Unicode lines to compare files * Put modifications on letsencrypt-auto-source instead of generated scripts * Add executable permissions for Linux. * Merge tox win tests into main tox * Skip lock_test on Windows * Correct appveyor config * Update appveyor.yml * Explicit coverage py27 or py37 * Avoid to cover non supported certbot plugins on Windows * Update tox.ini * Remove specific warnings during CI * No cover on a debug code for tests only. * Update documentation and help script on venv/venv3.py * Customize help message for Windows * Quote correctly executable path with potential spaces in it. * Copy pipstrap from upstream
59 lines
1.9 KiB
Python
Executable File
59 lines
1.9 KiB
Python
Executable File
#!/usr/bin/env python
|
|
# pip installs the requested packages in editable mode and runs unit tests on
|
|
# them. Each package is installed and tested in the order they are provided
|
|
# before the script moves on to the next package. If CERTBOT_NO_PIN is set not
|
|
# set to 1, packages are installed using pinned versions of all of our
|
|
# dependencies. See pip_install.py for more information on the versions pinned
|
|
# to.
|
|
from __future__ import print_function
|
|
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
import shutil
|
|
import subprocess
|
|
import re
|
|
|
|
SKIP_PROJECTS_ON_WINDOWS = [
|
|
'certbot-apache', 'certbot-nginx', 'certbot-postfix', 'letshelp-certbot']
|
|
|
|
def call_with_print(command, cwd=None):
|
|
print(command)
|
|
subprocess.call(command, shell=True, cwd=cwd or os.getcwd())
|
|
|
|
def main(args):
|
|
if os.environ.get('CERTBOT_NO_PIN') == '1':
|
|
command = [sys.executable, '-m', 'pip', '-q', '-e']
|
|
else:
|
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
command = [sys.executable, os.path.join(script_dir, 'pip_install_editable.py')]
|
|
|
|
new_args = []
|
|
for arg in args:
|
|
if os.name == 'nt' and arg in SKIP_PROJECTS_ON_WINDOWS:
|
|
print((
|
|
'Info: currently {0} is not supported on Windows and will not be tested.'
|
|
.format(arg)))
|
|
else:
|
|
new_args.append(arg)
|
|
|
|
for requirement in new_args:
|
|
current_command = command[:]
|
|
current_command.append(requirement)
|
|
call_with_print(' '.join(current_command))
|
|
pkg = re.sub(r'\[\w+\]', '', requirement)
|
|
|
|
if pkg == '.':
|
|
pkg = 'certbot'
|
|
|
|
temp_cwd = tempfile.mkdtemp()
|
|
try:
|
|
call_with_print(' '.join([
|
|
sys.executable, '-m', 'pytest', '--numprocesses', 'auto',
|
|
'--quiet', '--pyargs', pkg.replace('-', '_')]), cwd=temp_cwd)
|
|
finally:
|
|
shutil.rmtree(temp_cwd)
|
|
|
|
if __name__ == '__main__':
|
|
main(sys.argv[1:])
|