diff options
author | 2007-04-05 07:01:39 -0700 | |
---|---|---|
committer | 2007-04-05 07:01:39 -0700 | |
commit | d5486e2316730e3ecf4fa1a21628b22f637f4a10 (patch) | |
tree | 8117f2aeca779b426b97736425476eaa0ed67c8a /examples | |
parent | pull in integration tweaks; mostly cleanup (diff) | |
download | pkgcore-d5486e2316730e3ecf4fa1a21628b22f637f4a10.tar.gz pkgcore-d5486e2316730e3ecf4fa1a21628b22f637f4a10.tar.bz2 pkgcore-d5486e2316730e3ecf4fa1a21628b22f637f4a10.zip |
pull in marien/charlies work; few tweaks needed, but mostly there.
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/changed_use.py | 29 | ||||
-rwxr-xr-x | examples/repo_list.py | 5 |
2 files changed, 15 insertions, 19 deletions
diff --git a/examples/changed_use.py b/examples/changed_use.py index a0b71570..cc41e388 100755 --- a/examples/changed_use.py +++ b/examples/changed_use.py @@ -13,8 +13,9 @@ except ImportError: print >> sys.stderr, 'Cannot import pkgcore!' print >> sys.stderr, 'Verify it is properly installed and/or ' \ 'PYTHONPATH is set correctly.' - print >> sys.stderr, 'Add --debug to the commandline for a traceback.' - if '--debug' in sys.argv: + if '--debug' not in sys.argv: + print >> sys.stderr, 'Add --debug to the commandline for a traceback.' + else: raise sys.exit(1) @@ -31,25 +32,18 @@ class OptionParser(commandline.OptionParser): self.add_option('--verbose', '-v', action='store_true', default=False, help='print packages that have not changed too') self.add_option('--quiet', '-q', action='store_true', default=False, - help='don\'t print changed useflags') + help="don't print changed useflags") def check_values(self, values, args): values, args = commandline.OptionParser.check_values( self, values, args) domain = values.config.get_default('domain') - values.vdb = domain.vdb[0] - # Get repo(s) to operate on. - if values.repo: - repos = (values.repo,) - else: - repos = values.config.get_default('domain').all_repos - values.repo = multiplex_tree(*get_virtual_repos(get_raw_repos(repos), False)) - - values.use = domain.use + if not values.repo: + values.repo = domain.repos[1] - values.restrict = OrRestriction(self.convert_to_restrict(args)) + values.restrict = OrRestriction(*commandline.convert_to_restrict(args)) return values, () def main(options, out, err): @@ -58,9 +52,9 @@ def main(options, out, err): current = repo.match(built.versioned_atom) if current: current = current[0] - oldflags = built.iuse & set(built.use) - newflags = current.iuse & options.use - if oldflags != newflags: + oldflags = built.iuse & built.use + newflags = current.iuse & current.use + if newflags != oldflags: changed_flags = oldflags ^ newflags if options.quiet: out.write(current.cpvstr) @@ -68,7 +62,8 @@ def main(options, out, err): out.write("for package %s, %d flags have changed:\n\t%s" % (current.cpvstr, len(changed_flags), ' '.join(changed_flags))) else: - if options.verbose: out.write("%s is the same as it was before" % current.cpvstr) + if options.verbose: + out.write("%s is the same as it was before" % current.cpvstr) if __name__ == '__main__': commandline.main({None: (OptionParser, main)}) diff --git a/examples/repo_list.py b/examples/repo_list.py index f072d127..0285d105 100755 --- a/examples/repo_list.py +++ b/examples/repo_list.py @@ -11,8 +11,9 @@ except ImportError: print >> sys.stderr, 'Cannot import pkgcore!' print >> sys.stderr, 'Verify it is properly installed and/or ' \ 'PYTHONPATH is set correctly.' - print >> sys.stderr, 'Add --debug to the commandline for a traceback.' - if '--debug' in sys.argv: + if '--debug' not in sys.argv: + print >> sys.stderr, 'Add --debug to the commandline for a traceback.' + else: raise sys.exit(1) |