| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Setups a local Rietveld instance to test against a live server for | 6 """Setups a local Rietveld instance to test against a live server for |
| 7 integration tests. | 7 integration tests. |
| 8 | 8 |
| 9 It makes sure Google AppEngine SDK is found, download Rietveld and Django code | 9 It makes sure Google AppEngine SDK is found, download Rietveld and Django code |
| 10 if necessary and starts the server on a free inbound TCP port. | 10 if necessary and starts the server on a free inbound TCP port. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 if not os.path.isfile(os.path.join(self.sdk_path, 'VERSION')): | 74 if not os.path.isfile(os.path.join(self.sdk_path, 'VERSION')): |
| 75 base_dir = os.path.dirname(base_dir) | 75 base_dir = os.path.dirname(base_dir) |
| 76 self.dev_app = os.path.join(self.sdk_path, 'dev_appserver.py') | 76 self.dev_app = os.path.join(self.sdk_path, 'dev_appserver.py') |
| 77 | 77 |
| 78 def install_prerequisites(self): | 78 def install_prerequisites(self): |
| 79 # First, verify the Google AppEngine SDK is available. | 79 # First, verify the Google AppEngine SDK is available. |
| 80 if not os.path.isfile(self.dev_app): | 80 if not os.path.isfile(self.dev_app): |
| 81 raise Failure( | 81 raise Failure( |
| 82 'Install google_appengine sdk in %s or higher up' % self.base_dir) | 82 'Install google_appengine sdk in %s or higher up' % self.base_dir) |
| 83 | 83 |
| 84 if os.path.isdir(os.path.join(self.rietveld, '.svn')): | |
| 85 # Left over from subversion. Delete it. | |
| 86 print('Deleting deprecated subversion rietveld files...') | |
| 87 shutil.rmtree(self.rietveld) | |
| 88 | |
| 89 if os.path.isdir(os.path.join(self.rietveld, '.hg')): | 84 if os.path.isdir(os.path.join(self.rietveld, '.hg')): |
| 90 # Left over from mercurial. Delete it. | 85 # Left over from mercurial. Delete it. |
| 91 print('Deleting deprecated mercurial rietveld files...') | 86 print('Deleting deprecated mercurial rietveld files...') |
| 92 shutil.rmtree(self.rietveld) | 87 shutil.rmtree(self.rietveld) |
| 93 | 88 |
| 94 # Second, checkout rietveld if not available. | 89 # Second, checkout rietveld if not available. |
| 95 if not os.path.isdir(self.rietveld): | 90 if not os.path.isdir(self.rietveld): |
| 96 print('Checking out rietveld...') | 91 print('Checking out rietveld...') |
| 97 try: | 92 try: |
| 98 subprocess2.check_call(['git', 'init', self.rietveld]) | 93 subprocess2.check_call(['git', 'init', self.rietveld]) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 instance.start_server(verbose=options.verbose) | 184 instance.start_server(verbose=options.verbose) |
| 190 print 'Local rietveld instance started on port %d' % instance.port | 185 print 'Local rietveld instance started on port %d' % instance.port |
| 191 while True: | 186 while True: |
| 192 time.sleep(0.1) | 187 time.sleep(0.1) |
| 193 finally: | 188 finally: |
| 194 instance.stop_server() | 189 instance.stop_server() |
| 195 | 190 |
| 196 | 191 |
| 197 if __name__ == '__main__': | 192 if __name__ == '__main__': |
| 198 main() | 193 main() |
| OLD | NEW |