diff --git a/makecrx.sh b/makecrx.sh index ecbe0bbceb02..3272726082b5 100755 --- a/makecrx.sh +++ b/makecrx.sh @@ -31,7 +31,7 @@ if [ -n "$1" ]; then git submodule update --recursive -f fi -VERSION=`python2.7 -c "import json ; print(json.loads(open('chromium/manifest.json').read())['version'])"` +VERSION=`python -c "import json ; print(json.loads(open('chromium/manifest.json').read())['version'])"` echo "Building chrome version" $VERSION @@ -49,7 +49,7 @@ needs_update() { } if [ ! -f "$RULESETS_JSON" ] || needs_update ; then echo "Generating ruleset DB" - python2.7 ./utils/make-json.py && bash utils/validate.sh && cp pkg/rulesets.json src/chrome/content/rulesets.json + python ./utils/make-json.py && bash utils/validate.sh && cp pkg/rulesets.json src/chrome/content/rulesets.json fi sed -e "s/VERSION/$VERSION/g" chromium/updates-master.xml > chromium/updates.xml @@ -60,8 +60,8 @@ rsync -aL ../../chromium/ ./ # Turn the Firefox translations into the appropriate Chrome format: rm -rf _locales/ mkdir _locales/ -python2.7 ../../utils/chromium-translations.py ../../translations/ _locales/ -python2.7 ../../utils/chromium-translations.py ../../src/chrome/locale/ _locales/ +python ../../utils/chromium-translations.py ../../translations/ _locales/ +python ../../utils/chromium-translations.py ../../src/chrome/locale/ _locales/ do_not_ship="*.py *.xml icon.jpg" rm -f $do_not_ship cd ../.. @@ -72,7 +72,7 @@ cp src/$RULESETS pkg/crx/rules/default.rulesets sed -i -e "s/VERSION/$VERSION/g" pkg/crx/manifest.json -python2.7 -c "import json; m=json.loads(open('pkg/crx/manifest.json').read()); e=m['author']; m['author']={'email': e}; del m['applications']; open('pkg/crx/manifest.json','w').write(json.dumps(m,indent=4,sort_keys=True))" +python -c "import json; m=json.loads(open('pkg/crx/manifest.json').read()); e=m['author']; m['author']={'email': e}; del m['applications']; open('pkg/crx/manifest.json','w').write(json.dumps(m,indent=4,sort_keys=True))" #sed -i -e "s/VERSION/$VERSION/g" pkg/crx/updates.xml #sed -e "s/VERSION/$VERSION/g" pkg/updates-master.xml > pkg/crx/updates.xml diff --git a/makexpi.sh b/makexpi.sh index 778826222e24..36a8b98bcc24 100755 --- a/makexpi.sh +++ b/makexpi.sh @@ -72,7 +72,7 @@ if [ ! -f "$RULESETS_JSON" ] || needs_update ; then nohup cat src/chrome/content/rules/"$firstchar"*.xml >/dev/null 2>/dev/null & done echo "Generating ruleset DB" - python2.7 ./utils/make-json.py + python ./utils/make-json.py fi # =============== BEGIN VALIDATION ================ @@ -106,8 +106,8 @@ rsync -aL --delete --delete-excluded --exclude /chrome/content/rules src/ pkg/xp rsync -aL --delete chromium/ pkg/xpi-eff/webextension/ mkdir pkg/xpi-eff/webextension/_locales/ -python2.7 utils/chromium-translations.py translations/ pkg/xpi-eff/webextension/_locales/ -python2.7 utils/chromium-translations.py src/chrome/locale/ pkg/xpi-eff/webextension/_locales/ +python utils/chromium-translations.py translations/ pkg/xpi-eff/webextension/_locales/ +python utils/chromium-translations.py src/chrome/locale/ pkg/xpi-eff/webextension/_locales/ cd pkg/xpi-eff/webextension do_not_ship="*.py *.xml icon.jpg" @@ -145,8 +145,8 @@ fi rm -f "${XPI_NAME}.xpi" rm -f "${XPI_NAME}-eff.xpi" rm -f "${XPI_NAME}-amo.xpi" -python2.7 utils/create_xpi.py -n "${XPI_NAME}-eff.xpi" -x ".build_exclusions" "pkg/xpi-eff" -python2.7 utils/create_xpi.py -n "${XPI_NAME}-amo.xpi" -x ".build_exclusions" "pkg/xpi-amo" +./utils/create_xpi.py -n "${XPI_NAME}-eff.xpi" -x ".build_exclusions" "pkg/xpi-eff" +./utils/create_xpi.py -n "${XPI_NAME}-amo.xpi" -x ".build_exclusions" "pkg/xpi-amo" echo >&2 "Total included rules: `find src/chrome/content/rules -name "*.xml" | wc -l`" echo >&2 "Rules disabled by default: `find src/chrome/content/rules -name "*.xml" | xargs grep -F default_off | wc -l`" diff --git a/utils/create_xpi.py b/utils/create_xpi.py index 7c37ee9a81fb..d92dc4710a48 100755 --- a/utils/create_xpi.py +++ b/utils/create_xpi.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/python2 # Uses the Python zip implementation to create deterministic XPI's # Author: Yan Zhu, yan@mit.edu diff --git a/utils/make-json.py b/utils/make-json.py index 3ec834d6f466..fc2adb274b67 100755 --- a/utils/make-json.py +++ b/utils/make-json.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python # # Builds a JSON DB containing all the rulesets, indexed by target. # The JSON DB is used by the Firefox addon. @@ -57,13 +57,13 @@ # Store the filename in the `f' attribute so "view source XML" for rules in # FF version can find it. - xpath_ruleset(tree)[0].attrib["f"] = os.path.basename(fi).decode(encoding="UTF-8") + xpath_ruleset(tree)[0].attrib["f"] = os.path.basename(fi) for target in targets: # id is the current length of the rules list - i.e. the offset at which # this rule will be added in the list. json_output["targets"][target].append(len(json_output["rulesetStrings"])) - json_output["rulesetStrings"].append(etree.tostring(tree)) + json_output["rulesetStrings"].append(etree.tounicode(tree)) with open(json_path, 'w') as f: f.write(json.dumps(json_output)) diff --git a/utils/trivial-validate.py b/utils/trivial-validate.py index 87863896a721..33434b99a45b 100755 --- a/utils/trivial-validate.py +++ b/utils/trivial-validate.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python import glob import argparse diff --git a/utils/validate.sh b/utils/validate.sh index ddad0b70710f..c143aacc6915 100755 --- a/utils/validate.sh +++ b/utils/validate.sh @@ -13,7 +13,7 @@ die() { exit 1 } -if python2.7 trivial-validate.py --quiet >&2 +if ./trivial-validate.py --quiet >&2 then echo Validation of included rulesets completed. >&2 echo >&2