Subject: do not create dir if it exists
Description: command tries to create an output dir during tests, even if it
 already exists, raising an error. Skip creation if already present
Author: Olivier Sallou <osallou@debian.org>
Bug: 925568
Forwarded: no
Last-Updated: 2019-03-27
Index: cnvkit/cnvlib/commands.py
===================================================================
--- cnvkit.orig/cnvlib/commands.py
+++ cnvkit/cnvlib/commands.py
@@ -1366,8 +1366,9 @@ def _cmd_import_picard(args):
                             'anti' if 'antitarget' in fname else ''))
         if args.output_dir:
             if not os.path.isdir(args.output_dir):
-                os.mkdir(args.output_dir)
-                logging.info("Created directory %s", args.output_dir)
+                if not os.path.exists(args.output_dir):
+                    os.mkdir(args.output_dir)
+                    logging.info("Created directory %s", args.output_dir)
             outfname = os.path.join(args.output_dir, outfname)
         tabio.write(garr, outfname)
 
