/[soft]/mga-gnome/trunk/mga-gnome
ViewVC logotype

Diff of /mga-gnome/trunk/mga-gnome

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3652 by ovitters, Wed Mar 21 19:38:52 2012 UTC revision 3653 by ovitters, Wed Mar 21 19:53:09 2012 UTC
# Line 46  import time Line 46  import time
46  # version freeze  # version freeze
47  import datetime  import datetime
48    
49    # packages --sort
50    import itertools
51    
52  MEDIA="Core Release Source"  MEDIA="Core Release Source"
53  URL="http://download.gnome.org/sources/"  URL="http://download.gnome.org/sources/"
54  PKGROOT='~/pkgs'  PKGROOT='~/pkgs'
# Line 618  def join_streams(show_version=False, onl Line 621  def join_streams(show_version=False, onl
621              yield (package, module, package_version, spec_version, downstream.files[package])              yield (package, module, package_version, spec_version, downstream.files[package])
622    
623  def cmd_ls(options, parser):  def cmd_ls(options, parser):
624      for package, module, package_version, spec_version, downstream_files in sorted(join_streams(show_version=options.show_version, only_diff_version=options.diff)):      streams = join_streams(show_version=options.show_version, only_diff_version=options.diff)
625        if options.sort:
626            SORT=dict(zip(options.sort.read().splitlines(), itertools.count()))
627    
628            streams = sorted(streams, key=lambda a: (SORT.get(a[1], 9999), a[0]))
629        else:
630            streams = sorted(streams)
631    
632        for package, module, package_version, spec_version, downstream_files in streams:
633          sys.stdout.write(package)          sys.stdout.write(package)
634          if options.upstream: sys.stdout.write("\t%s" % module)          if options.upstream: sys.stdout.write("\t%s" % module)
635          if options.show_version: sys.stdout.write("\t%s\t%s" % (spec_version, package_version))          if options.show_version: sys.stdout.write("\t%s\t%s" % (spec_version, package_version))
# Line 808  def main(): Line 819  def main():
819                                         help="Show version numbers")                                         help="Show version numbers")
820      subparser.add_argument(      "--diff", action="store_true", dest="diff",      subparser.add_argument(      "--diff", action="store_true", dest="diff",
821                                         help="Only show packages with different version")                                         help="Only show packages with different version")
822        subparser.add_argument(      "--sort", type=argparse.FileType('r', 0),
823                            dest="sort", metavar="FILE",
824                            help="Sort packages according to order in given FILE")
825    
826      subparser.set_defaults(      subparser.set_defaults(
827          func=cmd_ls, upstream=False, show_version=False, diff=False          func=cmd_ls, upstream=False, show_version=False, diff=False
828      )      )

Legend:
Removed from v.3652  
changed lines
  Added in v.3653

  ViewVC Help
Powered by ViewVC 1.1.28