From 1db27f417d20b92e6c390550dbe8365dfd7968f0 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 26 Jan 2015 10:44:05 +0100 Subject: [PATCH] [FIX] Packaging: Windows: _prepare_build_dir Catch shutil.Error thrown when addons have already been moved to openerp/addons. Fixes the bug introduced by commit 91026647d43358594df0e17f3d408a3aa415c665. --- setup/package.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup/package.py b/setup/package.py index 9ca97d19dd9..71de37bbf99 100755 --- a/setup/package.py +++ b/setup/package.py @@ -246,9 +246,14 @@ def _prepare_build_dir(o, win32=False): if not win32: cmd += ['--exclude', 'setup/win32'] system(cmd + ['%s/' % o.odoo_dir, o.build_dir]) - for i in glob(join(o.build_dir, 'addons/*')): - if i.split(os.path.sep)[-1] not in ADDONS_NOT_TO_PUBLISH: - shutil.move(i, join(o.build_dir, 'openerp/addons')) + try: + for addon_path in glob(join(o.build_dir, 'addons/*')): + if addon_path.split(os.path.sep)[-1] not in ADDONS_NOT_TO_PUBLISH: + shutil.move(addon_path, join(o.build_dir, 'openerp/addons')) + except shutil.Error: + # Thrown when the add-on is already in openerp/addons (if _prepare_build_dir + # has already been called once) + pass def build_tgz(o): system(['python2', 'setup.py', 'sdist', '--quiet', '--formats=gztar,zip'], o.build_dir)