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 : provide Path accesssors #11585
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some basic integration
test that checks these added methods.
conans/model/conan_file.py
Outdated
@property | ||
def install_folder(self): | ||
# FIXME: Remove in 2.0, no self.install_folder | ||
return self.folders.base_install | ||
|
||
@property | ||
def install_path(self) -> Path: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one disappears in 2.0, better remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
conans/model/conan_file.py
Outdated
@property | ||
def imports_folder(self): | ||
return self.folders.imports_folder | ||
|
||
@property | ||
def imports_path(self) -> Path: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one disappears in 2.0, better remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
conans/model/layout.py
Outdated
@@ -129,6 +149,11 @@ def imports_folder(self): | |||
|
|||
return os.path.join(self._base_imports, self.imports) | |||
|
|||
@property | |||
def imports_path(self) -> Path: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one disappears in 2.0, better remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
conans/model/layout.py
Outdated
@@ -1,7 +1,7 @@ | |||
import os | |||
|
|||
from conans.model.new_build_info import NewCppInfo | |||
|
|||
from pathlib import Path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say that the Folders
xxxx_folder
are not intended nor documented for users yet.
If anything we want to replace the xxx_folder
for the path alternatives. But this is not necessary in this PR, as this is intended only for user recipes which is always self.xxxx_path
, and not self.folders.xxxx_path
.
So maybe leave this file untouched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I left it untouched
Signed-off-by: SSE4 <tomskside@gmail.com>
added (updated an existing test with more checks) |
Out of curiosity: why not to change existing fields but add new ones? What are the potential issues with changing the type? |
it may break existing recipes. e.g. the one doing something like |
Thank you for quick reply. That part I have figured out. Was more interested if there are recipes which do this and why. In my limited python experience calling |
I don't know any recipe doing it out of my mind. still, it's possible, some recipe does nethertheless, there could be other breaking cases, e.g.:
will crash if for sure it could be changed in 2.0, but for 1.x I would say it's too risky. |
I am merging this because it is done, but after talking to the team, please let me clarify:
Thanks for understanding |
closes: #11304
Changelog: Feature: Provide Path accessors in Conanfile.
Docs: omit
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.