예제 #1
0
    def AutomagicalSettings(self):
        """Determines settings based on supported code review and checkout tools.
    """
        # Try to find gclient or repo root first.
        if not self.options.no_search:
            self.toplevel_root = gclient_utils.FindGclientRoot(
                self.checkout_root)
            if self.toplevel_root:
                logging.info('Found .gclient at %s' % self.toplevel_root)
            else:
                self.toplevel_root = gclient_utils.FindFileUpwards(
                    os.path.join('..', '.repo'), self.checkout_root)
                if self.toplevel_root:
                    logging.info('Found .repo dir at %s' %
                                 os.path.dirname(self.toplevel_root))

            # Parse TRYSERVER_* settings from codereview.settings before falling back
            # on setting self.options.root manually further down. Otherwise
            # TRYSERVER_ROOT would never be used in codereview.settings.
            self._GclStyleSettings()

            if self.toplevel_root and not self.options.root:
                assert os.path.abspath(
                    self.toplevel_root) == self.toplevel_root
                self.options.root = gclient_utils.PathDifference(
                    self.toplevel_root, self.checkout_root)
        else:
            self._GclStyleSettings()
예제 #2
0
def _FindChromiumSourceRoot():
    """Return the source root of the current chromium checkout, or die trying."""
    # The use of .gn is somewhat incongruous here, but we need a file uniquely
    # existing at src/. GN does the same thing at least.
    source_root = gclient_utils.FindFileUpwards('.gn')
    if not source_root:
        raise NotFoundError(
            '.gn file not found in any parent of the current path.')
    return source_root
예제 #3
0
def main(args):
    for arg in sys.argv:
        if arg.startswith('--root='):
            sourceroot = arg.replace('--root=', '')
            dotfile_path = os.path.join(sourceroot, '.gn')
            if not os.path.exists(dotfile_path):
                print >> sys.stderr, 'gn.py: "%s" not found, exiting.' % dotfile_path
                sys.exit(1)
            return RunGN(sourceroot)

    sourceroot = gclient_utils.FindFileUpwards('.gn')
    if not sourceroot:
        print >> sys.stderr, ('gn.py: No .gn file found in any parent of '
                              'the current path.')
        print >> sys.stderr, ('\nYou need to either be inside a checkout, '
                              'or use --root to specify the checkout root.')
        sys.exit(1)
    return RunGN(sourceroot)
예제 #4
0
    def AutomagicalSettings(self):
        """Determines settings based on supported code review and checkout tools.
    """
        # Try to find gclient or repo root first.
        if not self.options.no_search:
            self.toplevel_root = gclient_utils.FindGclientRoot(
                self.checkout_root)
            if self.toplevel_root:
                logging.info('Found .gclient at %s' % self.toplevel_root)
            else:
                self.toplevel_root = gclient_utils.FindFileUpwards(
                    os.path.join('..', '.repo'), self.checkout_root)
                if self.toplevel_root:
                    logging.info('Found .repo dir at %s' %
                                 os.path.dirname(self.toplevel_root))

            if self.toplevel_root and not self.options.root:
                assert os.path.abspath(
                    self.toplevel_root) == self.toplevel_root
                self.options.root = gclient_utils.PathDifference(
                    self.toplevel_root, self.checkout_root)

        self._GclStyleSettings()
예제 #5
0
def main(args):
    sourceroot = gclient_utils.FindFileUpwards('.gn')
    if not sourceroot:
        print >> sys.stderr, '.gn file not found in any parent of the current path.'
        sys.exit(1)
    return RunGN(sourceroot)