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

[feature] conditional alias packages #9768

Closed
1 task done
KerstinKeller opened this issue Oct 8, 2021 · 2 comments
Closed
1 task done

[feature] conditional alias packages #9768

KerstinKeller opened this issue Oct 8, 2021 · 2 comments

Comments

@KerstinKeller
Copy link

I would like to be able to make conditional aliases. I would like to use them to model system versions, and require them like:

from conans import ConanFile

class ConsumerConanfile(ConanFile):
    requires = "protobuf/(system)@"

With the current definition, I cannot make aliases depend on settings.

It would be cool to have a set_alias() function (similar to set_name(), set_version() functions).
Or to be able to set the values in configure() instead (which actually also works for the version attribute, instead of using set_version())

from conans import ConanFile

class ProtobufSystemConanfile(ConanFile):
    
    def set_alias(self):
        if self.settings.os.distro = Ubuntu16:
            self.alias = "protobuf/3.0.0@heat-rae/stable"
        else self.settings.os.distro = Ubuntu18:
            self.alias = "protobuf/3.6.1@heat-rae/stable"
        else:
           # throw invalidConfigurationException
@memsharded
Copy link
Member

This seems to be a duplicate of #9510

@KerstinKeller
Copy link
Author

Ah ok, I'll close this in favor of the other issue.

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