Bug 226024

Summary: [webkitcorepy] Add shared terminal input code
Product: WebKit Reporter: Jonathan Bedard <jbedard>
Component: Tools / TestsAssignee: Jonathan Bedard <jbedard>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, dewei_zhu, ews-watchlist, glenn, slewis, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=225985
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch for landing none

Description Jonathan Bedard 2021-05-20 09:14:28 PDT
Python 2 and 3 have slightly different stdin input functions, we should have shared code that centralizes these differences. In developing https://bugs.webkit.org/show_bug.cgi?id=225985, I found myself building a Yes/No command line input picker multiple times, that seems like something that should be shared as well.
Comment 1 Radar WebKit Bug Importer 2021-05-20 09:15:39 PDT
<rdar://problem/78261645>
Comment 2 Jonathan Bedard 2021-05-20 09:19:29 PDT
Created attachment 429178 [details]
Patch
Comment 3 Jonathan Bedard 2021-05-21 16:44:23 PDT
Created attachment 429362 [details]
Patch
Comment 4 Jonathan Bedard 2021-06-14 10:56:36 PDT
Created attachment 431344 [details]
Patch
Comment 5 Jonathan Bedard 2021-07-28 13:59:37 PDT
Created attachment 434461 [details]
Patch
Comment 6 Jonathan Bedard 2021-08-03 17:20:04 PDT
Created attachment 434873 [details]
Patch
Comment 7 dewei_zhu 2021-08-04 10:02:58 PDT
Comment on attachment 434461 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=434461&action=review

r=me

> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/terminal.py:32
> +    def choose(cls, prompt, options=None, default=None, strict=False, numbered=False):

Is this used any where other than unit tests?
Comment 8 Jonathan Bedard 2021-08-04 10:03:58 PDT
(In reply to dewei_zhu from comment #7)
> Comment on attachment 434461 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=434461&action=review
> 
> r=me
> 
> > Tools/Scripts/libraries/webkitcorepy/webkitcorepy/terminal.py:32
> > +    def choose(cls, prompt, options=None, default=None, strict=False, numbered=False):
> 
> Is this used any where other than unit tests?

Not yet, but https://bugs.webkit.org/show_bug.cgi?id=225985 uses it. Patch for that change is up, needs some clean up before review, though.
Comment 9 Jonathan Bedard 2021-08-04 10:15:22 PDT
Comment on attachment 434461 [details]
Patch

Need to bump webkitcorepy version.
Comment 10 Jonathan Bedard 2021-08-04 10:26:23 PDT
Created attachment 434911 [details]
Patch for landing
Comment 11 EWS 2021-08-04 10:58:59 PDT
Committed r280640 (240253@main): <https://commits.webkit.org/240253@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 434911 [details].