-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
msys2: conan v2 support #12715
Merged
Merged
msys2: conan v2 support #12715
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also experimenting with changing this recipe and using the
buildenv_info
, but I noticed that I needed to fix the subsystem.py for that to work correctly in consuming projects. See PR conan-io/conan#11981 and conan-io/conan#11980I also still needed to keep on using the old
env_info
otherwise to much of my dependencies such aslibffi
needed to be overhauled. By defining them both I only needed to overhaul automake and autoconf. See: master...Ultimaker:conan-center-index:modernize_autoconf for a work in progressThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
related to conan-io/conan#11974 (comment)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact is that
env_info
must be kept for the moment inpackage_info()
of CCI recipes, alongbuildenv_info
, to achieve v1/v2 cross-compatibility. Because conan v1 recipes don't use at allbuildenv_info
of tool_requires, and even some conan v2 recipes (it depends on user configuration or ifVirtualBuildEnv
is explicitly used, see conan-io/conan#11974 (comment) again).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx, will keep that in mind. You're updating those recipes at an amazing speed. I think that when I'm finally finished with my struggle getting CPython and Qt to compile on Windows, my change aren't needed anymore 😉.