OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2012 the V8 project authors. All rights reserved. | 3 # Copyright 2012 the V8 project authors. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 # Create directory for trusted public keys of peers (and self). | 71 # Create directory for trusted public keys of peers (and self). |
72 trusted_dir = os.path.join(ROOT, "trusted") | 72 trusted_dir = os.path.join(ROOT, "trusted") |
73 if not os.path.exists(trusted_dir): | 73 if not os.path.exists(trusted_dir): |
74 os.makedirs(trusted_dir) | 74 os.makedirs(trusted_dir) |
75 | 75 |
76 # Install UltraJSON. It is much faster than Python's builtin json. | 76 # Install UltraJSON. It is much faster than Python's builtin json. |
77 try: | 77 try: |
78 import ujson #@UnusedImport | 78 import ujson #@UnusedImport |
79 except ImportError: | 79 except ImportError: |
80 # Install pip if it doesn't exist. | 80 # Install pip if it doesn't exist. |
81 code = subprocess.call("which pip", shell=True) | 81 code = subprocess.call("which pip > /dev/null", shell=True) |
82 if code != 0: | 82 if code != 0: |
83 apt_get_code = subprocess.call("which apt-get", shell=True) | 83 apt_get_code = subprocess.call("which apt-get > /dev/null", shell=True) |
84 if apt_get_code == 0: | 84 if apt_get_code == 0: |
85 print("Installing pip...") | 85 print("Installing pip...") |
86 _Cmd("sudo apt-get install python-pip") | 86 _Cmd("sudo apt-get install python-pip") |
87 else: | 87 else: |
88 print("Please install pip on your machine. You can get it at: " | 88 print("Please install pip on your machine. You can get it at: " |
89 "http://www.pip-installer.org/en/latest/installing.html " | 89 "http://www.pip-installer.org/en/latest/installing.html " |
90 "or via your distro's package manager.") | 90 "or via your distro's package manager.") |
91 sys.exit(1) | 91 sys.exit(1) |
92 print("Using pip to install UltraJSON...") | 92 print("Using pip to install UltraJSON...") |
93 _Cmd("sudo pip install ujson") | 93 _Cmd("sudo pip install ujson") |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 print("Added certificate %s to trusted certificates." % response) | 206 print("Added certificate %s to trusted certificates." % response) |
207 else: | 207 else: |
208 print("Unknown command") | 208 print("Unknown command") |
209 _PrintUsage() | 209 _PrintUsage() |
210 sys.exit(2) | 210 sys.exit(2) |
211 else: | 211 else: |
212 print("Unknown command") | 212 print("Unknown command") |
213 _PrintUsage() | 213 _PrintUsage() |
214 sys.exit(2) | 214 sys.exit(2) |
215 sys.exit(0) | 215 sys.exit(0) |
OLD | NEW |