-
Notifications
You must be signed in to change notification settings - Fork 990
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
Improve conan inspect
output, it now understands set_name
/set_version
#13716
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cb5b508
Initial inspect sketch
AbrilRBS 3ac2f0f
Different approaches
AbrilRBS 2c0933e
Go for serialize(). Sort shown keys. Serialize user, name, version, d…
AbrilRBS 93c93b3
Add more info to inspect
AbrilRBS 05356de
Make topics serialize as a list, helps inspect and graph in their jso…
AbrilRBS af17449
Allow partial lockfiles
AbrilRBS 487c9c3
Add remote python_require(_extend) test
AbrilRBS a84e523
Fix tests
AbrilRBS b355724
Add requires serialization
AbrilRBS 67fefb2
More tests, serialize ref in requirements
AbrilRBS ae728ec
No need to specify key
AbrilRBS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
from conans.model.options import Options | ||
|
||
from conans.model.requires import Requirements | ||
from conans.model.settings import Settings | ||
|
||
|
||
class ConanFile: | ||
|
@@ -121,17 +122,32 @@ def __init__(self, display_name=""): | |
def serialize(self): | ||
result = {} | ||
|
||
for a in ("url", "license", "author", "description", "topics", "homepage", "build_policy", | ||
"upload_policy", | ||
"revision_mode", "provides", "deprecated", "win_bash", "win_bash_run"): | ||
v = getattr(self, a) | ||
for a in ("name", "user", "channel", "url", "license", | ||
"author", "description", "homepage", "build_policy", "upload_policy", | ||
"revision_mode", "provides", "deprecated", "win_bash", "win_bash_run", | ||
"default_options", "options_description",): | ||
v = getattr(self, a, None) | ||
if v is not None: | ||
result[a] = v | ||
|
||
if self.version is not None: | ||
result["version"] = str(self.version) | ||
if self.topics is not None: | ||
result["topics"] = list(self.topics) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not happy about this, but some tests were failing when calling |
||
result["package_type"] = str(self.package_type) | ||
result["settings"] = self.settings.serialize() | ||
|
||
settings = self.settings | ||
if settings is not None: | ||
result["settings"] = settings.serialize() if isinstance(settings, Settings) else list(settings) | ||
|
||
result["options"] = self.options.serialize() | ||
result["options_definitions"] = self.options.possible_values | ||
|
||
if self.generators is not None: | ||
result["generators"] = list(self.generators) | ||
if self.license is not None: | ||
result["license"] = list(self.license) if not isinstance(self.license, str) else self.license | ||
|
||
result["requires"] = self.requires.serialize() | ||
if hasattr(self, "python_requires"): | ||
result["python_requires"] = [r.repr_notime() for r in self.python_requires.all_refs()] | ||
result["system_requires"] = self.system_requires | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this lambda? Not very intuitive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While playing with the output I realized it would be insertion-order dependant and implemented a sort on the items to have them show up alphabetically. Maybe we want to have a custom order and just have to be carefurl about when we insert the result in the serialization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not sure.
sorted(mydict.items())
already sorts by the first element (key), no need for the lambda