Example #1
0
 def __call__(self, args):
     auto_checkout = self.develop.auto_checkout
     develeggs = self.develop.develeggs
     packages = self.get_packages(getattr(args, 'package-regexp'),
                                  auto_checkout=args.auto_checkout,
                                  checked_out=args.checked_out,
                                  develop=args.develop)
     workingcopies = WorkingCopies(self.develop.sources)
     for name in sorted(packages):
         source = self.develop.sources[name]
         if not source.exists():
             if name in auto_checkout:
                 print "!", " ", name
             continue
         if not workingcopies.matches(source):
             print "C",
         else:
             if name in auto_checkout:
                 print " ",
             else:
                 print "~",
         if args.verbose:
             status, output = workingcopies.status(source, verbose=True)
         else:
             status = workingcopies.status(source)
         if status == 'clean':
             print " ",
         else:
             print "M",
         if self.develop.config.develop.get(name, name in auto_checkout):
             if name in develeggs:
                 print " ",
             else:
                 if source.get('egg', True):
                     print "A",
                 else:
                     print " ",
         else:
             if name not in develeggs:
                 if not source.get('egg', True):
                     print " ",
                 elif name in auto_checkout:
                     print "!",
                 else:
                     print "-",
             else:
                 if source.get('egg', True):
                     print "D",
                 else:
                     print " ",
         print name
         if args.verbose:
             output = output.strip()
             if output:
                 for line in output.split('\n'):
                     print "   ", line
                 print
Example #2
0
 def __call__(self):
     options, args = self.parser.parse_args(sys.argv[2:])
     sources = self.develop.sources
     auto_checkout = self.develop.auto_checkout
     develeggs = self.develop.develeggs
     packages = set(self.get_packages(args))
     workingcopies = WorkingCopies(sources)
     for name in sorted(sources):
         if args and name not in packages:
             continue
         source = sources[name]
         path = source["path"]
         if not os.path.exists(path):
             if name in auto_checkout:
                 print "!", " ", name
             continue
         if not workingcopies.matches(source):
             print "C",
         else:
             if name in auto_checkout:
                 print " ",
             else:
                 print "~",
         if options.verbose:
             status, output = workingcopies.status(source, verbose=True)
         else:
             status = workingcopies.status(source)
         if status == "clean":
             print " ",
         else:
             print "M",
         if self.develop.config.develop.get(name, name in auto_checkout):
             if name in develeggs:
                 print " ",
             else:
                 print "A",
         else:
             if name not in develeggs:
                 if name in auto_checkout:
                     print "!",
                 else:
                     print "-",
             else:
                 print "D",
         print name
         if options.verbose:
             output = output.strip()
             if output:
                 for line in output.split("\n"):
                     print "   ", line
                 print
Example #3
0
 def __call__(self, args):
     buildout_dir = self.develop.buildout_dir
     packages = self.get_packages(getattr(args, 'package-regexp'),
                                  checked_out=True)
     packages = packages - self.develop.auto_checkout
     packages = packages - set(self.develop.develeggs)
     workingcopies = WorkingCopies(self.develop.sources)
     if args.dry_run:
         logger.info("Dry run, nothing will be removed.")
     for name in packages:
         source = self.develop.sources[name]
         path = source['path']
         if path.startswith(buildout_dir):
             path = path[len(buildout_dir)+1:]
         if source['kind'] != 'svn':
             logger.warn("The directory of package '%s' at '%s' might contain unrecoverable files and will not be removed." % (name, path))
             continue
         if workingcopies.status(source) != 'clean':
             logger.warn("The package '%s' is dirty and will not be removed." % name)
             continue
         logger.info("Removing package '%s' at '%s'." % (name, path))
         if not args.dry_run:
             shutil.rmtree(source['path'],
                           ignore_errors=False,
                           onerror=self.handle_remove_readonly)
Example #4
0
    def __call__(self, args):
        buildout_dir = self.develop.buildout_dir
        packages = self.get_packages(getattr(args, 'package-regexp'),
                                     checked_out=True)
        packages = packages - self.develop.auto_checkout
        packages = packages - set(self.develop.develeggs)
        force = args.force
        force_all = False
        workingcopies = WorkingCopies(self.develop.sources)
        if args.dry_run:
            logger.info("Dry run, nothing will be removed.")
        for name in packages:
            source = self.develop.sources[name]
            path = source['path']
            if path.startswith(buildout_dir):
                path = path[len(buildout_dir) + 1:]
            need_force = False
            if source['kind'] != 'svn':
                need_force = True
                logger.warn(
                    "The directory of package '%s' at '%s' might contain unrecoverable files and will not be removed without --force."
                    % (name, path))
            if workingcopies.status(source) != 'clean':
                need_force = True
                logger.warn(
                    "The package '%s' is dirty and will not be removed without --force."
                    % name)
            if need_force:
                if not force:
                    continue
                # We only get here when a --force is needed and we
                # have actually added the --force argument on the
                # command line.
                if not force_all:
                    answer = yesno("Do you want to purge it anyway?",
                                   default=False,
                                   all=True)
                    if not answer:
                        logger.info("Skipped purge of '%s'." % name)
                        continue
                    if answer == 'all':
                        force_all = True

            logger.info("Removing package '%s' at '%s'." % (name, path))
            if not args.dry_run:
                shutil.rmtree(source['path'],
                              ignore_errors=False,
                              onerror=self.handle_remove_readonly)
