-
Notifications
You must be signed in to change notification settings - Fork 989
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
proposal for deploy() feature (#15172)
* proposal for deploy() feature * rename argument --deploy-package * rename arg
- Loading branch information
1 parent
f0a1b35
commit 29e9f95
Showing
5 changed files
with
67 additions
and
6 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
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
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,46 @@ | ||
import textwrap | ||
|
||
from conans.test.utils.tools import TestClient | ||
|
||
|
||
def test_deploy_method(): | ||
c = TestClient() | ||
conanfile = textwrap.dedent(""" | ||
import os | ||
from conan import ConanFile | ||
from conan.tools.files import copy, save | ||
class Pkg(ConanFile): | ||
name = "{name}" | ||
version = "0.1" | ||
{requires} | ||
def package(self): | ||
save(self, os.path.join(self.package_folder, f"my{name}file.txt"), "HELLO!!!!") | ||
def deploy(self): | ||
copy(self, "*", src=self.package_folder, dst=self.deploy_folder) | ||
""") | ||
c.save({"dep/conanfile.py": conanfile.format(name="dep", requires=""), | ||
"pkg/conanfile.py": conanfile.format(name="pkg", requires="requires='dep/0.1'")}) | ||
c.run("create dep") | ||
assert "Executing deploy()" not in c.out | ||
c.run("create pkg") | ||
assert "Executing deploy()" not in c.out | ||
|
||
# Doesn't install by default | ||
c.run("install --requires=pkg/0.1") | ||
assert "Executing deploy()" not in c.out | ||
|
||
# Doesn't install with other patterns | ||
c.run("install --requires=pkg/0.1 --deployer-package=other") | ||
assert "Executing deploy()" not in c.out | ||
|
||
# install can deploy all | ||
c.run("install --requires=pkg/0.1 --deployer-package=* --deployer-folder=mydeploy") | ||
assert "dep/0.1: Executing deploy()" in c.out | ||
assert "pkg/0.1: Executing deploy()" in c.out | ||
assert c.load("mydeploy/mydepfile.txt") == "HELLO!!!!" | ||
assert c.load("mydeploy/mypkgfile.txt") == "HELLO!!!!" | ||
|
||
# install can deploy only "pkg" | ||
c.run("install --requires=pkg/0.1 --deployer-package=pkg/* --deployer-folder=mydeploy") | ||
assert "dep/0.1: Executing deploy()" not in c.out | ||
assert "pkg/0.1: Executing deploy()" in c.out |