WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
222329
[check-webkit-style] Fix Contributor sorting in Python 3
https://bugs.webkit.org/show_bug.cgi?id=222329
Summary
[check-webkit-style] Fix Contributor sorting in Python 3
Jonathan Bedard
Reported
2021-02-23 12:52:24 PST
Sorting of contributors is broken in Python 3, making it difficult for new contributors to add themselves to contributors.json.
Attachments
Patch
(4.36 KB, patch)
2021-02-23 12:56 PST
,
Jonathan Bedard
no flags
Details
Formatted Diff
Diff
Patch
(3.82 KB, patch)
2021-02-23 12:58 PST
,
Jonathan Bedard
no flags
Details
Formatted Diff
Diff
Patch
(4.19 KB, patch)
2021-02-23 13:25 PST
,
Jonathan Bedard
dewei_zhu: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-02-23 12:52:38 PST
<
rdar://problem/74656667
>
Jonathan Bedard
Comment 2
2021-02-23 12:56:17 PST
Created
attachment 421344
[details]
Patch
Jonathan Bedard
Comment 3
2021-02-23 12:58:15 PST
Created
attachment 421345
[details]
Patch
Darin Adler
Comment 4
2021-02-23 13:04:29 PST
Comment on
attachment 421345
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=421345&action=review
> Tools/Scripts/webkitpy/common/config/committers.py:99 > + cmp = hash(getattr(self, member)) - hash(getattr(other, member))
Sorting by hashes doesn’t seem like a good idea if we want the sorting to stay stable in the future.
Jonathan Bedard
Comment 5
2021-02-23 13:11:05 PST
(In reply to Darin Adler from
comment #4
)
> Comment on
attachment 421345
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=421345&action=review
> > > Tools/Scripts/webkitpy/common/config/committers.py:99 > > + cmp = hash(getattr(self, member)) - hash(getattr(other, member)) > > Sorting by hashes doesn’t seem like a good idea if we want the sorting to > stay stable in the future.
Was trying to avoid iterating through the lists, but I guess we probably should.
Jonathan Bedard
Comment 6
2021-02-23 13:25:11 PST
Created
attachment 421346
[details]
Patch
Jonathan Bedard
Comment 7
2021-02-23 13:41:08 PST
This is the stack trace we get if you modify contributors.json then call check-webkit-style: File "/Volumes/Shared/CheckoutBeta/OpenSource/Tools/Scripts/check-webkit-style", line 46, in <module> sys.exit(CheckWebKitStyle().main()) File "/Volumes/Shared/CheckoutBeta/OpenSource/Tools/Scripts/webkitpy/style/main.py", line 159, in main patch_checker.check(patch) File "/Volumes/Shared/CheckoutBeta/OpenSource/Tools/Scripts/webkitpy/style/patchreader.py", line 86, in check self._text_file_reader.process_file(file_path=path, line_numbers=line_numbers) File "/Volumes/Shared/CheckoutBeta/OpenSource/Tools/Scripts/webkitpy/style/filereader.py", line 137, in process_file self._processor.process(lines, file_path, **kwargs) File "/Volumes/Shared/CheckoutBeta/OpenSource/Tools/Scripts/webkitpy/style/checker.py", line 1027, in process checker.check(lines) File "/Volumes/Shared/CheckoutBeta/OpenSource/Tools/Scripts/webkitpy/style/checkers/contributors.py", line 42, in check canonicalized = CommitterList().as_json() File "/Volumes/Shared/CheckoutBeta/OpenSource/Tools/Scripts/webkitpy/common/config/committers.py", line 244, in as_json result = CommitterList._contributor_list_to_dict(self._contributors) File "/Volumes/Shared/CheckoutBeta/OpenSource/Tools/Scripts/webkitpy/common/config/committers.py", line 239, in _contributor_list_to_dict for contributor in sorted(list): TypeError: '<' not supported between instances of 'Contributor' and 'Reviewer'
Jonathan Bedard
Comment 8
2021-02-23 16:26:42 PST
Committed
r273358
(
234491@main
): <
https://commits.webkit.org/234491@main
>
Sam Sneddon [:gsnedders]
Comment 9
2021-02-24 10:36:32 PST
FWIW, in general I'd suggest using functools.total_ordering() rather than manually defining all the comparison operations.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug