conan: [bug] self.package_folder is None in package_info() if layout() is used

Environment Details (include every applicable attribute)

  • Conan version: 1.52.0, 1.53.0
  • Python version: 3.10

Steps to reproduce (Include if Applicable)

Create a conan file like so:

    def package_info(self):
        bin_path = os.path.join(self.package_folder, "bin")

    def layout(self):
        cmake_layout(self)

Set package in editable mode

install with CMakeDeps and CmakeToolchain generator:

conan install package/0.1@blah/blah -g CMakeDeps -g CMakeToolchain

Logs (Executed commands with output) (Include/Attach if Applicable)

ERROR: package/0.1@blah/blah : Error in package_info() method, line 228
        bin_path = os.path.join(self.package_folder, "bin")
        TypeError: expected str, bytes or os.PathLike object, not NoneType

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 25 (19 by maintainers)

Most upvoted comments

Ok, so this is the requirement:

  • We need to define a way, to specify a environment variable in an abstract way, so it can point to a file inside the build tree in editable layout and to a file inside the package in cache layout, so it gets the full correct path in the consumer side.

We certainly need to think about this, doesn’t seem an easy feature, as it requires some similar generalization and management like the one happening for cpp_info.