Skip to content

Commit

Permalink
pcre2: no need for win_bash = True
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Nov 18, 2023
1 parent 0718c17 commit b793e46
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions recipes/pcre2/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def requirements(self):
def build_requirements(self):
self.tool_requires(self.tested_reference_str)
if self._settings_build.os == "Windows":
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
self.tool_requires("msys2/cci.latest")

def generate(self):
# Workaround for Conan v1: store dependency info for later use in test()
pcre2_cpp_info = self.dependencies["pcre2"].cpp_info.aggregated_components()
save(self, os.path.join(self.build_folder, "bindir"), pcre2_cpp_info.bindir)
save(self, os.path.join(self.build_folder, "libs"), " ".join(pcre2_cpp_info.libs))
Expand All @@ -44,12 +44,14 @@ def test(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")

# Check that pcre2-config outputs correct link flags
if Version(self.tested_reference_str.split("/")[1]) >= "10.38":
bindir = load(self, os.path.join(self.build_folder, "bindir"))
libs = load(self, os.path.join(self.build_folder, "libs")).split(" ")
output = StringIO()
self.run(f"bash {bindir}/pcre2-config --libs8", output)
conf = next(l for l in output.getvalue().splitlines() if l.lower().startswith("-l")).strip().split(" ")
for param in conf:
if param.startswith("-l"):
assert param[2:] in libs, f"Invalid library target '{param[2:]}' output by pcre2-config. Not found in {libs}."
ldflags_str = next(l for l in output.getvalue().splitlines() if l.lower().startswith("-l")).strip()
ldflags = ldflags_str.split()
for flag in ldflags:
if flag.startswith("-l"):
assert flag[2:] in libs, f"Invalid library target '{flag[2:]}' output by pcre2-config. Not found in {libs}."

0 comments on commit b793e46

Please sign in to comment.