[question] Porting 1.x imports() to 2.0
See original GitHub issueI’m following Conan migration guide to 2.0. It contains the following recommended pattern that I expected to work everywhere:
from conan.tools.files import copy
def generate(self):
for dep in self.dependencies.values():
copy(self, "*.dylib", dep.cpp_info.libdirs[0], self.build_folder)
copy(self, "*.dll", dep.cpp_info.libdirs[0], self.build_folder)
Unfortunately self.build_folder
is set only in 2.0 and is None in 1.x so for 1.x I have to use self.build_folder
that in turn doesn’t exist in 2.0. The following code works:
def generate(self):
cpp_info = self.dependencies["some_dependency"].cpp_info
dst = self.build_folder if self.build_folder else self.folders.build
rootpath = os.path.dirname(cpp_info.bindirs[0])
copy(self, "*.dat", rootpath, dst=dst)
but I would prefer something working out of the box. BTW, why rootpath
attribute is excluded from the new dependency model?
- I’ve read the CONTRIBUTING guide.
Issue Analytics
- State:
- Created a year ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Porting Apache:: Perl Modules from mod_perl 1.0 to 2.0
This document describes the various options for porting a mod_perl 1.0 Apache module so that it runs on a Apache 2.0 / mod_perl...
Read more >Ansible 2.0 Porting Guide
This section discusses the behavioral changes between Ansible 1.x and Ansible 2.0. It is intended to assist in updating your playbooks, plugins and...
Read more >Upgrading from 1.x — Fabric documentation
All useful imports are now available at the top level, e.g. from fabric import Connection . Configure connection parameters globally (via env.host_string ,...
Read more >Multi-Targeting and Porting a .NET Library to .NET Core 2.0
In this post I describe porting an existing full framework library to . NET Core 2.0 and multi-targeting the project to support ....
Read more >Porting Python 2 Code to Python 3 — Python 3.11.1 ...
If you are looking to port an extension module instead of pure Python code, ... some instances or have to import a function...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @db4, Sorry for the delay in answering back. Yes, after seeing your use case, I think it makes sense that this is available in the test_package as well. I’ll mark this for the next release to have a look. Thanks!
Fixed by https://github.com/conan-io/conan/pull/12443 to be released in 1.54