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] expected behavior for export-pkg tools.unzip

See original GitHub issue

Conan version 1.11.1 Windows 10

I was wondering the expected behavior of tools.unzip when using the export-pkg command from outside the conanfile.py’s directory.

So taking the example package source directory and conanfile.py below:

└───some_path
    └───package
         ├───conanfile.py
         └───library.zip
from conans import ConanFile, tools

class ExampleConan(ConanFile):
    name = "library"
    version = "1.0"
    settings = "os", "arch"

    def package(self):
        zip_file = "library.zip"
        tools.unzip(zip_file)
        self.copy("*", dst="bin", src="bin", keep_path=False)

    def package_info(self):
        self.cpp_info.libs = tools.collect_libs(self)

The command below fails during the copy to find the unpacked contents of library.zip as it gets unzipped to the cwd(some_path).

# from outside the package's directory
conan export-pkg some_path/package example/stable

Is this the expected behavior? I got stuck on this thinking the expected behavior was for the library.zip to be unzipped into the same directory as the conanfile.py.

Or maybe another question, is it just ill advised to use export-pkg for my case and I should use exports_sources to export the library.zip and treat the unzip as a build step?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
conanuser1234commented, Mar 5, 2019

Ok great! This makes sense to me. Big thanks for getting my question answered @jgsogo @Johnnyxy

0reactions
memshardedcommented, Mar 5, 2019

Hi all,

It is not clear to me the final conclusion, so please @conanuser1234 (also reference for other readers) take this into account:

  • If library.zip contains pre-compiled binaries (.lib, .a, .so, .dylib, .h, etc), or final artifacts (headers in case of header-only library) to be packaged, then, yes, the way to package them is with conan export-pkg. Please do not use exports_sources for that. In this case, the recipe won’t be building anything with build().

  • If library.zip contains the source-code, then conan export-pkg is useless, and indeed you should use exports_sources or other source method (like SCM). The recipe will have a build() method in which the binary artifacts will be built from source.

I hope this helps. Cheers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cmdline-tools : could not determine SDK root - Stack Overflow
The problem seems to be that the sdkmanager expects to reside in an environment called. /YOURPATH/cmdline-tools/SOMETHING/bin but unpacks to / ...
Read more >
Import solutions - Power Apps | Microsoft Learn
During export of unmanaged solutions, some forms that aren't modified get exported with the attribute unmodified=1 in the form XML of the ...
Read more >
Import & Export Surveys - Qualtrics
Importing a QSF Survey · Navigate to the Survey tab and click Tools. Import Export menu under Tools · Select Import/Export. · Choose...
Read more >
Changelog — conan 1.56.0 documentation
Feature: Improved tools.Git to allow capturing the current branch and enabling the export of a package whose version is based on the branch...
Read more >
Python import: Advanced Techniques and Tips
In this tutorial, you'll learn how to: Use modules, packages, and namespace packages; Handle resources and data files inside your packages; Import modules ......
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