mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 15:39:43 +00:00
workers for compare for #277
This commit is contained in:
@@ -19,7 +19,8 @@ from dotdrop.updater import Updater
|
||||
from dotdrop.comparator import Comparator
|
||||
from dotdrop.importer import Importer
|
||||
from dotdrop.utils import get_tmpdir, removepath, \
|
||||
uniq_list, patch_ignores, dependencies_met
|
||||
uniq_list, patch_ignores, dependencies_met, \
|
||||
adapt_workers
|
||||
from dotdrop.linktypes import LinkTypes
|
||||
from dotdrop.exceptions import YamlException, UndefinedException
|
||||
|
||||
@@ -278,6 +279,8 @@ def cmd_install(o):
|
||||
dotfiles = o.dotfiles
|
||||
prof = o.conf.get_profile()
|
||||
|
||||
adapt_workers(o, LOG)
|
||||
|
||||
pro_pre_actions = prof.get_pre_actions() if prof else []
|
||||
pro_post_actions = prof.get_post_actions() if prof else []
|
||||
|
||||
@@ -423,6 +426,8 @@ def cmd_update(o):
|
||||
paths = o.update_path
|
||||
iskey = o.update_iskey
|
||||
|
||||
adapt_workers(o, LOG)
|
||||
|
||||
if not paths:
|
||||
# update the entire profile
|
||||
if iskey:
|
||||
|
||||
@@ -227,13 +227,6 @@ class Options(AttrMonitor):
|
||||
self.log.err('bad option for --workers')
|
||||
sys.exit(USAGE)
|
||||
|
||||
if self.safe and self.workers > 1:
|
||||
self.log.warn('workers set to 1 when --force is not used')
|
||||
self.workers = 1
|
||||
if self.dry and self.workers > 1:
|
||||
self.log.warn('workers set to 1 when --dry is used')
|
||||
self.workers = 1
|
||||
|
||||
# import link default value
|
||||
self.import_link = self.link_on_import
|
||||
if self.args['--link']:
|
||||
|
||||
@@ -331,3 +331,12 @@ def chmod(path, mode, debug=False):
|
||||
LOG.dbg('chmod {} {}'.format(oct(mode), path))
|
||||
os.chmod(path, mode)
|
||||
return get_file_perm(path) == mode
|
||||
|
||||
|
||||
def adapt_workers(options, logger):
|
||||
if options.safe and options.workers > 1:
|
||||
logger.warn('workers set to 1 when --force is not used')
|
||||
options.workers = 1
|
||||
if options.dry and options.workers > 1:
|
||||
logger.warn('workers set to 1 when --dry is used')
|
||||
options.workers = 1
|
||||
|
||||
Reference in New Issue
Block a user