This repository has been archived by the owner on Dec 4, 2024. It is now read-only.
forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(conan-io#12715) msys2: conan v2 support
* conan v2 support * typo * formatting * typo
- Loading branch information
1 parent
7baae2f
commit d7258e8
Showing
3 changed files
with
103 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,35 @@ | ||
from conans import ConanFile, tools | ||
from conans.errors import ConanException | ||
from conan import ConanFile | ||
from conan.tools.env import Environment | ||
from io import StringIO | ||
|
||
class TestPackage(ConanFile): | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "VirtualBuildEnv" | ||
test_type = "explicit" | ||
|
||
def build_requirements(self): | ||
self.tool_requires(self.tested_reference_str) | ||
|
||
@property | ||
def _secret_value(self): | ||
return "SECRET_CONAN_PKG_VARIABLE" | ||
|
||
def generate(self): | ||
env = Environment() | ||
env.define("PKG_CONFIG_PATH", self._secret_value) | ||
envvars = env.vars(self) | ||
envvars.save_script("conanbuildenv_pkg_config_path") | ||
|
||
def build(self): | ||
pass # nothing to do, skip hook warning | ||
|
||
def test(self): | ||
bash = tools.which("bash.exe") | ||
|
||
if bash: | ||
self.output.info("using bash.exe from: " + bash) | ||
else: | ||
raise ConanException("No instance of bash.exe could be found on %PATH%") | ||
|
||
self.run('bash.exe -c ^"make --version^"') | ||
self.run('bash.exe -c ^"! test -f /bin/link^"') | ||
self.run('bash.exe -c ^"! test -f /usr/bin/link^"') | ||
|
||
secret_value = "SECRET_CONAN_PKG_VARIABLE" | ||
with tools.environment_append({"PKG_CONFIG_PATH": secret_value}): | ||
output = StringIO() | ||
self.run('bash.exe -c "echo $PKG_CONFIG_PATH"', output=output) | ||
print(output.getvalue()) | ||
assert secret_value in output.getvalue() | ||
output = StringIO() | ||
self.run('bash.exe -c "echo $PKG_CONFIG_PATH"', output=output) | ||
print(output.getvalue()) | ||
assert self._secret_value in output.getvalue() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from conans import ConanFile, tools | ||
from conans.errors import ConanException | ||
from io import StringIO | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
def build(self): | ||
pass # nothing to do, skip hook warning | ||
|
||
def test(self): | ||
bash = tools.which("bash.exe") | ||
|
||
if bash: | ||
self.output.info("using bash.exe from: " + bash) | ||
else: | ||
raise ConanException("No instance of bash.exe could be found on %PATH%") | ||
|
||
self.run('bash.exe -c ^"make --version^"') | ||
self.run('bash.exe -c ^"! test -f /bin/link^"') | ||
self.run('bash.exe -c ^"! test -f /usr/bin/link^"') | ||
|
||
secret_value = "SECRET_CONAN_PKG_VARIABLE" | ||
with tools.environment_append({"PKG_CONFIG_PATH": secret_value}): | ||
output = StringIO() | ||
self.run('bash.exe -c "echo $PKG_CONFIG_PATH"', output=output) | ||
print(output.getvalue()) | ||
assert secret_value in output.getvalue() |