[HTTPS-E Rulesets] [PATCH 3/3] Explicitly use python2
Wieland Hoffmann
themineo at gmail.com
Fri Feb 15 05:29:24 PST 2013
The affected scripts are written for versions of python2 so explicitly
call them with python2. On python 2.7 python2 is already a symlink to
the python2.7 binary; on older versions that do not provide this
symlink, at least the makecrx and makexpi script allow to specify the
path to the python binary via the PYTHON2 environment variable.
---
makecrx.sh | 10 ++++++----
makexpi.sh | 7 ++++---
utils/check_certs.py | 2 +-
utils/chromium-preloads.py | 2 +-
utils/dbconnect.py | 2 +-
utils/merge-rulesets.py | 2 +-
utils/mk_client_whitelist.py | 2 +-
utils/single_rule_response.py | 2 +-
utils/trivial-response.py | 2 +-
utils/trivial-validate.py | 2 +-
10 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/makecrx.sh b/makecrx.sh
index d95af02..203a957 100755
--- a/makecrx.sh
+++ b/makecrx.sh
@@ -19,9 +19,11 @@
# but these .crx files won't detect and upgrade to official HTTPS Everywhere
# releases signed by EFF :/. We should find a more elegant arrangement.
+PYTHON2=${PYTHON2:-python2}
+
if [ -n "$1" ]; then
if [ "$1" = today ] ; then
- python chromium/setversion.py
+ $PYTHON2 chromium/setversion.py
else
BRANCH=`git branch | head -n 1 | cut -d \ -f 2-`
SUBDIR=checkout
@@ -32,12 +34,12 @@ if [ -n "$1" ]; then
fi
fi
-VERSION=`python -c "import json ; print json.loads(open('chromium/manifest.json').read())['version']"`
+VERSION=`$PYTHON2 -c "import json ; print json.loads(open('chromium/manifest.json').read())['version']"`
echo "Building chrome version" $VERSION
if [ -f utils/trivial-validate.py ]; then
- VALIDATE="python utils/trivial-validate.py --ignoredups google --ignoredups facebook"
+ VALIDATE="$PYTHON2 utils/trivial-validate.py --ignoredups google --ignoredups facebook"
elif [ -x utils/trivial-validate ] ; then
# This case probably never happens
VALIDATE=./utils/trivial-validate
@@ -78,7 +80,7 @@ do_not_ship="*.py *.xml icon.jpg"
rm -f $do_not_ship
cd ../..
-python ./utils/merge-rulesets.py
+$PYTHON2 ./utils/merge-rulesets.py
export RULESETS=chrome/content/rules/default.rulesets
cp src/$RULESETS pkg/crx/rules/default.rulesets
diff --git a/makexpi.sh b/makexpi.sh
index 5f46cff..453f701 100755
--- a/makexpi.sh
+++ b/makexpi.sh
@@ -1,5 +1,6 @@
#!/bin/sh
APP_NAME=https-everywhere
+PYTHON2=${PYTHON2:-python2}
# builds a .xpi from the git repository, placing the .xpi in the root
# of the repository.
@@ -48,9 +49,9 @@ if [ -n "$1" ] && [ "$2" != "--no-recurse" ] ; then
fi
if [ -f utils/trivial-validate.py ]; then
- VALIDATE="python utils/trivial-validate.py --ignoredups google --ignoredups facebook"
+ VALIDATE="$PYTHON2 utils/trivial-validate.py --ignoredups google --ignoredups facebook"
elif [ -f trivial-validate.py ] ; then
- VALIDATE="python trivial-validate.py --ignoredups google --ignoredups facebook"
+ VALIDATE="$PYTHON2 trivial-validate.py --ignoredups google --ignoredups facebook"
elif [ -x utils/trivial-validate ] ; then
# This case probably never happens
VALIDATE=./utils/trivial-validate
@@ -108,7 +109,7 @@ if [ -e "$GIT_OBJECT_FILE" ]; then
export GIT_COMMIT_ID=$(cat "$GIT_OBJECT_FILE")
fi
-python ./utils/merge-rulesets.py
+$PYTHON2 ./utils/merge-rulesets.py
cd src
# Build the XPI!
diff --git a/utils/check_certs.py b/utils/check_certs.py
index fe3a8ad..7c33484 100755
--- a/utils/check_certs.py
+++ b/utils/check_certs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys
import re
diff --git a/utils/chromium-preloads.py b/utils/chromium-preloads.py
index 48ca240..660aec5 100644
--- a/utils/chromium-preloads.py
+++ b/utils/chromium-preloads.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
# autogenerate sample versions of rules from Chromium browser's HSTS
# preload list (in the from-preloads/ directory)
diff --git a/utils/dbconnect.py b/utils/dbconnect.py
index 7a39e17..e3dec4a 100644
--- a/utils/dbconnect.py
+++ b/utils/dbconnect.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import MySQLdb
try: from db_private import DB_USER
diff --git a/utils/merge-rulesets.py b/utils/merge-rulesets.py
index 7460a5f..f622d84 100644
--- a/utils/merge-rulesets.py
+++ b/utils/merge-rulesets.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
# Merge all the .xml rulesets into a single "default.rulesets" file -- this
# prevents inodes from wasting disk space, but more importantly, works around
diff --git a/utils/mk_client_whitelist.py b/utils/mk_client_whitelist.py
index d01375b..50decd5 100755
--- a/utils/mk_client_whitelist.py
+++ b/utils/mk_client_whitelist.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
# Make a list of the current top 1,000 certs to whitelist from the
# Decentralized SSL Observatory's client submissions, to live in
diff --git a/utils/single_rule_response.py b/utils/single_rule_response.py
index 3184298..356beb5 100755
--- a/utils/single_rule_response.py
+++ b/utils/single_rule_response.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys, os, re
from functools import partial
diff --git a/utils/trivial-response.py b/utils/trivial-response.py
index cbdcd3f..931380a 100755
--- a/utils/trivial-response.py
+++ b/utils/trivial-response.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys, os, re, subprocess
from time import sleep
diff --git a/utils/trivial-validate.py b/utils/trivial-validate.py
index ea38245..9f2ed2f 100755
--- a/utils/trivial-validate.py
+++ b/utils/trivial-validate.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys, re, os, getopt
--
1.8.1.3
More information about the HTTPS-Everywhere-Rules
mailing list