Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErica Portnoy <ebportnoy@gmail.com>2018-01-10 03:17:49 +0300
committerErica Portnoy <ebportnoy@gmail.com>2018-01-10 03:17:49 +0300
commitdcf6c64464a59ffa961ae0462aab842a03202cc9 (patch)
tree9d5e7df66fafd7fdb52b6629226fd4bcc4031001
parent887a6bcfce73f7b3c556720ccbbc470bf8855606 (diff)
Address erikrose's comments on #5329erik_py3_comments
-rwxr-xr-xletsencrypt-auto-source/letsencrypt-auto13
-rwxr-xr-xletsencrypt-auto-source/letsencrypt-auto.template5
-rw-r--r--letsencrypt-auto-source/pieces/bootstrappers/rpm_common_base.sh2
-rw-r--r--letsencrypt-auto-source/pieces/fetch.py6
4 files changed, 16 insertions, 10 deletions
diff --git a/letsencrypt-auto-source/letsencrypt-auto b/letsencrypt-auto-source/letsencrypt-auto
index 5f46e3a31..712ef6813 100755
--- a/letsencrypt-auto-source/letsencrypt-auto
+++ b/letsencrypt-auto-source/letsencrypt-auto
@@ -254,7 +254,7 @@ DeterminePythonVersion() {
# Arguments: "NOCRASH" if we shouldn't crash if we don't find a good python
#
# If no Python is found, PYVER is set to 0.
- if [ -n "$USE_PYTHON_3" ]; then
+ if [ "$USE_PYTHON_3" = 1 ]; then
for LE_PYTHON in "$LE_PYTHON" python3; do
# Break (while keeping the LE_PYTHON value) if found.
$EXISTS "$LE_PYTHON" > /dev/null && break
@@ -443,7 +443,7 @@ InitializeRPMCommonBase() {
sleep 1s
/bin/echo -ne "\e[0K\rEnabling the EPEL repository in 2 seconds..."
sleep 1s
- /bin/echo -e "\e[0K\rEnabling the EPEL repository in 1 seconds..."
+ /bin/echo -e "\e[0K\rEnabling the EPEL repository in 1 second..."
sleep 1s
fi
if ! $TOOL install $YES_FLAG $QUIET_FLAG epel-release; then
@@ -781,6 +781,9 @@ elif [ -f /etc/mageia-release ]; then
}
BOOTSTRAP_VERSION="BootstrapMageiaCommon $BOOTSTRAP_MAGEIA_COMMON_VERSION"
elif [ -f /etc/redhat-release ]; then
+ # Run DeterminePythonVersion to decide on the basis of available Python versions
+ # whether to use 2.x or 3.x on RedHat-like systems.
+ # Then, revert LE_PYTHON to its previous state.
prev_le_python="$LE_PYTHON"
unset LE_PYTHON
DeterminePythonVersion "NOCRASH"
@@ -1482,7 +1485,7 @@ class HttpsGetter(object):
# Based on pip 1.4.1's URLOpener
# This verifies certs on only Python >=2.7.9, and when NO_CERT_VERIFY isn't set.
if environ.get('NO_CERT_VERIFY') == '1' and hasattr(ssl, 'SSLContext'):
- self._opener = build_opener(HTTPSHandler(context=create_CERT_NONE_context()))
+ self._opener = build_opener(HTTPSHandler(context=cert_none_context()))
else:
self._opener = build_opener(HTTPSHandler())
# Strip out HTTPHandler to prevent MITM spoof:
@@ -1520,7 +1523,7 @@ def latest_stable_version(get):
# The regex is a sufficient regex for picking out prereleases for most
# packages, LE included.
return str(max(LooseVersion(r) for r
- in iter(metadata['releases'].keys())
+ in metadata['releases'].keys()
if re.match('^[0-9.]+$', r)))
@@ -1552,7 +1555,7 @@ def verified_new_le_auto(get, tag, temp_dir):
"certbot-auto.", exc)
-def create_CERT_NONE_context():
+def cert_none_context():
"""Create a SSLContext object to not check hostname."""
# PROTOCOL_TLS isn't available before 2.7.13 but this code is for 2.7.9+, so use this.
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
diff --git a/letsencrypt-auto-source/letsencrypt-auto.template b/letsencrypt-auto-source/letsencrypt-auto.template
index 7c3cbac08..b06ac9c80 100755
--- a/letsencrypt-auto-source/letsencrypt-auto.template
+++ b/letsencrypt-auto-source/letsencrypt-auto.template
@@ -254,7 +254,7 @@ DeterminePythonVersion() {
# Arguments: "NOCRASH" if we shouldn't crash if we don't find a good python
#
# If no Python is found, PYVER is set to 0.
- if [ -n "$USE_PYTHON_3" ]; then
+ if [ "$USE_PYTHON_3" = 1 ]; then
for LE_PYTHON in "$LE_PYTHON" python3; do
# Break (while keeping the LE_PYTHON value) if found.
$EXISTS "$LE_PYTHON" > /dev/null && break
@@ -320,6 +320,9 @@ elif [ -f /etc/mageia-release ]; then
}
BOOTSTRAP_VERSION="BootstrapMageiaCommon $BOOTSTRAP_MAGEIA_COMMON_VERSION"
elif [ -f /etc/redhat-release ]; then
+ # Run DeterminePythonVersion to decide on the basis of available Python versions
+ # whether to use 2.x or 3.x on RedHat-like systems.
+ # Then, revert LE_PYTHON to its previous state.
prev_le_python="$LE_PYTHON"
unset LE_PYTHON
DeterminePythonVersion "NOCRASH"
diff --git a/letsencrypt-auto-source/pieces/bootstrappers/rpm_common_base.sh b/letsencrypt-auto-source/pieces/bootstrappers/rpm_common_base.sh
index d7a9f3133..326ad8b3f 100644
--- a/letsencrypt-auto-source/pieces/bootstrappers/rpm_common_base.sh
+++ b/letsencrypt-auto-source/pieces/bootstrappers/rpm_common_base.sh
@@ -35,7 +35,7 @@ InitializeRPMCommonBase() {
sleep 1s
/bin/echo -ne "\e[0K\rEnabling the EPEL repository in 2 seconds..."
sleep 1s
- /bin/echo -e "\e[0K\rEnabling the EPEL repository in 1 seconds..."
+ /bin/echo -e "\e[0K\rEnabling the EPEL repository in 1 second..."
sleep 1s
fi
if ! $TOOL install $YES_FLAG $QUIET_FLAG epel-release; then
diff --git a/letsencrypt-auto-source/pieces/fetch.py b/letsencrypt-auto-source/pieces/fetch.py
index ae72a299b..1515fe353 100644
--- a/letsencrypt-auto-source/pieces/fetch.py
+++ b/letsencrypt-auto-source/pieces/fetch.py
@@ -50,7 +50,7 @@ class HttpsGetter(object):
# Based on pip 1.4.1's URLOpener
# This verifies certs on only Python >=2.7.9, and when NO_CERT_VERIFY isn't set.
if environ.get('NO_CERT_VERIFY') == '1' and hasattr(ssl, 'SSLContext'):
- self._opener = build_opener(HTTPSHandler(context=create_CERT_NONE_context()))
+ self._opener = build_opener(HTTPSHandler(context=cert_none_context()))
else:
self._opener = build_opener(HTTPSHandler())
# Strip out HTTPHandler to prevent MITM spoof:
@@ -88,7 +88,7 @@ def latest_stable_version(get):
# The regex is a sufficient regex for picking out prereleases for most
# packages, LE included.
return str(max(LooseVersion(r) for r
- in iter(metadata['releases'].keys())
+ in metadata['releases'].keys()
if re.match('^[0-9.]+$', r)))
@@ -120,7 +120,7 @@ def verified_new_le_auto(get, tag, temp_dir):
"certbot-auto.", exc)
-def create_CERT_NONE_context():
+def cert_none_context():
"""Create a SSLContext object to not check hostname."""
# PROTOCOL_TLS isn't available before 2.7.13 but this code is for 2.7.9+, so use this.
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)