rust: lower compile error on non-linux platforms to a warning
authorDan Villiom Podlaski Christiansen <danchr@gmail.com>
Fri, 22 Jan 2021 11:10:39 +0100
changeset 46369 cabc5e9366c5
parent 46368 bb3a5c0df06b
child 46370 cad17d50736c
rust: lower compile error on non-linux platforms to a warning As discussed on D9671#146704 this lowers the error to a warning. Differential Revision: https://phab.mercurial-scm.org/D9852
rust/hg-core/src/lib.rs
setup.py
--- a/rust/hg-core/src/lib.rs	Mon Jan 18 10:24:20 2021 +0100
+++ b/rust/hg-core/src/lib.rs	Fri Jan 22 11:10:39 2021 +0100
@@ -30,14 +30,6 @@
 pub mod operations;
 pub mod utils;
 
-// Remove this to see (potential) non-artificial compile failures. MacOS
-// *should* compile, but fail to compile tests for example as of 2020-03-06
-#[cfg(not(target_os = "linux"))]
-compile_error!(
-    "`hg-core` has only been tested on Linux and will most \
-     likely not behave correctly on other platforms."
-);
-
 use crate::utils::hg_path::{HgPathBuf, HgPathError};
 pub use filepatterns::{
     parse_pattern_syntax, read_pattern_file, IgnorePattern,
--- a/setup.py	Mon Jan 18 10:24:20 2021 +0100
+++ b/setup.py	Fri Jan 22 11:10:39 2021 +0100
@@ -609,6 +609,12 @@
         # and its build is not explictely disabled (for external build
         # as Linux distributions would do)
         if self.distribution.rust and self.rust:
+            if not sys.platform.startswith('linux'):
+                self.warn(
+                    "rust extensions have only been tested on Linux "
+                    "and may not behave correctly on other platforms"
+                )
+
             for rustext in ruststandalones:
                 rustext.build('' if self.inplace else self.build_lib)