Commit 3ccff024 by Eric Coissac

Fix #35

parent 30ffb475
...@@ -6,12 +6,15 @@ Created on 28 sept. 2014 ...@@ -6,12 +6,15 @@ Created on 28 sept. 2014
from orgasm import getOutput from orgasm import getOutput
import shutil import shutil
import sys
import os
__title__="copy an assembly" __title__="copy an assembly"
default_config = { "source" : None, default_config = { "source" : None,
"dest" : None "dest" : None,
"force" : False
} }
def addOptions(parser): def addOptions(parser):
...@@ -21,6 +24,11 @@ def addOptions(parser): ...@@ -21,6 +24,11 @@ def addOptions(parser):
parser.add_argument(dest='clone:dest', metavar='dest', parser.add_argument(dest='clone:dest', metavar='dest',
help='name of the new copy of the assembly' ) help='name of the new copy of the assembly' )
parser.add_argument("--force","-f",
dest='clone:force',
action='store_true',
default=None,
help='Force cloning even if the destination already exist' )
...@@ -33,6 +41,13 @@ def run(config): ...@@ -33,6 +41,13 @@ def run(config):
logger.info("Copying the assembly %s to %s" % (config['orgasm']['outputfilename'], logger.info("Copying the assembly %s to %s" % (config['orgasm']['outputfilename'],
config['clone']['dest'])) config['clone']['dest']))
if os.path.exists("%s.oas" % config['clone']['dest']):
if config['clone']['force']:
shutil.rmtree("%s.oas" % config['clone']['dest'])
else:
logger.error('Destination assembling exists')
sys.exit(1)
shutil.copytree("%s.oas" % config['orgasm']['outputfilename'], shutil.copytree("%s.oas" % config['orgasm']['outputfilename'],
"%s.oas" % config['clone']['dest']) "%s.oas" % config['clone']['dest'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment