Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions makecrx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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 ../..
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions makexpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ================
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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`"
Expand Down
2 changes: 1 addition & 1 deletion utils/create_xpi.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions utils/make-json.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is where behavior changes would be if there are any.


with open(json_path, 'w') as f:
f.write(json.dumps(json_output))
2 changes: 1 addition & 1 deletion utils/trivial-validate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python

import glob
import argparse
Expand Down
2 changes: 1 addition & 1 deletion utils/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down