Skip to content

Commit

Permalink
proof of concept of build_policy=never for export-pkg (#8946)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed May 24, 2021
1 parent 562a2b1 commit 377bcd8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions conans/client/graph/build_mode.py
Expand Up @@ -66,6 +66,9 @@ def pattern_match(pattern_):
conan_file.output.info("Excluded build from source")
return False

if conan_file.build_policy == "never": # this package has been export-pkg
return False

if self.never:
return False
if self.all:
Expand Down
20 changes: 20 additions & 0 deletions conans/test/integration/command/export_pkg_test.py
Expand Up @@ -639,3 +639,23 @@ def test_invalid_folder(self):
assert_error=True)
self.assertIn("ERROR: The {} folder '{}' does not exist."
.format(folder, os.path.join(client.current_folder, folder)), client.out)


def test_build_policy_never():
client = TestClient()
conanfile = textwrap.dedent("""
from conans import ConanFile
class TestConan(ConanFile):
build_policy = "never"
def package(self):
self.copy("*.h", src="src", dst="include")
""")
client.save({CONANFILE: conanfile,
"src/header.h": "contents"})
client.run("export-pkg . pkg/1.0@")
assert "pkg/1.0 package(): Packaged 1 '.h' file: header.h" in client.out

client.run("install pkg/1.0@ --build")
assert "pkg/1.0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache" in client.out
assert "pkg/1.0: Calling build()" not in client.out

0 comments on commit 377bcd8

Please sign in to comment.