-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Describe the bug
env. variables defined in package_info (runenv_info), cannot be overriden in layout method using self.layouts.source.runenv_info.define_path("SOME_PATH", "src")
How to reproduce it
Let's we have two packages library:
from conan import ConanFile
from conan.tools.files import copy
from conan.tools.layout import basic_layout
class mylibRecipe(ConanFile):
name = "mylib"
version = "0.1"
# Sources are located in the same place as this recipe, copy them to the recipe
exports_sources = "src/*"
def layout(self):
basic_layout(self)
self.layouts.build.runenv_info.define_path("SOME_PATH", "src")
def build(self):
pass
def package(self):
copy(self, "1.txt", self.source_folder, self.package_folder)
def package_info(self):
self.runenv_info.define_path("SOME_PATH", self.package_folder)and there is a src folder with some files(1.txt for example).
Here is consumer package:
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.env import VirtualBuildEnv, VirtualRunEnv
from conan.tools.layout import basic_layout
class consumerRecipe(ConanFile):
name = "consumer"
version = "0.1.0"
requires = ("mylib/0.1",)
def layout(self):
basic_layout(self)
def generate(self):
env = VirtualBuildEnv(self)
env.generate()
run = VirtualRunEnv(self)
run.generate()
def build(self):
pass
def package(self):
pass- Add mylib as editable
- Run conan install . on consumer
- Look at
build/conan/conanrunenv.sh - SOME_PATH will be set root folder of mylib package
- Comment out
package_infomethod and run above again - SOME_PATH will be set correctly to
mylib/src