conan
conan copied to clipboard
[bug] Deployer full_deploy losing the trailing '/' on Virtual Envs generators
Environment details
- Operating System+version: Windows
- Conan version: 2.0.15
- Python version: 3.9.13
Steps to reproduce
- conanfile:
from conan import ConanFile from conan.tools.layout import basic_layout from conan.tools.files import copy from os.path import join as path_join
class DemoRecipe(ConanFile): settings = "os", "compiler", "build_type", "arch" name = "demo_issue" version = "1.0.0.0" exports_sources = "config/*"
def layout(self):
basic_layout(self)
def package(self):
copy(self, "config/*", src=self.source_folder, dst=self.package_folder)
def package_info(self):
self.cpp_info.includedirs = []
self.cpp_info.libs = []
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []
self.runenv_info.define_path("MyPackageConfig", path_join(str(self.folders.base_package), "config", ""))
- run command: conan create .
- run command: conan install --require demo_issue/1.0.0.0
- see that 'MyPackageConfig' path includes the trailing slash inside the VirtualRunEnv file.
- un command: conan install --require demo_issue/1.0.0.0 --deployer=full_deploy.
- see that 'MyPackageConfig' path lost the trailing slash inside the VirtualRunEnv file.
- see that 'MyPackageConfig' path includes the trailing slash inside the VirtualRunEnv file.
Thanks
Logs
No response
Hi @mikirothman
Thanks for your report.
First, I'd like to point out that self.folders.base_package is an undocumented attribute, and as such, it shouldn't be used in recipes at all, because it can be removed or changed at any time, breaking the recipe. Please check https://docs.conan.io/2/introduction.html#stable stability commitment.
see that 'MyPackageConfig' path lost the trailing slash inside the VirtualRunEnv file.
When packages are deployed, the paths are relativized to point to the locally deployed copy, and not to the cache, and for that they need to be normalized first. Paths ending with / are not normalized, so normalization removes it. So this is kind of expected. Could you please clarify why this would be an issue?
Hi
Thanks for the note on self.folders.base_package. I'll use self.package_folder instead.
Well your answer definitely makes sense, We are developing some Plug-ins on top of SDK application. The SDK allows to load the Plugins using environment variables, and those are expected to end with a trailing slash. it seems possible to add this kind of support(add the trailing slash) to the SDK, so I'll try to go that way and fix it on the SDK side.
Sounds good, let us know how it goes. It might be possible to add that trailing slash inside Conan, though it looks like it would be ugly code, but if there are other challenges on your side, let us know.
Maybe we can close this ticket at the moment? if there is no need of action from us, you can re-open or create a new ticket when necessary.