Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] conan install only considers exports_sources #7377

Closed
pwaehnert opened this issue Jul 17, 2020 · 4 comments · Fixed by #7380
Closed

[bug] conan install only considers exports_sources #7377

pwaehnert opened this issue Jul 17, 2020 · 4 comments · Fixed by #7380

Comments

@pwaehnert
Copy link

Environment Details (include every applicable attribute)

  • Conan version: 1.26.0+

Steps to reproduce (Include if Applicable)

Put a dummy.txt next to the following conanfile.py in some directory.

# conanfile.py
from conans import ConanFile
from os.path import isfile


class ExportSourcesTestConan(ConanFile):
    name = "export-sources-test"
    version = "1.0"
    settings = None
    #exports_sources = "dummy.txt",

    def export_sources(self):
        self.copy("dummy.txt")

    def build(self):
        if not isfile("dummy.txt"):
            raise RuntimeError("Oh no!")

Create and upload the package

$ conan create . user/testing
$ conan upload -r <remote> export-sources-test/1.0@user/testing

Remove the package from the local cache and install it from your remote:

$ conan remove export-sources-test*
$ conan install export-sources-test/1.0@user/testing --build missing

If the conanfile.py uses export_sources() the build step will raise the exception. If exports_sources is used, the build step succeeds.

Cause

The function complete_recipe_sources() in client/source.py only tests whether conanfile.exports_sources is defined. If only export_sources() is defined the sources won't be downloaded and the source directory stays empty.

Workaround

Defining both exports_sources and export_sources() triggers the download of the sources. But it would be nice to use export_sources() completely independent from exports_sources.

@memsharded
Copy link
Member

Thanks very much for your complete report and detailed investigation. Indeed a bug that needs to be fixed.
You were just one if from a Pull Request, next time don't hesitate to submit it, we can help with the testing if necessary :)

I have contributed the fix in #7380, planned for next release (Conan 1.28)

@pwaehnert
Copy link
Author

You're welcome. I'm amazed how quick you're with feedback to new issues. Great work!

@memsharded
Copy link
Member

No problem, thanks to you for reporting! Let's keep the issue open it will be automatically closed when the PR is merged to develop.

@memsharded memsharded reopened this Jul 17, 2020
@pwaehnert
Copy link
Author

Sorry, didn't know that. I thought only issue #7380 is bound to the pull request and this issue here thus obsolete. That's why I closed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants