[question] Can VirtualRunEnv/VirtualBuildEnv scripts generation be suppressed for deployers?
What is your question?
I'm exporting files from the Conan cache using conan install --requires=pkg/x.x.x --deployer-package pkg/* and deploy() method in pkg recipe. Everything works as expected except conan install also creates conanbuild*, conanrun*, and deactivate* files in the current directory. Can I suppress their generation?
Have you read the CONTRIBUTING guide?
- [X] I've read the CONTRIBUTING guide
Hi @db4
Yes, I think that if you instantiate VirtualXXXEnv(conanfile) in the deployer, being conanfile the conanfile of the root node of the graph, it will inhibit the creation of those files, in the same way that if you instantiate them (without calling .generate()) in the "consumer" recipe of the graph.
Hi @memsharded Thanks for the answer but I'm afraid I don't quite understand it. My recipe used for deploying is roughly the following:
from conan import ConanFile
from conan.tools.files import copy
import os
class PkgConan(ConanFile):
def requirements(self):
for req in self.conan_data["sources"][self.version]["requirements"]:
self.requires(req)
def deploy(self):
for d in self.dependencies.host.values():
for f in ["bin", "data", "config"]:
if d.package_folder:
copy(self, "*", src=os.path.join(d.package_folder, f),
dst=os.path.join(self.deploy_folder, f))
I create a package and then deploy files using conan install --requires=... --deployer-package .... How to modify the recipe to prevent conanbuild*, conanrun*, and deactivate* generation?
I misunderstood, I thought that you were using an external --deployer
It is not possible to deactivate that from the recipe, you can:
- Define a
conanfile.pywith therequiresyou want instead of the--requiresarguments and use it asconan install <path>instead, and definegenerate()there to deactivate the generation of those files. - Write an external deployer to run with
--deployerthat implements the deactivation
We might be considering other built-ins way to deactivate the environment generation, but not a high priority.
We might be considering other built-ins way to deactivate the environment generation, but not a high priority.
Ok. Then leave this issue open?
yes, can be left open, thanks
This PR https://github.com/conan-io/conan/pull/16863 is adding a conf that disables the generation of those scripts