question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] Porting 1.x imports() to 2.0

See original GitHub issue

I’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?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
czoidocommented, Nov 2, 2022

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!

0reactions
memshardedcommented, Nov 3, 2022

Fixed by https://github.com/conan-io/conan/pull/12443 to be released in 1.54

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found