1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
From 2344ca4791940841af3a9a03f7231773ac2430e7 Mon Sep 17 00:00:00 2001
From: Boris Staletic <boris.staletic@protonmail.com>
Date: Mon, 7 Oct 2024 22:23:59 +0200
Subject: [PATCH] Make building regex module optional
---
build.py | 14 +++++++++++---
test_requirements.txt | 2 ++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/build.py b/build.py
index 7429b4dc..2b651f8d 100755
--- a/build.py
+++ b/build.py
@@ -568,6 +568,10 @@ def ParseArguments():
parser.add_argument( '--js-completer', action = 'store_true',
help = argparse.SUPPRESS )
+ parser.add_argument( '--regex', action = argparse.BooleanOptionalAction,
+ default = True,
+ help = 'Choose whether to build the regex module. '
+ 'Defaults to True.' )
args = parser.parse_args()
# coverage is not supported for c++ on MSVC
@@ -800,8 +804,8 @@ def BuildRegexModule( script_args ):
exit_message = 'Failed to build regex module.',
quiet = script_args.quiet,
status_message = 'Building regex module' )
- except ImportError:
- pass # Swallow the error - ycmd will fall back to the standard `re`.
+ except ( ImportError, subprocess.CalledProcessError ):
+ print( 'Building regex module failed. Falling back to re builtin.' )
finally:
RemoveDirectoryIfExists( build_dir )
@@ -1301,9 +1305,13 @@ def DoCmakeBuilds( args ):
BuildYcmdLib( cmake, cmake_common_args, args )
WritePythonUsedDuringBuild()
- BuildRegexModule( args )
BuildWatchdogModule( args )
+ # NOTE: Keep BuildRegexModule() as the final step.
+ # If it fails, at least everything mandatory has been built.
+ if args.regex:
+ BuildRegexModule( args )
+
def PrintReRunMessage():
print( '',
diff --git a/test_requirements.txt b/test_requirements.txt
index 9c58f618..da72e811 100644
--- a/test_requirements.txt
+++ b/test_requirements.txt
@@ -7,3 +7,5 @@ psutil >= 5.6.6
coverage >= 4.2
requests
legacy-cgi ; python_version >= "3.13"
+# Needed for building the regex and watchdog modules.
+setuptools
--
2.45.2
|