1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 19:44:45 +00:00

Merge pull request #236 from kluen/replace-cp-with-shutil

Replace `cp` with shutils functions for import
This commit is contained in:
deadc0de
2020-05-31 10:36:40 +02:00
committed by GitHub

View File

@@ -8,6 +8,8 @@ entry point
import os
import sys
import shutil
# local imports
from dotdrop.options import Options
from dotdrop.logger import Logger
@@ -421,7 +423,15 @@ def cmd_importer(o):
LOG.err('importing \"{}\" failed!'.format(path))
ret = False
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:
LOG.dry('would run: {}'.format(' '.join(cmd)))
else: