Repository: pypa/cibuildwheel

Issue:
OSError: [WinError 17] The system cannot move the file to a different disk drive
 ```
 File "C:\hostedtoolcache\windows\Python\3.7.7\x64\lib\site-packages\cibuildwheel\windows.py", line 286, in build
    repaired_wheel.replace(options.output_dir / repaired_wheel.name)
  File "C:\hostedtoolcache\windows\Python\3.7.7\x64\lib\pathlib.py", line 1338, in replace
    self._accessor.replace(self, target)
OSError: [WinError 17] The system cannot move the file to a different disk drive: 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\cibuildwheeli4q9t16s\\repaired_wheel\\OpenPIV-0.21.9a0-cp36-cp36m-win_amd64.whl' -> 'wheelhouse\\OpenPIV-0.21.9a0-cp36-cp36m-win_amd64.whl'
##[error]Process completed with exit code 1.
```


Discussion:
Which CI?

@joerick So it looks like shutil move should be used again. 

@alexlib downgrade to version 1.4.2 until 1.5.1 will be released 
Github actions 

suggested to change this line 

https://github.com/joerick/cibuildwheel/blob/41891277d33c728059fb89ac2ce0c2b32d6d459b/cibuildwheel/windows.py#L286

to 

https://docs.python.org/3/library/shutil.html#shutil.move

similar to the same bug noticed here https://github.com/k4yt3x/video2x/issues/249
I wrote about this. I do not understand why current test set doe not catch this. 

https://github.com/joerick/cibuildwheel/runs/802745957?check_suite_focus=true

This is result of refactoring from #376 

Resolving patch:
diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py
--- a/cibuildwheel/macos.py
+++ b/cibuildwheel/macos.py
@@ -212,7 +212,7 @@ def build(options: BuildOptions) -> None:
         repaired_wheel_dir.mkdir(parents=True)
         if built_wheel.name.endswith('none-any.whl') or not options.repair_command:
             # pure Python wheel or empty repair command
-            built_wheel.rename(repaired_wheel_dir / built_wheel.name)
+            shutil.move(str(built_wheel), repaired_wheel_dir)
         else:
             repair_command_prepared = prepare_command(options.repair_command, wheel=built_wheel, dest_dir=repaired_wheel_dir)
             call(repair_command_prepared, env=env, shell=True)
@@ -262,4 +262,4 @@ def build(options: BuildOptions) -> None:
             shutil.rmtree(venv_dir)
 
         # we're all done here; move it to output (overwrite existing)
-        repaired_wheel.replace(options.output_dir / repaired_wheel.name)
+        shutil.move(str(repaired_wheel), options.output_dir)
diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py
--- a/cibuildwheel/windows.py
+++ b/cibuildwheel/windows.py
@@ -229,7 +229,7 @@ def build(options: BuildOptions) -> None:
         repaired_wheel_dir.mkdir(parents=True)
         if built_wheel.name.endswith('none-any.whl') or not options.repair_command:
             # pure Python wheel or empty repair command
-            built_wheel.rename(repaired_wheel_dir / built_wheel.name)
+            shutil.move(str(built_wheel), repaired_wheel_dir)
         else:
             repair_command_prepared = prepare_command(options.repair_command, wheel=built_wheel, dest_dir=repaired_wheel_dir)
             shell([repair_command_prepared], env=env)
@@ -283,4 +283,4 @@ def build(options: BuildOptions) -> None:
             shutil.rmtree(venv_dir)
 
         # we're all done here; move it to output (remove if already exists)
-        repaired_wheel.replace(options.output_dir / repaired_wheel.name)
+        shutil.move(str(repaired_wheel), options.output_dir)


Test patch: