Bug 220200 - Update root level scripts in Tools/Scripts to Python 3
Summary: Update root level scripts in Tools/Scripts to Python 3
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-12-30 12:08 PST by Alexey Proskuryakov
Modified: 2021-01-05 10:44 PST (History)
4 users (show)

See Also:


Attachments
proposed patch (40.33 KB, patch)
2020-12-30 12:11 PST, Alexey Proskuryakov
darin: review+
jbedard: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2020-12-30 12:08:19 PST
Quite a few are still Python 2.
Comment 1 Alexey Proskuryakov 2020-12-30 12:11:06 PST
Created attachment 416849 [details]
proposed patch
Comment 2 Darin Adler 2021-01-02 14:31:25 PST
Comment on attachment 416849 [details]
proposed patch

I’m assuming these changes are all compatible with both Python 2 and Python 3 even though the comment doesn’t say that specifically.
Comment 3 Alexey Proskuryakov 2021-01-05 08:51:25 PST
Comment on attachment 416849 [details]
proposed patch

Correct, I verified compatibility with both to the best of my ability.
Comment 4 Jonathan Bedard 2021-01-05 08:58:47 PST
Comment on attachment 416849 [details]
proposed patch

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

> Tools/Scripts/dump-webkit-tests-run:5
> +import six

Need to import webkitpy first to get the auto-installed six

> Tools/Scripts/dump-webkit-tests-run:19
> +            six.print_("file not found: %s" % args[0], file=sys.stderr)

Could also use sys.stderr.write(...)

> Tools/Scripts/rebase-patch-after-webkit-move:52
> +    for current_name, rebased_name in six.iteritems(REBASE_DICTIONARY):

Could just use ".items()" to avoid the six dependency (If we don't care about that, should probably import webkitpy so we get the auto-installed six)

> Tools/Scripts/sync-feature-defines:30
> +import six

Need to import webkitpy first so we get the auto-installed six.
Comment 5 Alexey Proskuryakov 2021-01-05 09:04:05 PST
> Could just use ".items()" to avoid the six dependency (If we don't care
> about that, should probably import webkitpy so we get the auto-installed six)

While I didn't actually measure performance, it seems reasonable to keep using an iterator to avoid regressing it.

Thank you for catching the auto-install issue!
Comment 6 Alexey Proskuryakov 2021-01-05 10:00:53 PST
Committed https://trac.webkit.org/r271151
Comment 7 Radar WebKit Bug Importer 2021-01-05 10:01:25 PST
<rdar://problem/72817606>
Comment 8 Alexey Proskuryakov 2021-01-05 10:40:04 PST
Comment on attachment 416849 [details]
proposed patch

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

> Tools/Scripts/extract-dependencies-from-makefile:-37
> -from __future__ import print_function

This was necessary, removing it broke the build. Re-added in r271159.

Will double-check the other print_function removals now.
Comment 9 Alexey Proskuryakov 2021-01-05 10:44:28 PST
Comment on attachment 416849 [details]
proposed patch

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

> Tools/Scripts/make-dist:-18
> -from __future__ import print_function

This was also needed, reverted in r271161. The rest of print_function removals were fine AFAICT.