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
Environment variable to set [general]default_profile #3193
Comments
Should be an easy to implement feature, something like: "CONAN_BASH_PATH": self._env_c("general.bash_path", "CONAN_BASH_PATH", None),
```
in ``ConanClientConfigParser`` |
I think that it will be enough to modify the line where default profile is retrieved: class ConanClientConfigParser(ConfigParser, object):
...
@property
def default_profile(self):
try:
return self.get_item("general.default_profile")
except ConanException:
return DEFAULT_PROFILE_NAME to something like class ConanClientConfigParser(ConfigParser, object):
...
@property
def default_profile(self):
return self._env_c("general.default_profile", "CONAN_ENV_DEFAULT_PROFILE", DEFAULT_PROFILE_NAME) but I'm afraid it could interfere with existing behavior (I've created a branch and marked a couple of places where there can be a problem). |
We've been discussing a little me and @jgsogo sogo and probably the most reasonable is:
|
That seems like a good way to resolve the tension. I'm definitely only wanting a way to change which (exisiting) profile is used by default, not a way to change where the profile created by autodetection is stored. In fact I didn't intend to set it to an absolute path, just the name (which would then be searched/resolved as usual). In fact, in my situation (many cross-toolchains, and profiles that set up PATH/PKG_CONFIG_LIBDIR/etc accordingly) I'd really rather that conan never autodetect (except when I explicitly asked it to with |
Yes, this might be a good practice to make sure you are always calling your own profiles. Not something we can do without breaking the world. You know that |
Oh, I agree it's a special case, and the current behavior is the right default. And yes, we already use conan config install to share some parts of our profiles (though they rely in include files to tell, though it's a bit of a hassle that this doesn't support authentication (since that precludes just pushing the config zip into artifactory, where everything else gets distributed). |
Recently, the |
Why did this end up being required to be an absolute path? Espescially if it's required to exist, why not just resolve relative paths against $CONAN_USER_HOME/.conan/profiles, like [general]default_profile, |
That is a good point. I think it should be consistent with the way it is specified in |
Yes, conan.conf allows default_profile = name or default_profile = subfolder/name
It seems like the environment variable should be like conan.conf here; relative to $CONAN_USER_HOME/.conan/profiles, but never checking the cwd. |
Thanks! |
To help us debug your issue please explain:
This idea was initially proposed at #1221 (comment)
It would be nice if there was an environment variable (perhaps
CONAN_DEFAULT_PROFILE
?) which, if set, would override[general]default_profile
fromconan.conf
. In an IDE workflow, a project file might be set up to obtain its own dependencies by callingconan install
(e.g. https://github.com/conan-io/cmake-conan), but it feels wrong to hard-code a desired profile into the call to conan install. Most project systems like this support multiple configurations (e.g. Qt Creator has kits, MSVC supports setting up multiple configurations. conan_cmake_settings(...) makes an effort to reverse-engineer the settings from the compiler detection variables, but it's not particularly complete, and in any case a sophisticated profile might have content (e.g. build_requires for toolchains) arguably could never get in this fashion.IDE features to define a build template like this usually have a mechanism to add environment variables to the build invocation, and a way to set the default profile through the environment seems consistent with the existing ability to override specific settings from it using CONAN_ENV_XXXX_YYYY.
The text was updated successfully, but these errors were encountered: