Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 import sys
6 import os
8 def welcome():
9 """
10 Perform a bunch of sanity tests to make sure the Add-on SDK
11 environment is sane, and then display a welcome message.
12 """
14 try:
15 if sys.version_info[0] > 2:
16 print ("Error: You appear to be using Python %d, but "
17 "the Add-on SDK only supports the Python 2.x line." %
18 (sys.version_info[0]))
19 return
21 import mozrunner
23 if 'CUDDLEFISH_ROOT' not in os.environ:
24 print ("Error: CUDDLEFISH_ROOT environment variable does "
25 "not exist! It should point to the root of the "
26 "Add-on SDK repository.")
27 return
29 env_root = os.environ['CUDDLEFISH_ROOT']
31 bin_dir = os.path.join(env_root, 'bin')
32 python_lib_dir = os.path.join(env_root, 'python-lib')
33 path = os.environ['PATH'].split(os.path.pathsep)
35 if bin_dir not in path:
36 print ("Warning: the Add-on SDK binary directory %s "
37 "does not appear to be in your PATH. You may "
38 "not be able to run 'cfx' or other SDK tools." %
39 bin_dir)
41 if python_lib_dir not in sys.path:
42 print ("Warning: the Add-on SDK python-lib directory %s "
43 "does not appear to be in your sys.path, which "
44 "is odd because I'm running from it." % python_lib_dir)
46 if not mozrunner.__path__[0].startswith(env_root):
47 print ("Warning: your mozrunner package is installed at %s, "
48 "which does not seem to be located inside the Jetpack "
49 "SDK. This may cause problems, and you may want to "
50 "uninstall the other version. See bug 556562 for "
51 "more information." % mozrunner.__path__[0])
52 except Exception:
53 # Apparently we can't get the actual exception object in the
54 # 'except' clause in a way that's syntax-compatible for both
55 # Python 2.x and 3.x, so we'll have to use the traceback module.
57 import traceback
58 _, e, _ = sys.exc_info()
59 print ("Verification of Add-on SDK environment failed (%s)." % e)
60 print ("Your SDK may not work properly.")
61 return
63 print ("Welcome to the Add-on SDK. For the docs, visit https://addons.mozilla.org/en-US/developers/docs/sdk/latest/")
65 if __name__ == '__main__':
66 welcome()