remove same-named wheel before shutil.move

In https://github.com/adobe-type-tools/afdko/pull/595 we attempt to build a py2.py3 wheel
thus the filename of the wheel is the same as the previous ones, and it causes a shutil.Error
https://travis-ci.org/adobe-type-tools/afdko/jobs/424691105#L1460

just remove the previous existing file before moving the new one (they'll be identical anyway,
or at least they *should*).
This commit is contained in:
Cosimo Lupo
2018-09-06 11:34:50 +01:00
parent 9f7fdbf456
commit c9fffab6ea
2 changed files with 10 additions and 4 deletions
+5 -2
View File
@@ -130,5 +130,8 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be
test_command_prepared = prepare_command(test_command, project=abs_project_dir)
call(test_command_prepared, cwd=os.environ['HOME'], env=env, shell=True)
# we're all done here; move it to output
shutil.move(delocated_wheel, output_dir)
# we're all done here; move it to output (remove if already exists)
dst = os.path.join(output_dir, os.path.basename(delocated_wheel))
if os.path.isfile(dst):
os.remove(dst)
shutil.move(delocated_wheel, dst)
+5 -2
View File
@@ -101,5 +101,8 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be
test_command_prepared = prepare_command(test_command, project=abs_project_dir)
shell([test_command_prepared], cwd='c:\\', env=env)
# we're all done here; move it to output
shutil.move(built_wheel, output_dir)
# we're all done here; move it to output (remove if already exists)
dst = os.path.join(output_dir, os.path.basename(built_wheel))
if os.path.isfile(dst):
os.remove(dst)
shutil.move(built_wheel, dst)