Example #5
0
    def __call__(self, args):
        buildout_dir = self.develop.buildout_dir
        packages = self.get_packages(getattr(args, 'package-regexp'),
                                     checked_out=True)
        packages = packages - self.develop.auto_checkout
        packages = packages - set(self.develop.develeggs)
        force = args.force
        force_all = False
        workingcopies = WorkingCopies(self.develop.sources)
        if args.dry_run:
            logger.info("Dry run, nothing will be removed.")
        for name in packages:
            source = self.develop.sources[name]
            path = source['path']
            if path.startswith(buildout_dir):
                path = path[len(buildout_dir)+1:]
            need_force = False
            if source['kind'] != 'svn':
                need_force = True
                logger.warn("The directory of package '%s' at '%s' might contain unrecoverable files and will not be removed without --force." % (name, path))
            if workingcopies.status(source) != 'clean':
                need_force = True
                logger.warn("The package '%s' is dirty and will not be removed without --force." % name)
            if need_force:
                if not force:
                    continue
                # We only get here when a --force is needed and we
                # have actually added the --force argument on the
                # command line.
                if not force_all:
                    answer = yesno("Do you want to purge it anyway?", default=False, all=True)
                    if not answer:
                        logger.info("Skipped purge of '%s'." % name)
                        continue
                    if answer == 'all':
                        force_all = True

            logger.info("Removing package '%s' at '%s'." % (name, path))
            if not args.dry_run:
                shutil.rmtree(source['path'],
                              ignore_errors=False,
                              onerror=self.handle_remove_readonly)
Example #6
0
 def __call__(self):
     options, args = self.parser.parse_args(sys.argv[2:])
     buildout_dir = self.develop.buildout_dir
     packages = self.get_packages(args, checked_out=True)
     packages = packages - self.develop.auto_checkout
     packages = packages - set(self.develop.develeggs)
     workingcopies = WorkingCopies(self.develop.sources)
     for name in packages:
         source = self.develop.sources[name]
         path = source['path']
         if path.startswith(buildout_dir):
             path = path[len(buildout_dir)+1:]
         if source['kind'] != 'svn':
             logger.warn("The directory of package '%s' at '%s' might contain unrecoverable files and will not be removed." % (name, path))
             continue
         if workingcopies.status(source) != 'clean':
             logger.warn("The package '%s' is dirty and will not be removed." % name)
             continue
         logger.info("Removing package '%s' at '%s'." % (name, path))
         shutil.rmtree(source['path'])
Example #7
0
    def __call__(self, args):
        auto_checkout = self.develop.auto_checkout
        sources_dir = self.develop.sources_dir
        develeggs = self.develop.develeggs
        package_regexp = getattr(args, 'package-regexp')
        packages = self.get_packages(package_regexp,
                                     auto_checkout=args.auto_checkout,
                                     checked_out=args.checked_out,
                                     develop=args.develop)
        workingcopies = WorkingCopies(self.develop.sources)
        paths = []
        for name in sorted(packages):
            source = self.develop.sources[name]
            if not source.exists():
                if name in auto_checkout:
                    print "!", " ", name
                continue
            paths.append(source['path'])
            if not workingcopies.matches(source):
                print "C",
            else:
                if name in auto_checkout:
                    print " ",
                else:
                    print "~",
            if args.verbose:
                status, output = workingcopies.status(source, verbose=True)
            else:
                status = workingcopies.status(source)
            if status == 'clean':
                print " ",
            else:
                print "M",
            if self.develop.config.develop.get(name, name in auto_checkout):
                if name in develeggs:
                    print " ",
                else:
                    if source.get('egg', True):
                        print "A",
                    else:
                        print " ",
            else:
                if name not in develeggs:
                    if not source.get('egg', True):
                        print " ",
                    elif name in auto_checkout:
                        print "!",
                    else:
                        print "-",
                else:
                    if source.get('egg', True):
                        print "D",
                    else:
                        print " ",
            print name
            if args.verbose:
                output = output.strip()
                if output:
                    for line in output.split('\n'):
                        print "   ", line
                    print

        # Only report on unknown entries when we have no package regexp.
        if not package_regexp:
            for entry in os.listdir(sources_dir):
                if not os.path.join(sources_dir, entry) in paths:
                    print '?', ' ', entry
Example #8
0
    def __call__(self, args):
        auto_checkout = self.develop.auto_checkout
        sources_dir = self.develop.sources_dir
        develeggs = self.develop.develeggs
        package_regexp = getattr(args, 'package-regexp')
        packages = self.get_packages(package_regexp,
                                     auto_checkout=args.auto_checkout,
                                     checked_out=args.checked_out,
                                     develop=args.develop)
        workingcopies = WorkingCopies(self.develop.sources)
        paths = []
        for name in sorted(packages):
            source = self.develop.sources[name]
            if not source.exists():
                if name in auto_checkout:
                    print "!", " ", name
                continue
            paths.append(source['path'])
            if not workingcopies.matches(source):
                print "C",
            else:
                if name in auto_checkout:
                    print " ",
                else:
                    print "~",
            if args.verbose:
                status, output = workingcopies.status(source, verbose=True)
            else:
                status = workingcopies.status(source)
            if status == 'clean':
                print " ",
            else:
                print "M",
            if self.develop.config.develop.get(name, name in auto_checkout):
                if name in develeggs:
                    print " ",
                else:
                    if source.get('egg', True):
                        print "A",
                    else:
                        print " ",
            else:
                if name not in develeggs:
                    if not source.get('egg', True):
                        print " ",
                    elif name in auto_checkout:
                        print "!",
                    else:
                        print "-",
                else:
                    if source.get('egg', True):
                        print "D",
                    else:
                        print " ",
            print name
            if args.verbose:
                output = output.strip()
                if output:
                    for line in output.split('\n'):
                        print "   ", line
                    print

        # Only report on unknown entries when we have no package regexp.
        if not package_regexp:
            for entry in os.listdir(sources_dir):
                if not os.path.join(sources_dir, entry) in paths:
                    print '?', ' ', entry