diff options
author | Aaron LI <aly@aaronly.me> | 2017-08-16 23:23:58 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-08-16 23:23:58 +0800 |
commit | 3c4f53ef53d9a95c51bdec851f586774827a2eac (patch) | |
tree | e83346f1b93edf401fd78dafd0315b8602856e67 /bin | |
parent | 6e4ab2caef5e3d24e81e5756d95e4a0f5c9a21f0 (diff) | |
download | chandra-acis-analysis-3c4f53ef53d9a95c51bdec851f586774827a2eac.tar.bz2 |
update_manifest.py: Fix logger and update manifest creation
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/update_manifest.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/bin/update_manifest.py b/bin/update_manifest.py index 1cfe05b..44ccb94 100755 --- a/bin/update_manifest.py +++ b/bin/update_manifest.py @@ -37,7 +37,7 @@ def add_repro(reprodir, manifest): """ Add the generated products by ``chandra_repro`` to the manifest. """ - logging.info("Adding repro products from: {0}".format(reprodir)) + logger.info("Adding repro products from: {0}".format(reprodir)) keyglobs = OrderedDict([ ("evt2", "acisf*_repro_evt2.fits"), ("bpix", "acisf*_repro_bpix1.fits"), @@ -52,19 +52,22 @@ def add_repro(reprodir, manifest): def main(): + manifestfile = "manifest.yaml" + parser = argparse.ArgumentParser( - description="Update manifest.yaml with generated products") + description="Update %s with generated products" % manifestfile) parser.add_argument("-c", "--create", dest="create", action="store_true", - help="create 'manifest.yaml' under current working " + - "directory if necessary") + help="create '%s' under current " % manifestfile + + "working directory if not exists") parser.add_argument("-r", "--repro", dest="reprodir", default=None, help="path to the repro directory; add the " + "reprocessed products to manifest if specified") args = parser.parse_args() - if args.create: - open("manifest.yaml", "a").close() + if (not os.path.exists(manifestfile)) and args.create: + logger.info("Create %s" % manifestfile) + open(manifestfile, "a").close() manifest = get_manifest() if args.reprodir: |