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' |
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)) |
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 |
) |
) |