예제 #1
0
def main():
    option_parser = optparse.OptionParser()

    option_parser.add_option(
        '--deps',
        default=None,
        help='The deps file contains the dependencies path and url')
    option_parser.add_option(
        '-v',
        '--verbose',
        action='count',
        default=0,
        help='Produces additional output for diagnostics. Can be '
        'used up to three times for more logging info.')
    # pylint: disable=W0612
    options, args = option_parser.parse_args()

    # Following code copied from gclient_utils.py
    try:
        # Make stdout auto-flush so buildbot doesn't kill us during lengthy
        # operations. Python as a strong tendency to buffer sys.stdout.
        sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
        # Make stdout annotated with the thread ids.
        sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout)
    except (gclient_utils.Error, subprocess2.CalledProcessError), e:
        print >> sys.stderr, 'Error: %s' % str(e)
        return 1
예제 #2
0
            '  { "name": "foo", "url": "svn://example.com/foo",\n'
            '    "deps_file" : ".DEPS.git",\n'
            '  },\n'
            ']')
        write(os.path.join('foo', 'DEPS'), 'allowed_hosts = None\n'
              'deps = {\n'
              '  "bar": "/bar",\n'
              '}')
        options, _ = gclient.OptionParser().parse_args([])
        obj = gclient.GClient.LoadCurrentConfig(options)
        try:
            obj.RunOnDeps('None', [])
            self.fail()
        except gclient_utils.Error, e:
            self.assertIn('allowed_hosts must be', str(e))
        finally:
            self._get_processed()


if __name__ == '__main__':
    sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
    sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True)
    sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr)
    sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True)
    logging.basicConfig(
        level=[logging.ERROR, logging.WARNING, logging.INFO,
               logging.DEBUG][min(sys.argv.count('-v'), 3)],
        format='%(relativeCreated)4d %(levelname)5s %(module)13s('
        '%(lineno)d) %(message)s')
    unittest.main()
예제 #3
0
def disable_buffering():
    # Make stdout auto-flush so buildbot doesn't kill us during lengthy
    # operations. Python as a strong tendency to buffer sys.stdout.
    sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
    # Make stdout annotated with the thread ids.
    sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout)