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
28
from cdimage.config import Config
29
from cdimage.tree import Tree
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}")
33
parser = OptionParser("%prog DIRECTORY [FILE]")
34
_, args = parser.parse_args()
44
36
parser.error("need directory")
46
path = os.path.join(args[1], 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)
52
45
output = sys.stdout
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)
57
52
if path is not None: