Skip to content
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

change default for source_buildenv, too risky #15319

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conans/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
REVISIONS = "revisions" # Only when enabled in config, not by default look at server_launcher.py
OAUTH_TOKEN = "oauth_token"

__version__ = '2.0.15'
__version__ = '2.0.16'
2 changes: 1 addition & 1 deletion conans/client/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def config_source(export_source_folder, conanfile, hook_manager):
# First of all get the exported scm sources (if auto) or clone (if fixed)
# Now move the export-sources to the right location
merge_directories(export_source_folder, conanfile.folders.base_source)
if getattr(conanfile, "source_buildenv", True):
if getattr(conanfile, "source_buildenv", False):
with VirtualBuildEnv(conanfile, auto_generate=True).vars().apply():
run_source_method(conanfile, hook_manager)
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class Pkg(ConanFile):
version = "0.1"
tool_requires = "tool/0.1"

source_buildenv = True

def source(self):
cmd = "mytool.bat" if platform.system() == "Windows" else "mytool.sh"
self.run(cmd)
Expand All @@ -63,6 +65,8 @@ class Pkg(ConanFile):
tool_requires = "tool/0.1"
settings = "build_type"

source_buildenv = True

def layout(self):
self.folders.source = "mysrc"
bt = self.settings.get_safe("build_type") or "Release"
Expand Down Expand Up @@ -101,6 +105,8 @@ class Pkg(ConanFile):
tool_requires = "tool/0.1"
settings = "build_type"

source_buildenv = True

def layout(self):
cmake_layout(self)
bt = self.settings.get_safe("build_type") or "Release"
Expand All @@ -118,7 +124,7 @@ def source(self):
c.run("source .")
assert "MY-TOOL! tool/0.1" in c.out

def test_source_buildenv_optout(self, client):
def test_source_buildenv_default_fail(self, client):
c = client

pkg = textwrap.dedent("""
Expand All @@ -130,15 +136,13 @@ class Pkg(ConanFile):
version = "0.1"
tool_requires = "tool/0.1"

source_buildenv = False

def source(self):
cmd = "mytool.bat" if platform.system() == "Windows" else "mytool.sh"
self.run(cmd)
""")
c.save({"conanfile.py": pkg})
c.run("create .", assert_error=True)
assert "ERROR: pkg/0.1: Error in source() method, line 14" in c.out
assert "ERROR: pkg/0.1: Error in source() method, line 12" in c.out

# Local will still work, because ``install`` generates env-scripts and no layout
c.run("install .")
Expand Down