From d31abeb8a731618e0fd568b35dd6a690ed1118ba Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sat, 31 Oct 2015 12:07:00 +0000 Subject: [PATCH 01/12] Pin ConfigArgParse 0.9.3 py2.6 (fixes #640). --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 972e87eaf..a94b22c0c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ # https://github.com/bw2/ConfigArgParse/issues/17 -git+https://github.com/kuba/ConfigArgParse.git@python2.6#egg=ConfigArgParse +git+https://github.com/kuba/ConfigArgParse.git@python2.6-0.9.3#egg=ConfigArgParse From 6f5d37fc21fa01f3272f851d97d13c4e045f27a6 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sat, 31 Oct 2015 12:17:02 +0000 Subject: [PATCH 02/12] requirements.txt: rename to py26reqs.txt and remove it from deps where possible. When people see requirements.txt they tend to `pip install -r` straight way (c.f. https://github.com/letsencrypt/letsencrypt/issues/1252). It's only necessary for Python2.6. --- Dockerfile | 2 +- Dockerfile-dev | 4 ++-- MANIFEST.in | 2 +- bootstrap/README | 4 ++-- bootstrap/dev/venv.sh | 2 +- requirements.txt => py26reqs.txt | 0 tox.ini | 6 +++--- 7 files changed, 10 insertions(+), 10 deletions(-) rename requirements.txt => py26reqs.txt (100%) diff --git a/Dockerfile b/Dockerfile index b9ea168de..d7aca784b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,7 +48,7 @@ COPY letsencrypt-apache /opt/letsencrypt/src/letsencrypt-apache/ COPY letsencrypt-nginx /opt/letsencrypt/src/letsencrypt-nginx/ -# requirements.txt not installed! +# py26reqs.txt not installed! RUN virtualenv --no-site-packages -p python2 /opt/letsencrypt/venv && \ /opt/letsencrypt/venv/bin/pip install \ -e /opt/letsencrypt/src/acme \ diff --git a/Dockerfile-dev b/Dockerfile-dev index daa8e9af0..028366b2c 100644 --- a/Dockerfile-dev +++ b/Dockerfile-dev @@ -32,7 +32,8 @@ RUN /opt/letsencrypt/src/ubuntu.sh && \ # the above is not likely to change, so by putting it further up the # Dockerfile we make sure we cache as much as possible -COPY setup.py README.rst CHANGES.rst MANIFEST.in requirements.txt DISCLAIMER linter_plugin.py tox.cover.sh tox.ini pep8.travis.sh .pep8 .pylintrc /opt/letsencrypt/src/ +# py26reqs.txt not installed! +COPY setup.py README.rst CHANGES.rst MANIFEST.in DISCLAIMER linter_plugin.py tox.cover.sh tox.ini pep8.travis.sh .pep8 .pylintrc /opt/letsencrypt/src/ # all above files are necessary for setup.py, however, package source # code directory has to be copied separately to a subdirectory... @@ -52,7 +53,6 @@ COPY tests /opt/letsencrypt/src/tests/ RUN virtualenv --no-site-packages -p python2 /opt/letsencrypt/venv && \ /opt/letsencrypt/venv/bin/pip install \ - -r /opt/letsencrypt/src/requirements.txt \ -e /opt/letsencrypt/src/acme \ -e /opt/letsencrypt/src \ -e /opt/letsencrypt/src/letsencrypt-apache \ diff --git a/MANIFEST.in b/MANIFEST.in index fa0d16e0d..5d5b0bed4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include requirements.txt +include py26reqs.txt include README.rst include CHANGES.rst include CONTRIBUTING.md diff --git a/bootstrap/README b/bootstrap/README index 6a04ac0ba..89fd8b6ba 100644 --- a/bootstrap/README +++ b/bootstrap/README @@ -2,6 +2,6 @@ This directory contains scripts that install necessary OS-specific prerequisite dependencies (see docs/using.rst). General dependencies: -- git-core: requirements.txt git+https://* +- git-core: py26reqs.txt git+https://* - ca-certificates: communication with demo ACMO server at - https://www.letsencrypt-demo.org, requirements.txt git+https://* + https://www.letsencrypt-demo.org, py26reqs.txt git+https://* diff --git a/bootstrap/dev/venv.sh b/bootstrap/dev/venv.sh index d6cf95bb5..2bd32a89b 100755 --- a/bootstrap/dev/venv.sh +++ b/bootstrap/dev/venv.sh @@ -4,7 +4,7 @@ export VENV_ARGS="--python python2" ./bootstrap/dev/_venv_common.sh \ - -r requirements.txt \ + -r py26reqs.txt \ -e acme[testing] \ -e .[dev,docs,testing] \ -e letsencrypt-apache \ diff --git a/requirements.txt b/py26reqs.txt similarity index 100% rename from requirements.txt rename to py26reqs.txt diff --git a/tox.ini b/tox.ini index 8ea3e518f..9988d8d1f 100644 --- a/tox.ini +++ b/tox.ini @@ -17,7 +17,7 @@ envlist = py26,py27,py33,py34,cover,lint commands = pip install -e acme[testing] nosetests -v acme - pip install -r requirements.txt -e .[testing] + pip install -r py26reqs.txt -e .[testing] nosetests -v letsencrypt pip install -e letsencrypt-apache nosetests -v letsencrypt_apache @@ -44,7 +44,7 @@ commands = [testenv:cover] basepython = python2.7 commands = - pip install -r requirements.txt -e acme -e .[testing] -e letsencrypt-apache -e letsencrypt-nginx -e letshelp-letsencrypt + pip install -e acme -e .[testing] -e letsencrypt-apache -e letsencrypt-nginx -e letshelp-letsencrypt ./tox.cover.sh [testenv:lint] @@ -54,7 +54,7 @@ basepython = python2.7 # duplicate code checking; if one of the commands fails, others will # continue, but tox return code will reflect previous error commands = - pip install -r requirements.txt -e acme -e .[dev] -e letsencrypt-apache -e letsencrypt-nginx -e letsencrypt-compatibility-test -e letshelp-letsencrypt + pip install -e acme -e .[dev] -e letsencrypt-apache -e letsencrypt-nginx -e letsencrypt-compatibility-test -e letshelp-letsencrypt ./pep8.travis.sh pylint --rcfile=.pylintrc letsencrypt pylint --rcfile=.pylintrc acme/acme From bbf4d837ede1f17b1e5bf70c63e71481483e45f5 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sat, 31 Oct 2015 12:21:47 +0000 Subject: [PATCH 03/12] letsencrypt-auto installs py26reqs.txt (fixes #1046). --- letsencrypt-auto | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/letsencrypt-auto b/letsencrypt-auto index d163998aa..bee183dac 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -19,7 +19,7 @@ else SUDO= fi -for arg in "$@" ; do +for arg in "$@" ; do # This first clause is redundant with the third, but hedging on portability if [ "$arg" = "-v" ] || [ "$arg" = "--verbose" ] || echo "$arg" | grep -E -- "-v+$" ; then VERBOSE=1 @@ -78,11 +78,11 @@ if [ "$VERBOSE" = 1 ] ; then echo $VENV_BIN/pip install -U setuptools $VENV_BIN/pip install -U pip - $VENV_BIN/pip install -U letsencrypt letsencrypt-apache + $VENV_BIN/pip install -r py26reqs.txt -U letsencrypt letsencrypt-apache # nginx is buggy / disabled for now, but upgrade it if the user has # installed it manually if $VENV_BIN/pip freeze | grep -q letsencrypt-nginx ; then - $VENV_BIN/pip install -U letsencrypt letsencrypt-nginx + $VENV_BIN/pip install -U letsencrypt letsencrypt-nginx fi else $VENV_BIN/pip install -U setuptools > /dev/null @@ -90,6 +90,8 @@ else $VENV_BIN/pip install -U pip > /dev/null printf . # nginx is buggy / disabled for now... + $VENV_BIN/pip install -r py26reqs.txt + printf . $VENV_BIN/pip install -U letsencrypt > /dev/null printf . $VENV_BIN/pip install -U letsencrypt-apache > /dev/null From 6d8e48c4ff74a144bed9269ad7b663b1b840c1f6 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sat, 31 Oct 2015 12:31:07 +0000 Subject: [PATCH 04/12] Use py26reqs in bootstrap/venv.sh --- bootstrap/venv.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/venv.sh b/bootstrap/venv.sh index 6ca082446..da8177828 100755 --- a/bootstrap/venv.sh +++ b/bootstrap/venv.sh @@ -20,7 +20,7 @@ fi pip install -U setuptools pip install -U pip -pip install -U letsencrypt letsencrypt-apache # letsencrypt-nginx +pip install -U -r py26reqs.txt letsencrypt letsencrypt-apache # letsencrypt-nginx echo echo "Congratulations, Let's Encrypt has been successfully installed/updated!" From f414f51d823cd96c1a65aafd0dfdba535b8b9e5e Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sat, 31 Oct 2015 12:39:24 +0000 Subject: [PATCH 05/12] letsencrypt-auto for debian squeeze (fixes #1078). --- bootstrap/venv.sh | 2 +- letsencrypt-auto | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bootstrap/venv.sh b/bootstrap/venv.sh index da8177828..ff1a50c6c 100755 --- a/bootstrap/venv.sh +++ b/bootstrap/venv.sh @@ -13,7 +13,7 @@ VENV_PATH=${VENV_PATH:-"$XDG_DATA_HOME/$VENV_NAME"} # later steps, causing "ImportError: cannot import name unpack_url" if [ ! -d $VENV_PATH ] then - virtualenv --no-site-packages --python python2 $VENV_PATH + virtualenv --no-site-packages --python ${LE_PYTHON:-python2} $VENV_PATH fi . $VENV_PATH/bin/activate diff --git a/letsencrypt-auto b/letsencrypt-auto index bee183dac..dbece5eff 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -26,6 +26,13 @@ for arg in "$@" ; do fi done +if [ -f /etc/debian_version ] ; then + # squeeze needs Python 2.6, `python2` doesn't exist + if grep -q '^6\.0' /etc/debian_version ; then + LE_PYTHON=${LE_PYTHON:-python} + fi +fi + # virtualenv call is not idempotent: it overwrites pip upgraded in # later steps, causing "ImportError: cannot import name unpack_url" if [ ! -d $VENV_PATH ] @@ -67,9 +74,9 @@ then echo "Creating virtual environment..." if [ "$VERBOSE" = 1 ] ; then - virtualenv --no-site-packages --python python2 $VENV_PATH + virtualenv --no-site-packages --python ${LE_PYTHON:-python2} $VENV_PATH else - virtualenv --no-site-packages --python python2 $VENV_PATH > /dev/null + virtualenv --no-site-packages --python ${LE_PYTHON:-python2} $VENV_PATH > /dev/null fi fi From d2f1ae9c3870289b52fb1c0ab5130c8fae52aa72 Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Wed, 4 Nov 2015 13:59:50 -0800 Subject: [PATCH 06/12] Require --debug for letsencrypt-auto on platforms thare aren't regularly tested Mitigates: #1270 #1196 --- letsencrypt-auto | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/letsencrypt-auto b/letsencrypt-auto index d163998aa..40b0d714a 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -24,8 +24,24 @@ for arg in "$@" ; do if [ "$arg" = "-v" ] || [ "$arg" = "--verbose" ] || echo "$arg" | grep -E -- "-v+$" ; then VERBOSE=1 fi + if [ "$arg" = "--debug" ] ; then + DEBUG=1 + fi done +ExperimentalBootstrap() { + # Arguments: Platform name, boostrap script name, SUDO command (iff needed) + if [ "$DEBUG" = 1 ] ; then + echo "Bootstrapping dependencies for $1..." + "$3" "$BOOTSTRAP/$2" + else + echo "WARNING: $1 support is very experimental at present..." + echo "if you would like to work on improving it, please ensure you have backups" + echo "and then run this script again with the --debug flag!" + exit 1 + fi +} + # virtualenv call is not idempotent: it overwrites pip upgraded in # later steps, causing "ImportError: cannot import name unpack_url" if [ ! -d $VENV_PATH ] @@ -38,25 +54,19 @@ then if [ -f /etc/debian_version ] ; then echo "Bootstrapping dependencies for Debian-based OSes..." $SUDO $BOOTSTRAP/_deb_common.sh - elif [ -f /etc/arch-release ] ; then - echo "Bootstrapping dependencies for Archlinux..." - $SUDO $BOOTSTRAP/archlinux.sh - elif [ -f /etc/manjaro-release ] ; then - echo "Bootstrapping dependencies for Manjaro Linux..." - $SUDO $BOOTSTRAP/manjaro.sh elif [ -f /etc/redhat-release ] ; then echo "Bootstrapping dependencies for RedHat-based OSes..." $SUDO $BOOTSTRAP/_rpm_common.sh + elif [ -f /etc/arch-release ] ; then + ExperimentalBootstrap "Archlinux" archlinux.sh "$SUDO" + elif [ -f /etc/manjaro-release ] ; then + ExperimentalBootstrap "Manjaro Linux" majaro.sh "$SUDO" elif [ -f /etc/gentoo-release ] ; then - echo "Bootstrapping dependencies for Gentoo-based OSes..." - $SUDO $BOOTSTRAP/_gentoo_common.sh + ExperimentalBootstrap "Gentoo" _gentoo_common.sh "$SUDO" elif uname | grep -iq FreeBSD ; then - echo "Bootstrapping dependencies for FreeBSD..." - $SUDO $BOOTSTRAP/freebsd.sh + ExperimentalBootstrap "FreeBSD" freebsd.sh "$SUDO" elif uname | grep -iq Darwin ; then - echo "Bootstrapping dependencies for Mac OS X..." - echo "WARNING: Mac support is very experimental at present..." - $BOOTSTRAP/mac.sh + ExperimentalBootstrap "Mac OS X" mac.sh else echo "Sorry, I don't know how to bootstrap Let's Encrypt on your operating system!" echo From abfa6db83fc5d3f0c9bf41cc436340e3d422b3a8 Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Wed, 4 Nov 2015 16:51:13 -0800 Subject: [PATCH 07/12] elif nit --- letsencrypt-auto | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/letsencrypt-auto b/letsencrypt-auto index 40b0d714a..354bd36fb 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -23,8 +23,7 @@ for arg in "$@" ; do # This first clause is redundant with the third, but hedging on portability if [ "$arg" = "-v" ] || [ "$arg" = "--verbose" ] || echo "$arg" | grep -E -- "-v+$" ; then VERBOSE=1 - fi - if [ "$arg" = "--debug" ] ; then + elif [ "$arg" = "--debug" ] ; then DEBUG=1 fi done From 167cf008d0f2a01ded6471d141f950350be627dc Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Wed, 4 Nov 2015 17:10:19 -0800 Subject: [PATCH 08/12] Merge the streams fully: python2.6 triggers --debug requirement --- letsencrypt-auto | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/letsencrypt-auto b/letsencrypt-auto index c1f5b094b..d9cf9d517 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -40,12 +40,26 @@ ExperimentalBootstrap() { exit 1 fi } -if [ -f /etc/debian_version ] ; then - # squeeze needs Python 2.6, `python2` doesn't exist - if grep -q '^6\.0' /etc/debian_version ; then - LE_PYTHON=${LE_PYTHON:-python} - fi -fi + + + +DeterminePythonVersion() { + if which python2 > /dev/null ; then + export LE_PYTHON=python2 + elif which python2.7 > /dev/null ; then + export LE_PYTHON=python2.7 + elif which python > /dev/null ; then + export LE_PYTHON=python + else + echo "Cannot find any Pythons... please install one!" + fi + + PYVER=`$LE_PYTHON --version 2>&1 | cut -d" " -f 2 | cut -d. -f1,2 | sed 's/\.//'` + if [ $PYVER -eq 26 ] ; then + ExperimentalBootstrap "Python 2.6" true + fi +} + # virtualenv call is not idempotent: it overwrites pip upgraded in # later steps, causing "ImportError: cannot import name unpack_url" @@ -56,6 +70,7 @@ then echo "Cannot find the letsencrypt bootstrap scripts in $BOOTSTRAP" exit 1 fi + if [ -f /etc/debian_version ] ; then echo "Bootstrapping dependencies for Debian-based OSes..." $SUDO $BOOTSTRAP/_deb_common.sh @@ -80,14 +95,18 @@ then echo "for more info" fi + DeterminePythonVersion echo "Creating virtual environment..." if [ "$VERBOSE" = 1 ] ; then - virtualenv --no-site-packages --python ${LE_PYTHON:-python2} $VENV_PATH + virtualenv --no-site-packages --python $LE_PYTHON $VENV_PATH else - virtualenv --no-site-packages --python ${LE_PYTHON:-python2} $VENV_PATH > /dev/null + virtualenv --no-site-packages --python $LE_PYTHON $VENV_PATH > /dev/null fi +else + DeterminePythonVersion fi + printf "Updating letsencrypt and virtual environment dependencies..." if [ "$VERBOSE" = 1 ] ; then echo From 573f32c74825697c95dd9aac9762e7ddf0efd730 Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Wed, 4 Nov 2015 17:22:49 -0800 Subject: [PATCH 09/12] React badly to python <= 2.5; let the user set LE_PYTHON --- letsencrypt-auto | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/letsencrypt-auto b/letsencrypt-auto index d9cf9d517..6e70fe14b 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -42,14 +42,13 @@ ExperimentalBootstrap() { } - DeterminePythonVersion() { if which python2 > /dev/null ; then - export LE_PYTHON=python2 + export LE_PYTHON=${LE_PYTHON:-python2} elif which python2.7 > /dev/null ; then - export LE_PYTHON=python2.7 + export LE_PYTHON=${LE_PYTHON:-python2.7} elif which python > /dev/null ; then - export LE_PYTHON=python + export LE_PYTHON=${LE_PYTHON:-python} else echo "Cannot find any Pythons... please install one!" fi @@ -57,6 +56,10 @@ DeterminePythonVersion() { PYVER=`$LE_PYTHON --version 2>&1 | cut -d" " -f 2 | cut -d. -f1,2 | sed 's/\.//'` if [ $PYVER -eq 26 ] ; then ExperimentalBootstrap "Python 2.6" true + elif [ $PYVER -lt 26 ] ; then + echo "You have an ancient version of Python entombed in your operating system..." + echo "This isn't going to work." + exit 1 fi } From 987840a5399cbb6e3b2671f437d4c0514e9fe5fb Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Thu, 5 Nov 2015 19:03:39 -0800 Subject: [PATCH 10/12] Archlinux is tested --- letsencrypt-auto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/letsencrypt-auto b/letsencrypt-auto index 6e70fe14b..96e5e2ec6 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -81,7 +81,8 @@ then echo "Bootstrapping dependencies for RedHat-based OSes..." $SUDO $BOOTSTRAP/_rpm_common.sh elif [ -f /etc/arch-release ] ; then - ExperimentalBootstrap "Archlinux" archlinux.sh "$SUDO" + echo "Bootstrapping dependencies for Archlinux..." + $SUDO $BOOTSTRAP/archlinux.sh elif [ -f /etc/manjaro-release ] ; then ExperimentalBootstrap "Manjaro Linux" majaro.sh "$SUDO" elif [ -f /etc/gentoo-release ] ; then From c0dd6e1dc8234df940662fc714b0266b48ba5ea5 Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Thu, 5 Nov 2015 19:08:22 -0800 Subject: [PATCH 11/12] Document --debug voodoo :) --- letsencrypt/cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/letsencrypt/cli.py b/letsencrypt/cli.py index 9f532f002..f377dbbee 100644 --- a/letsencrypt/cli.py +++ b/letsencrypt/cli.py @@ -843,7 +843,8 @@ def prepare_and_parse_args(plugins, args): "really know what you're doing!") helpful.add( "testing", "--debug", action="store_true", - help="Show tracebacks if the program exits abnormally") + help="Show tracebacks in case of errors, and allow execution on " + "experimental platforms") helpful.add( "testing", "--no-verify-ssl", action="store_true", help=config_help("no_verify_ssl"), From 24651e6b3f803cb5ad3e7112211977a996dde24b Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Thu, 5 Nov 2015 19:42:13 -0800 Subject: [PATCH 12/12] Handle py2.6 correctly ; be precise in documentation --- letsencrypt-auto | 8 +++++--- letsencrypt/cli.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/letsencrypt-auto b/letsencrypt-auto index 96e5e2ec6..b695b0450 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -31,8 +31,10 @@ done ExperimentalBootstrap() { # Arguments: Platform name, boostrap script name, SUDO command (iff needed) if [ "$DEBUG" = 1 ] ; then - echo "Bootstrapping dependencies for $1..." - "$3" "$BOOTSTRAP/$2" + if [ "$2" != "" ] ; then + echo "Bootstrapping dependencies for $1..." + "$3" "$BOOTSTRAP/$2" + fi else echo "WARNING: $1 support is very experimental at present..." echo "if you would like to work on improving it, please ensure you have backups" @@ -55,7 +57,7 @@ DeterminePythonVersion() { PYVER=`$LE_PYTHON --version 2>&1 | cut -d" " -f 2 | cut -d. -f1,2 | sed 's/\.//'` if [ $PYVER -eq 26 ] ; then - ExperimentalBootstrap "Python 2.6" true + ExperimentalBootstrap "Python 2.6" elif [ $PYVER -lt 26 ] ; then echo "You have an ancient version of Python entombed in your operating system..." echo "This isn't going to work." diff --git a/letsencrypt/cli.py b/letsencrypt/cli.py index f377dbbee..5757783cd 100644 --- a/letsencrypt/cli.py +++ b/letsencrypt/cli.py @@ -843,8 +843,8 @@ def prepare_and_parse_args(plugins, args): "really know what you're doing!") helpful.add( "testing", "--debug", action="store_true", - help="Show tracebacks in case of errors, and allow execution on " - "experimental platforms") + help="Show tracebacks in case of errors, and allow letsencrypt-auto " + "execution on experimental platforms") helpful.add( "testing", "--no-verify-ssl", action="store_true", help=config_help("no_verify_ssl"),