setup: skip building rust extensions on Windows
authorMatt Harbison <matt_harbison@yahoo.com>
Mon, 30 Dec 2024 20:56:19 -0500
changeset 52662 e5aadff6cb7d
parent 52661 958d5c998505
child 52663 25bb409da058
setup: skip building rust extensions on Windows Without this, the build process in the next commit would have started trying (and failing) to copy the associated module. Not sure why this worked before. I'd like to think there's a better way to conditionalize this inside the extension declaration. [snip] done updating hg.exe's manifest copying build\lib.win-amd64-cpython-39\mercurial\cext\base85.cp39-win_amd64.pyd -> mercurial\cext copying build\lib.win-amd64-cpython-39\mercurial\cext\bdiff.cp39-win_amd64.pyd -> mercurial\cext copying build\lib.win-amd64-cpython-39\mercurial\cext\mpatch.cp39-win_amd64.pyd -> mercurial\cext copying build\lib.win-amd64-cpython-39\mercurial\cext\parsers.cp39-win_amd64.pyd -> mercurial\cext copying build\lib.win-amd64-cpython-39\mercurial\cext\osutil.cp39-win_amd64.pyd -> mercurial\cext copying build\lib.win-amd64-cpython-39\mercurial\thirdparty\sha1dc.cp39-win_amd64.pyd -> mercurial\thirdparty copying build\lib.win-amd64-cpython-39\hgext\fsmonitor\pywatchman\bser.cp39-win_amd64.pyd -> hgext\fsmonitor\pywatchman error: can't copy 'build\lib.win-amd64-cpython-39\mercurial\rustext.cp39-win_amd64.pyd': doesn't exist or not a regular file
setup.py
--- a/setup.py	Wed Dec 04 22:52:58 2024 +0100
+++ b/setup.py	Mon Dec 30 20:56:19 2024 -0500
@@ -1659,18 +1659,21 @@
         ['hgext/fsmonitor/pywatchman/bser.c'],
         extra_compile_args=common_cflags,
     ),
-    RustStandaloneExtension(
-        'mercurial.rustext',
-        'hg-cpython',
-        'librusthg',
-    ),
-    RustStandaloneExtension(
-        'mercurial.pyo3_rustext',
-        'hg-pyo3',
-        'librusthgpyo3',
-    ),
 ]
 
+if os.name != 'nt':
+    extmodules += [
+        RustStandaloneExtension(
+            'mercurial.rustext',
+            'hg-cpython',
+            'librusthg',
+        ),
+        RustStandaloneExtension(
+            'mercurial.pyo3_rustext',
+            'hg-pyo3',
+            'librusthgpyo3',
+        ),
+    ]
 
 sys.path.insert(0, 'contrib/python-zstandard')
 import setup_zstd