-
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
Changes from 9 commits
cb5b508
3ac2f0f
2c0933e
93c93b3
05356de
af17449
487c9c3
a84e523
b355724
67fefb2
ae728ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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,25 @@ 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", "generators", "requires"): | ||
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. Serialization of the |
||
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 | ||
result["settings"] = settings.serialize() if isinstance(settings, Settings) else settings | ||
result["options"] = self.options.serialize() | ||
result["options_definitions"] = self.options.possible_values | ||
|
||
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 | ||
|
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