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

[question] Can VirtualRunEnv/VirtualBuildEnv scripts generation be suppressed for deployers? #16117

Open
1 task done
db4 opened this issue Apr 20, 2024 · 5 comments
Open
1 task done

Comments

@db4
Copy link
Contributor

db4 commented Apr 20, 2024

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?

  • I've read the CONTRIBUTING guide
@memsharded
Copy link
Member

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.

@db4
Copy link
Contributor Author

db4 commented Apr 22, 2024

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?

@memsharded
Copy link
Member

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.py with the requires you want instead of the --requires arguments and use it as conan install <path> instead, and define generate() there to deactivate the generation of those files.
  • Write an external deployer to run with --deployer that implements the deactivation

We might be considering other built-ins way to deactivate the environment generation, but not a high priority.

@db4
Copy link
Contributor Author

db4 commented Apr 22, 2024

We might be considering other built-ins way to deactivate the environment generation, but not a high priority.

Ok. Then leave this issue open?

@memsharded
Copy link
Member

yes, can be left open, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants