[HTTPS-E Rulesets] From Development to Stable

Yan Zhu yan at eff.org
Tue Jan 14 19:50:40 PST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512



On 01/14/2014 05:40 PM, Claudio Moretti wrote:
> Hey Yan,
> 
> I had a bit of free time this evening, so I decided it was a good
> time to learn Python :P

Awesome! Thanks so much for giving this a shot. Everyone should learn
Python this way. :)

I'd suggest checking out Python's subprocess module; you can use
subprocess.call or subprocess.Popen to make simple shell commands
(like 'git diff') from within a Python script. As an extra
convenience, you might also want to automatically download the Alexa
Top 1M csv file from the canonical source so that people don't have to
look up the URL. The urllib module or just opening a wget subprocess
would work.

For unzipping, python has a built-in zip module too.

Also, you should probably close files after you open them once you're
done. :)

PS: Do you use git? It makes code review like this much easier, as
well as tracking changes. We use it pretty extensively in HTTPS
Everywhere, so now would be a good time to learn!

- -Yan


> 
> 1) you unzip the Alexa Top1M in the same directory as the script 2)
> you generate a git diff with this command (it's also in the script
> - probably you know a better alternative) /git diff --name-status
> master..remotes/origin/stable src/chrome/content/rules >>
> newRules.diff/ and put the/newRules.diff /file in the same
> directory as merger.py and top-1m.csv 3) You launch merger.py
> 
-----BEGIN PGP SIGNATURE-----

iQEcBAEBCgAGBQJS1gWOAAoJENC7YDZD/dnsX40IAIBzVl1mvU0fjCPMbRks0x0A
cGpeTIBpKtXMnNpWe7qypiuW5gqPzPCTPjYL4Y8S6+I4cQBBHDHv1euE+Jm6BNW9
92taOWXGCMeAR+wBPj6QmDYAJIx4uIDPRqBybANzJdHXFrzREK8uPJgicI7PU4Pf
kT3OUihp8YBYG/eKI0ZIqXggLDNcofX42oO3rxVzyPDWB8YJXrb9V57LnjE2LE/P
NTYOQ2c4BCq7FeWnwKo6wrOz8iTbgDjg6Hd7XqkYCHQ9UqrrCAL94Ik2lyY9rrjV
ff/8oG0g2QqJ3OIMOecpzENYOOlJZBGZK9c1yQ42ZuQYkuvTpZEOO3V42xZwXmg=
=Opeg
-----END PGP SIGNATURE-----


More information about the HTTPS-Everywhere-Rules mailing list