Пример #1
0
    def setUp(self):
        client = TestClient(default_server_user=True)
        # Important to activate revisions
        self.client = client
        client.save({"conanfile.py": GenConanfile("PkgA", "0.1")})
        client.run("create . PkgA/0.1@user/channel")
        client.run("upload PkgA/0.1@user/channel --all")

        consumer = textwrap.dedent("""
            from conans import ConanFile
            class Pkg(ConanFile):
                name = "PkgB"
                version = "0.1"
                requires = "PkgA/0.1@user/channel"
                def build(self):
                    self.output.info("BUILD DEP LIBS: %s!!" % ",".join(self.deps_cpp_info.libs))
                def package_info(self):
                    self.output.info("PACKAGE_INFO DEP LIBS: %s!!"
                                     % ",".join(self.deps_cpp_info.libs))
            """)
        client.save({"conanfile.py": str(consumer)})
        client.run("install . PkgB/0.1@user/channel")

        self._check_lock("PkgB/0.1@user/channel")

        # If we create a new PkgA revision, for example adding info
        pkga = GenConanfile("PkgA", "0.1")
        pkga.with_package_info(cpp_info={"libs": ["mylibPkgA0.1lib"]},
                               env_info={"MYENV": ["myenvPkgA0.1env"]})
        client.save({"conanfile.py": pkga})

        client.run("create . PkgA/0.1@user/channel")
        client.save({"conanfile.py": str(consumer)})
Пример #2
0
 def recipe_cache(self, reference, requires=None):
     ref = ConanFileReference.loads(reference)
     conanfile = GenConanfile()
     if requires:
         for r in requires:
             conanfile.with_require(r)
     conanfile.with_package_info(
         cpp_info={"libs": ["mylib{}{}lib".format(ref.name, ref.version)]},
         env_info={"MYENV": ["myenv{}{}env".format(ref.name, ref.version)]})
     self._put_in_cache(ref, conanfile)