M fetch => fetch +8 -2
@@ 238,6 238,12 @@ def main():
manifest = Manifest(manifest_path)
+ def print_item(i):
+ p = os.path.relpath(i.local, start=root)
+ if args.root != ".":
+ p = os.path.join(args.root, p)
+ print(p)
+
if args.cmd == "add":
target = os.path.relpath(os.path.join(root, args.target), start=root)
if target in manifest:
@@ 245,7 251,7 @@ def main():
else:
item = Item(url=args.url, sha256=args.sha256, target=target).download(root=root)
manifest.add(item)
- print(os.path.relpath(item.local, start=root))
+ print_item(item)
manifest.save()
elif args.cmd == None or args.cmd == "download":
items = set()
@@ 261,7 267,7 @@ def main():
i.verify(root=root)
else:
i.download(root=root)
- print(os.path.relpath(i.local, start=root))
+ print_item(i)
elif args.cmd == "steal-this-script":
dst = sys.stdout.buffer
if args.output is not None:
M tests/test_basic.py => tests/test_basic.py +3 -2
@@ 115,8 115,9 @@ class BasicTests(TestCase):
downloaded = self.run_exe("--root", root).splitlines()
for i in j:
- self.assertIn(i["target"].encode("UTF-8"), downloaded)
- self.assertSHA256(os.path.join(root, i["target"]), i["sha256"])
+ p = os.path.join(root, i["target"])
+ self.assertIn(p.encode("UTF-8"), downloaded)
+ self.assertSHA256(p, i["sha256"])
def test_manifest(self):
a = fresh.Bytes.fresh().write(self.cwd("a"))