From e185edd294a1ff22c112c29e45e7eec0e6fa76cb Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 16 Aug 2017 23:31:23 +0800 Subject: update_manifest.py: Add argument --add-directory with a new function --- bin/update_manifest.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/update_manifest.py b/bin/update_manifest.py index 44ccb94..0bc41e0 100755 --- a/bin/update_manifest.py +++ b/bin/update_manifest.py @@ -33,6 +33,15 @@ def get_path(pglob, pdir=None): return p +def add_directory(manifest): + """ + Add the directory where this manifest file locates as the item + ``directory`` into the manifest. + """ + directory = os.path.dirname(manifest.filepath) + manifest.set("directory", directory) + + def add_repro(reprodir, manifest): """ Add the generated products by ``chandra_repro`` to the manifest. @@ -60,6 +69,10 @@ def main(): action="store_true", help="create '%s' under current " % manifestfile + "working directory if not exists") + parser.add_argument("-D", "--add-directory", dest="add_directory", + action="store_true", + help="add an 'directory' item to the manifest " + + "storing the directory where the manifest locates") parser.add_argument("-r", "--repro", dest="reprodir", default=None, help="path to the repro directory; add the " + "reprocessed products to manifest if specified") -- cgit v1.2.2