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

import from symbolic #bindirs, #libdirs, etc #6208

merged 3 commits into from Dec 20, 2019


Copy link

@memsharded memsharded commented Dec 11, 2019

Changelog: Feature: imports functionality can import from "symbolic" names, preceded with @, like @bindirs, @libdirs, etc. This allows importing files from variable package layouts, including custom package_info() layouts (like cpp_info.bindirs = ["mybin"] can be used with src="@bindirs"), and editable package layouts

Docs: conan-io/docs#1547

Related: #4466

@memsharded memsharded requested a review from jgsogo Dec 11, 2019
@memsharded memsharded added this to the 1.22 milestone Dec 11, 2019
Copy link

@jgsogo jgsogo left a comment

Something needed 👍 I would say it closes #5928 as it provides a much better way to solve the issue.

The only ther character I can think about is / because it is invalid in a directory/file name, and it also doesn't make sense at the beginning of the string. Another alternative could be cpp_info..

cpp_info_dirs = getattr(cpp_info, dir_name)
except AttributeError:
raise ConanException("Import from unknown package folder '#%s' % dir_name)")
for info_dir in cpp_info_dirs:
Copy link

@jgsogo jgsogo Dec 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can build a list of paths, and then avoid duplicating this code:

if src.startswith("#"):
    source_dirs = cpp_info_dirs
    source_dirs = [src]

for source_dir in source_dirs:
    files = file_copier(....)

Copy link
Member Author

@memsharded memsharded commented Dec 20, 2019

Reviewed and added extra error checking test.

lasote approved these changes Dec 20, 2019
Copy link

@lasote lasote commented Dec 20, 2019

Merging, I need this. but please don't forget the docs

@lasote lasote merged commit 2b45e63 into conan-io:develop Dec 20, 2019
2 checks passed
@memsharded memsharded deleted the feature/imports_symbolic branch Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants