| Index: git_cl/test/local_rietveld.py
|
| diff --git a/git_cl/test/local_rietveld.py b/git_cl/test/local_rietveld.py
|
| old mode 100644
|
| new mode 100755
|
| index 7649669a186aa8ef13504c57dfd34cac5b976d1b..bc990d0b7c0d3d91bd078de7febac67baaf838e0
|
| --- a/git_cl/test/local_rietveld.py
|
| +++ b/git_cl/test/local_rietveld.py
|
| @@ -1,3 +1,4 @@
|
| +#!/usr/bin/env python
|
| # Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
| @@ -9,6 +10,7 @@ It makes sure Google AppEngine SDK is found, download Rietveld and Django code
|
| if necessary and starts the server on a free inbound TCP port.
|
| """
|
|
|
| +import optparse
|
| import os
|
| import socket
|
| import subprocess
|
| @@ -51,18 +53,11 @@ class LocalRietveld(object):
|
| os.path.join(self.base_dir, '..', '..', 'google_appengine'))
|
| self.dev_app = os.path.join(self.sdk_path, 'dev_appserver.py')
|
| self.rietveld = os.path.join(self.base_dir, 'test', 'rietveld')
|
| - self.django_path = os.path.join(self.rietveld, 'django')
|
| self.test_server = None
|
| self.port = None
|
| # Generate a friendly environment.
|
| self.env = os.environ.copy()
|
| self.env['LANGUAGE'] = 'en'
|
| - if self.env.get('PYTHONPATH'):
|
| - self.env['PYTHONPATH'] = (
|
| - self.env['PYTHONPATH'].rstrip(os.pathsep) + os.pathsep +
|
| - self.django_path)
|
| - else:
|
| - self.env['PYTHONPATH'] = self.django_path
|
|
|
| def install_prerequisites(self):
|
| # First, verify the Google AppEngine SDK is available.
|
| @@ -75,22 +70,18 @@ class LocalRietveld(object):
|
| x.communicate()
|
| return x.returncode == 0
|
|
|
| - # Second, checkout rietveld and django if not available.
|
| + # Second, checkout rietveld if not available.
|
| if not os.path.isdir(self.rietveld):
|
| print('Checking out rietveld...')
|
| if not call(
|
| ['svn', 'co', '-q',
|
| - 'http://rietveld.googlecode.com/svn/trunk@563',
|
| + 'http://rietveld.googlecode.com/svn/trunk@681',
|
| self.rietveld]):
|
| raise Failure('Failed to checkout rietveld')
|
| - if not os.path.isdir(self.django_path):
|
| - print('Checking out django...')
|
| - if not call(
|
| - ['svn', 'co', '-q',
|
| - 'http://code.djangoproject.com/'
|
| - 'svn/django/branches/releases/1.0.X/django@13637',
|
| - self.django_path]):
|
| - raise Failure('Failed to checkout django')
|
| + else:
|
| + print('Syncing rietveld...')
|
| + if not call(['svn', 'up', '-q', '-r', '681'], cwd=self.rietveld):
|
| + raise Failure('Failed to checkout rietveld')
|
|
|
| def start_server(self, verbose=False):
|
| self.install_prerequisites()
|
| @@ -135,7 +126,19 @@ class LocalRietveld(object):
|
|
|
|
|
| def main():
|
| - print LocalRietveld().start_server()
|
| + parser = optparse.OptionParser()
|
| + parser.add_option('-v', '--verbose', action='store_true')
|
| + options, args = parser.parse_args()
|
| + if args:
|
| + parser.error('Unknown arguments: %s' % ' '.join(args))
|
| + instance = LocalRietveld()
|
| + try:
|
| + instance.start_server(verbose=options.verbose)
|
| + print 'Local rietveld instance started on port %d' % instance.port
|
| + while True:
|
| + time.sleep(0.1)
|
| + finally:
|
| + instance.stop_server()
|
|
|
|
|
| if __name__ == '__main__':
|
|
|