conan-io / conan-io/docs

[question] conan 2 Why is layout influencing the copy in packge() when export-pkg?

Open
#4,046 5 comments 0 reactions 1 assignee Claimed by @memsharded View on GitHub
type: question
Dominant language
C++
Stars
125
Forks
382
Avg merge
22h 39m
Merged PRs (30d)
21

Description

### What is your question?

Hi,
we had a simple package recipe:
```
import os
from conan.tools.files import copy
from conan import ConanFile

class QtNodesConan(ConanFile):
name = "qtnodes"
...
settings = "os", "compiler", "arch"
package_type = "shared-library"
build_policy = "never" # current conan doesn't allow for building locally in our setup

def configure(self):
self.settings.rm_safe("compiler.cppstd")

def package(self):
copy(self, "*", "./install/", self.package_folder)

def package_info(self):
self.cpp_info.libs = ["QtNodes"]
```
On CI we are using something like:
```
cmake --build ./build --target INSTALL --config Release
conan export-pkg . --user lexocad --channel prebuild --version ${env:FT_VERSION_NUMBER} -pr=lx
```

This worked fine until my colleague needed to do some local deployment where we usually use out-of-source builds and he added a layout so he could use editable mode:
```
def layout(self):
self.folders.build = "../build"

# In the local folder (when the package is in development, or "editable") the artifacts can be found:
self.cpp.build.libdirs = ["lib/RelWithDebInfo"]
self.cpp.build.libs = ["QtNodes"]
```
With this, the CI build stopped working because it seems the layout is interfering with the copy function in the package invoked by `conan export-pkg`. I have looked into the documentation for layout, copy tool, and export-pkg but I have not found any mention of this interaction.

Why is it interfering? Can it be changed somehow? What is the prefix for the copy tool's relative path, could I somehow simply do something there so it works with the layout function defined here?

Thanks

conan version 2.12.2

### Have you read the CONTRIBUTING guide?

- [ ] I've read the CONTRIBUTING guide

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.