~xubuntu-dev/ubuntu-cdimage/xubuntu-base

« back to all changes in this revision

Viewing changes to bin/site-manifest

  • Committer: Colin Watson
  • Date: 2015-09-14 07:42:14 UTC
  • Revision ID: cjwatson@canonical.com-20150914074214-6utmkgmobnz5cjvh
Silence some noise from checksum tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import sys
26
26
 
27
27
sys.path.insert(0, os.path.join(sys.path[0], os.pardir, "lib"))
28
 
from cdimage.config import config
29
 
from cdimage.tree import DailyTree, SimpleTree
30
 
 
31
 
 
32
 
tree_classes = {
33
 
    "simple": SimpleTree,
34
 
    "daily": DailyTree,
35
 
}
 
28
from cdimage.config import Config
 
29
from cdimage.tree import Tree
36
30
 
37
31
 
38
32
def main():
39
 
    parser = OptionParser("%prog {simple|daily} DIRECTORY [FILE]")
40
 
    options, args = parser.parse_args()
41
 
    if len(args) < 1 or args[0] not in tree_classes:
42
 
        parser.error("need {simple|daily}")
43
 
    elif len(args) < 2:
 
33
    parser = OptionParser("%prog DIRECTORY [FILE]")
 
34
    _, args = parser.parse_args()
 
35
    if len(args) < 1:
44
36
        parser.error("need directory")
45
 
    if len(args) >= 3:
46
 
        path = os.path.join(args[1], args[2])
 
37
    directory = args[0]
 
38
    if len(args) >= 2:
 
39
        path = os.path.join(directory, args[1])
47
40
        output = open("%s.new" % path, "w")
48
41
        output_fd = output.fileno()
49
42
        os.fchmod(output_fd, os.fstat(output_fd).st_mode | stat.S_IWGRP)
50
43
    else:
51
44
        path = None
52
45
        output = sys.stdout
 
46
    config = Config()
53
47
    try:
54
 
        for line in tree_classes[args[0]](config, args[1]).manifest():
 
48
        tree = Tree.get_for_directory(config, directory, "daily")
 
49
        for line in tree.manifest():
55
50
            print(line, file=output)
56
51
    finally:
57
52
        if path is not None: