mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 22:59:01 +00:00
Merge pull request #236 from kluen/replace-cp-with-shutil
Replace `cp` with shutils functions for import
This commit is contained in:
@@ -8,6 +8,8 @@ entry point
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import shutil
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from dotdrop.options import Options
|
from dotdrop.options import Options
|
||||||
from dotdrop.logger import Logger
|
from dotdrop.logger import Logger
|
||||||
@@ -421,7 +423,15 @@ def cmd_importer(o):
|
|||||||
LOG.err('importing \"{}\" failed!'.format(path))
|
LOG.err('importing \"{}\" failed!'.format(path))
|
||||||
ret = False
|
ret = False
|
||||||
continue
|
continue
|
||||||
cmd = ['cp', '-R', '-L', '-T', dst, srcf]
|
if o.dry:
|
||||||
|
LOG.dry('would copy {} to {}'.format(dst, srcf))
|
||||||
|
else:
|
||||||
|
if os.path.isdir(dst):
|
||||||
|
if os.path.exists(srcf):
|
||||||
|
shutil.rmtree(srcf)
|
||||||
|
shutil.copytree(dst, srcf)
|
||||||
|
else:
|
||||||
|
shutil.copy2(dst, srcf)
|
||||||
if o.dry:
|
if o.dry:
|
||||||
LOG.dry('would run: {}'.format(' '.join(cmd)))
|
LOG.dry('would run: {}'.format(' '.join(cmd)))
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user