Title: [290793] trunk/Tools
Revision
290793
Author
[email protected]
Date
2022-03-03 13:51:04 -0800 (Thu, 03 Mar 2022)

Log Message

[git-webkit] Open pre-populated GitHub page for new tokens
https://bugs.webkit.org/show_bug.cgi?id=237436
<rdar://problem/89763053>

Reviewed by Ryan Haddad.

GitHub gives us a way to pre-populate its token generation web page. We should
open this page with appropriate arguments during setup.

* Tools/Scripts/libraries/webkitbugspy/setup.py: Bump version.
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/github.py:
(Tracker.credentials): Make 'prompt' into a function, allowing us to open a url
and change the prompt based on the success of opening the url.
* Tools/Scripts/libraries/webkitcorepy/setup.py: Bump version.
* Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitcorepy/webkitcorepy/credentials.py:
(credentials): Allow 'prompt' to be callable.

Canonical link: https://commits.webkit.org/248033@main

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (290792 => 290793)


--- trunk/Tools/ChangeLog	2022-03-03 21:19:46 UTC (rev 290792)
+++ trunk/Tools/ChangeLog	2022-03-03 21:51:04 UTC (rev 290793)
@@ -1,3 +1,24 @@
+2022-03-03  Jonathan Bedard  <[email protected]>
+
+        [git-webkit] Open pre-populated GitHub page for new tokens
+        https://bugs.webkit.org/show_bug.cgi?id=237436
+        <rdar://problem/89763053>
+
+        Reviewed by Ryan Haddad.
+
+        GitHub gives us a way to pre-populate its token generation web page. We should
+        open this page with appropriate arguments during setup.
+
+        * Scripts/libraries/webkitbugspy/setup.py: Bump version.
+        * Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py: Ditto.
+        * Scripts/libraries/webkitbugspy/webkitbugspy/github.py:
+        (Tracker.credentials): Make 'prompt' into a function, allowing us to open a url
+        and change the prompt based on the success of opening the url.
+        * Scripts/libraries/webkitcorepy/setup.py: Bump version.
+        * Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py: Ditto.
+        * Scripts/libraries/webkitcorepy/webkitcorepy/credentials.py:
+        (credentials): Allow 'prompt' to be callable.
+
 2022-03-03  Lauro Moura  <[email protected]>
 
         [build.webkit.org] Add GTK queue using clang

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/setup.py (290792 => 290793)


--- trunk/Tools/Scripts/libraries/webkitbugspy/setup.py	2022-03-03 21:19:46 UTC (rev 290792)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/setup.py	2022-03-03 21:51:04 UTC (rev 290793)
@@ -30,7 +30,7 @@
 
 setup(
     name='webkitbugspy',
-    version='0.3.3',
+    version='0.3.4',
     description='Library containing a shared API for various bug trackers.',
     long_description=readme(),
     classifiers=[

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py (290792 => 290793)


--- trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py	2022-03-03 21:19:46 UTC (rev 290792)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py	2022-03-03 21:51:04 UTC (rev 290793)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(0, 3, 3)
+version = Version(0, 3, 4)
 
 from .user import User
 from .issue import Issue

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/github.py (290792 => 290793)


--- trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/github.py	2022-03-03 21:19:46 UTC (rev 290792)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/github.py	2022-03-03 21:51:04 UTC (rev 290793)
@@ -102,13 +102,21 @@
             return False
 
         hostname = self.url.split('/')[2]
+        token_url = 'https://{}/settings/tokens/new'.format(hostname)
+
+        def prompt():
+            result = "GitHub's API\nProvide {} username and access token to create and update pull requests".format(hostname)
+            if webkitcorepy.Terminal.open_url('{}?scopes=repo,workflow&description={}%20Local%20Automation'.format(token_url, self.name)):
+                return result
+            return '''{}
+Please go to {token_url} and generate a new 'Personal access token' via 'Developer settings'
+with 'repo' and 'workflow' access and appropriate 'Expiration' for your {host} user'''.format(result, token_url=token_url, host=hostname)
+
         return webkitcorepy.credentials(
             url=""
             required=required,
             name=self.url.split('/')[2].replace('.', '_').upper(),
-            prompt='''GitHub's API
-Please go to https://{host}/settings/tokens/new and generate a new 'Personal access token' via 'Developer settings'
-with 'repo' and 'workflow' access and appropriate 'Expiration' for your {host} user'''.format(host=hostname),
+            prompt=prompt,
             key_name='token',
             validater=validater if validate else None,
         )

Modified: trunk/Tools/Scripts/libraries/webkitcorepy/setup.py (290792 => 290793)


--- trunk/Tools/Scripts/libraries/webkitcorepy/setup.py	2022-03-03 21:19:46 UTC (rev 290792)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/setup.py	2022-03-03 21:51:04 UTC (rev 290793)
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2021 Apple Inc. All rights reserved.
+# Copyright (C) 2020-2022 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -30,7 +30,7 @@
 
 setup(
     name='webkitcorepy',
-    version='0.13.2',
+    version='0.13.3',
     description='Library containing various Python support classes and functions.',
     long_description=readme(),
     classifiers=[

Modified: trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py (290792 => 290793)


--- trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py	2022-03-03 21:19:46 UTC (rev 290792)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py	2022-03-03 21:51:04 UTC (rev 290793)
@@ -1,4 +1,4 @@
-# Copyright (C) 2020, 2021 Apple Inc. All rights reserved.
+# Copyright (C) 2020-2022 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -44,7 +44,7 @@
 from webkitcorepy.editor import Editor
 from webkitcorepy.file_lock import FileLock
 
-version = Version(0, 13, 2)
+version = Version(0, 13, 3)
 
 from webkitcorepy.autoinstall import Package, AutoInstall
 if sys.version_info > (3, 0):

Modified: trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/credentials.py (290792 => 290793)


--- trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/credentials.py	2022-03-03 21:19:46 UTC (rev 290792)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/credentials.py	2022-03-03 21:51:04 UTC (rev 290793)
@@ -65,6 +65,8 @@
             if not username and required:
                 if not sys.stderr.isatty() or not sys.stdin.isatty():
                     raise OSError('No tty to prompt user for username')
+                if prompt and callable(prompt):
+                    prompt = prompt()
                 sys.stderr.write("Authentication required to use {}\n".format(prompt or name))
                 sys.stderr.write('Username: ')
                 username = Terminal.input()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to