Closed Niketin closed 1 month ago
Hi @Niketin
Thanks for your question.
Yes, there are some cases in which a self.package_folder
can be None.
This happens when the binary for a given package is marked as Skip
. You should be able to see that in the output of the Conan command, when the different package actions (Cache, Download, Update, Build and Skip) are defined. If you share the command output it should be visible there.
The Skip
situation happens when the binary is not necessary, for example if you tool_requires
an application that depends requires
on a static library, retrieving the application binary is enough, it is not necessary to download the static library binary, and it will be skipped to save the download transfer time.
There are mechanisms to force the download of all binaries (via conf
), but the recommended approach for deployers is to check for .package_folder is not None
before doing any action on them (we might need to add some clarifications or explicit examples in the docs).
Please let me know if this clarifies it.
This clarifies it @memsharded.
My intention is to:
Step 1 is easy with conan create
. I tried to complete step 2 with conan install <recipe> [<option> ...]
but I misunderstood one thing. It only deploys the dependencies in the recipe, not the package itself. Am I correct? How can I achieve step 2?
I want to avoid copying artifacts manually from the cache, as suggested in the highlighted bullet point in the picture below.
I got it now working. I used the conan install
with --require
to my desired package and no recipes. From the different deployers built in, the direct_deploy
is most fit to my case.
Example:
conan install --require "asd_driver/<exact_version>" -pr:a <path_to_profile> --deployer="direct_deploy" --deployer-folder <arbitrary_directory>
I used some powershell to automatically get the name and version from the current recipe.
$json = conan inspect driver -f json | ConvertFrom-Json
$ref = "$($json.name)/$($json.version)"
and $ref
now contains the string <recipe_name>/<version>
e.g. asd_driver/1.1.1-5-g622361f-dirty
.
Thank you @memsharded for the initial reply.
Step 1 is easy with conan create. I tried to complete step 2 with conan install
[
It works by using the created package, not the local recipe in user folder (which is not a package). So conan install --requires=mypkg/version
instead of conan install <path-to-recipe>
.
I got it now working. I used the conan install with --require to my desired package and no recipes. From the different deployers built in, the direct_deploy is most fit to my case.
Yes, exactly, you got it. Only packages in the cache can be deployed, local recipes are not packages, so they cant (they might not even have built binaries locally).
I used some powershell to automatically get the name and version from the current recipe.
Probably can avoid using the extra conan inspect
, use conan create --format=json > graph.json
, and then read the json["graph"]["nodes"]["1"]["ref"]
value (this can easily be done with jq
for example
If everything is clear now, maybe we can close this ticket as resolved?
Yes, definitely. Thank you so much!
Great, thanks very much to you for the feedback!
What is your question?
Hi! I am using Conan version 2.8.0 from PyPI. I have created a package, and I want to deploy it to a directory of my choice. I noticed, that during deploy with command
conan install driver -pr:a conan/profiles/driver --deployer-package=* --deployer-folder .
I get this exceptionand that copy statement is the only statement in the method. Am I doing something wrong? Why is the
self.package_folder
definedNone
here? I am trying to follow the example from docs for deployment. Building and packaging works just fine.I can see that the
self.package_folder
is defined duringconan create
but not duringconan install
. Is this a bug or a user error?Thanks!
Cleaned version of the Conanfile.py that I use.
Have you read the CONTRIBUTING guide?