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

Render profile name when using Jinja2 #13721

Merged
merged 4 commits into from
Apr 19, 2023

Conversation

uilianries
Copy link
Member

@uilianries uilianries commented Apr 19, 2023

Parse the profile file name (including its extension) as profile_name for Jinja2 context.

Changelog: Feature: Render the profile file name as profile_name
Docs: conan-io/docs#3180

closes #13698

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries uilianries requested a review from memsharded April 19, 2023 12:29
@memsharded memsharded added this to the 2.0.5 milestone Apr 19, 2023
conans/client/profile_loader.py Show resolved Hide resolved

# default profile should not compute profile_name by default
client.run("install . -pr=default")
assert "conanfile.py: PROFILE NAME: None" in client.out
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not? I would expect the profile name to be PROFILE NAME: default

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I was not clear on this test. We are using a custom conf to store the profile_name, but the profile default is totally clear, so we store nothing.

I just updated it now to provide the default profile with the same content + os=Windows (because the 'build' profile must have a 'os' declared)

Copy link
Member

@AbrilRBS AbrilRBS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conan profiles are not meant to have extensions afaik, but there sure is someone out there using them so +1 :)

Other than @memsharded's comments it lgtm

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@memsharded memsharded merged commit 2a2cddc into conan-io:release/2.0 Apr 19, 2023
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

Successfully merging this pull request may close these issues.

[feature] Add profile_name variable to profile rendering
3 participants