py3: Switch almost all shebang lines to use `python3`.
This causes `upgrade-zulip-from-git`, as well as a no-option run of
`tools/build-release-tarball`, to produce a Zulip install running
Python 3, rather than Python 2. In particular this means that the
virtualenv we create, in which all application code runs, is Python 3.
One shebang line, on `zulip-ec2-configure-interfaces`, explicitly
keeps Python 2, and at least one external ops script, `wal-e`, also
still runs on Python 2. See discussion on the respective previous
commits that made those explicit. There may also be some other
third-party scripts we use, outside of this source tree and running
outside our virtualenv, that still run on Python 2.
2017-08-02 23:15:16 +02:00
|
|
|
#!/usr/bin/env python3
|
2016-08-07 17:56:15 +02:00
|
|
|
|
|
|
|
from lib.find_add_class import display, find
|
|
|
|
import glob
|
2016-08-29 00:09:05 +02:00
|
|
|
import argparse
|
2016-08-07 17:56:15 +02:00
|
|
|
import sys
|
|
|
|
|
2017-02-05 21:24:28 +01:00
|
|
|
# check for the venv
|
|
|
|
from lib import sanity_check
|
|
|
|
sanity_check.check_venv(__file__)
|
2016-08-07 17:56:15 +02:00
|
|
|
|
2017-12-13 19:38:15 +01:00
|
|
|
def process_files():
|
|
|
|
# type: () -> None
|
2016-08-07 17:56:15 +02:00
|
|
|
|
2016-08-29 00:09:05 +02:00
|
|
|
description = '''
|
2016-08-07 17:56:15 +02:00
|
|
|
Use this tool to find HTML classes that we use in our JS code.
|
|
|
|
This looks for calls to addClass, and if you use the -v option,
|
|
|
|
you will get a display of (fn, html_class) tuples that
|
|
|
|
represent addClass calls.
|
|
|
|
|
|
|
|
If you call it with no options, the tool acts as a linter, and
|
|
|
|
it will complain if it can't resolve the class for an addClass()
|
|
|
|
call.
|
|
|
|
'''
|
|
|
|
|
2016-08-29 00:09:05 +02:00
|
|
|
parser = argparse.ArgumentParser(description=description)
|
|
|
|
parser.add_argument('-v', '--verbose',
|
2016-12-11 14:30:45 +01:00
|
|
|
action='store_true', default=False,
|
|
|
|
help='show where calls are')
|
2017-08-27 22:35:11 +02:00
|
|
|
parser.add_argument('targets', nargs=argparse.REMAINDER)
|
2016-08-29 00:09:05 +02:00
|
|
|
args = parser.parse_args()
|
2016-08-07 17:56:15 +02:00
|
|
|
|
2017-08-27 22:35:11 +02:00
|
|
|
if args.targets == []:
|
|
|
|
fns = glob.glob('static/js/*.js')
|
|
|
|
else:
|
|
|
|
fns = args.targets
|
|
|
|
|
2016-08-29 00:09:05 +02:00
|
|
|
if args.verbose:
|
2016-08-07 17:56:15 +02:00
|
|
|
display(fns)
|
|
|
|
else:
|
|
|
|
find(fns)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
process_files()
|