def _run(self, config, cmd_options, cmd_args): require_box(config) box = config.box regexps = [re.compile(pattern + '$', re.IGNORECASE) for pattern in cmd_options.exclude] to_remove = [] for pkg in box.packages(): if pkg.enabled: continue for regexp in regexps: if regexp.match(pkg.name): break else: # no exclude regexp matched to_remove.append(pkg) if not to_remove: log.info('No packages to remove') return 0 print 'The following packages will be removed:' for pkg in to_remove: print '\t%s' % pkg.name answer = raw_input('Are you sure [y/N]? ') if answer.lower() != 'y': return 0 for pkg in to_remove: box.disable_package(pkg, remove=True)
def _run(self, config, cmd_options, cmd_args): self._require_args(cmd_args, 1) require_box(config) patterns = cmd_args for package in config.box.packages(matching=patterns): config.box.enable_package(package)
def _run(self, config, cmd_options, cmd_args): self._require_args(cmd_args, 1) require_box(config) try: for tarball in cmd_args: autobuild_(config.box, tarball, cmd_options.configure_options, cmd_options.keep) except UnsupportedPath, exc: raise UserError(str(exc))
def _run(self, config, cmd_options, cmd_args): self._require_args(cmd_args, 1) require_box(config) for sourcedir in cmd_args: sd = SourceDir(sourcedir) if cmd_options.clean_before: sd.clean() sd.build(config.box, cmd_options.suffix) if cmd_options.test: sd.unittest()
def _run(self, config, cmd_options, cmd_args): self._require_args(cmd_args, 0, 0) require_box(config) box_name = '(%s)' % config.box.name shell_prompt = r'\[\033[01;31m\]%(box_name)s\[\033[01;32m\] \u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' % locals() cur_box = get_current_box() if cur_box and cur_box == config.box: # Already inside the box env, just execute a shell with the new prompt new_env = dict(os.environ) new_env['PS1'] = shell_prompt call(['bash', '-norc', '-noprofile'], env=new_env) else: # Have to set the correct environment, so execute a shell using the env script # XXX(ot): does this spawn two bashs? call(['bash', config.box.env_script, 'PS1="%s"' % shell_prompt, 'bash', '-norc', '-noprofile'])
def _run(self, config, cmd_options, cmd_args): self._require_args(cmd_args, 0, 0) require_box(config) box_name = '(%s)' % config.box.name shell_prompt = r'\[\033[01;31m\]%(box_name)s\[\033[01;32m\] \u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' % locals( ) cur_box = get_current_box() if cur_box and cur_box == config.box: # Already inside the box env, just execute a shell with the new prompt new_env = dict(os.environ) new_env['PS1'] = shell_prompt call(['bash', '-norc', '-noprofile'], env=new_env) else: # Have to set the correct environment, so execute a shell using the env script # XXX(ot): does this spawn two bashs? call([ 'bash', config.box.env_script, 'PS1="%s"' % shell_prompt, 'bash', '-norc', '-noprofile' ])
def _run(self, config, cmd_options, cmd_args): require_box(config) fmt = '%-30s| %-20s| %-10s| %-10s|' print print fmt % ('PACKAGE', 'NAME', 'VERSION', 'STATUS') print if len(cmd_args) == 0: patterns = None else: patterns = cmd_args for package in config.box.packages(matching=patterns): if package.enabled: pkg_status = 'enabled' else: pkg_status = 'disabled' print fmt % (package.name, package.app_name, package.app_version, pkg_status) print
def _run(self, config, cmd_options, cmd_args): self._require_args(cmd_args, 0, 0) require_box(config) config.box.sync()