conan v1.6.1, Windows 10, Python 3.6
I'm moving our codebase to conan packages and encountered following error. I have to specify not single directory in scm.subfolder attribute, but multiple ones:
scm = {
"type": "git",
"subfolder": "foo/baz/bar",
"url": "auto",
"revision": "auto",
}
The reason is that I shouldn't change paths in #include directives today and I will update paths in the future.
With such recipe conan fails to build missing packages, i.e.
conan install . --build missing fails with an strange error:
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\.conan2\\gk8g1phl\\1\\foo\\baz\bar
I think that source of this problem is this line:
https://github.com/conan-io/conan/blob/develop/conans/client/tools/scm.py#L20
Could you call os.makedirs instead of os.mkdir?
We need to check it, but yes, it seems that changing to the os.makedirs() could fix this issue, lets have a look. Please upgrade to conan 1.7, it includes some updates to the SCM, so better check it with it too.
As a workaround, you might want to use 1 level subfolder, and then package the includes removing the unnecessary intermediate subfolders, something like:
def package(self):
self.copy("*.h", src="baz/bar", dst="include")
Thank you!
I've checked the issue and it exists in conan v1.7.0 too.
Yes, I'm copying .h files properly in package function. The problem is that header files improperly references themselves from sources in this library (like #include <bla/foo/baz/bar/file.h and I can't change it now) and other C++ modules references the same headers in the same way. So I have to set include paths as self.cpp_info.includedirs = ["."]
Well, if you want to not have the headers in the root of the package you could always try something like:
def package(self):
self.copy("*.h", src="bla/foo/baz/bar", dst="include/bla/foo/baz/bar")
#or maybe this works, because by default it keeps relative paths:
self.copy("*.h", src="bla/", dst="include/bla/")
def package_info(self):
self.cpp_info.includedirs = ["include"]
In any case, we will have a look to the subfolder scm issue, this is just an unrelated suggestion. Thanks!
I'm able to reproduce the issue (Mac, conan 1.7, py3), @wizardsd, thanks for the detailed explanation.
Just in case anyone wants to reproduce it I've created a toy project (https://github.com/jgsogo/conan-issue3423/blob/master/conanfile.py), uploaded it to a remote and then:
conan remote add jgsogo https://api.bintray.com/conan/jgsogo/conan-packages
conan install issue3423/0.0@issue/test --build=issue3423
output:
ERROR:
FileNotFoundError: [Errno 2] No such file or directory: '<edited>/.conan/data/issue3423/0.0/issue/test/source/hello/to/you'
With the modification you suggested, it works 馃憤. I will check a little bit more just in case something else is affected.
Thanks!
Will be released in 1.7.1
Released, please try and report. Thanks
Thank you, guys! It works as expected!
Most helpful comment
Thank you, guys! It works as expected!