Skip to content
Permalink
Browse files
git webkit setup opens a GitHub web page without warning
https://bugs.webkit.org/show_bug.cgi?id=240490
<rdar://93522009>

Reviewed by Alexey Proskuryakov.

* 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.prompt): Prompt user before generating token.
* Tools/Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitcorepy/webkitcorepy/terminal.py:
(Terminal.open_url): Allow caller to specify a prompt before opening URL.

Canonical link: https://commits.webkit.org/250881@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294661 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
JonWBedard committed May 23, 2022
1 parent 44338a6 commit 235f9b4eafd7a5c2440f636fcb159f6b70029fcc
Showing 6 changed files with 17 additions and 6 deletions.
@@ -30,7 +30,7 @@ def readme():

setup(
name='webkitbugspy',
version='0.6.0',
version='0.6.1',
description='Library containing a shared API for various bug trackers.',
long_description=readme(),
classifiers=[
@@ -46,7 +46,7 @@ def _maybe_add_library_path(path):
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)

version = Version(0, 6, 0)
version = Version(0, 6, 1)

from .user import User
from .issue import Issue
@@ -113,7 +113,11 @@ def validater(username, access_token):

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)):
if webkitcorepy.Terminal.open_url(
'{}?scopes=repo,workflow&description={}%20Local%20Automation'.format(token_url, self.name),
prompt='Please press Return key to open the GitHub token generation web page.\n'
'Options are preconfigured, set your expiration date and then click "Generate token": ',
):
return result
return '''{}
Please go to {token_url} and generate a new 'Personal access token' via 'Developer settings'
@@ -121,13 +121,20 @@ def override_atty(cls, target, isatty=True):
cls._atty_overrides[key] = previous

@classmethod
def open_url(cls, url):
def open_url(cls, url, prompt=None):
if all(not url.startswith(prefix) for prefix in cls.URL_PREFIXES):
sys.stderr.write("'{}' is not a valid URL\n")
return False
if not cls.isatty(sys.stdout):
return False

if prompt:
try:
cls.input(prompt)
except SystemExit:
sys.stderr.write('User aborted URL open\n')
return False

if sys.platform.startswith('win'):
process = run(['explorer', url])
else:
@@ -29,7 +29,7 @@ def readme():

setup(
name='webkitscmpy',
version='4.14.4',
version='4.14.5',
description='Library designed to interact with git and svn repositories.',
long_description=readme(),
classifiers=[
@@ -46,7 +46,7 @@ def _maybe_add_webkitcorepy_path():
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)

version = Version(4, 14, 4)
version = Version(4, 14, 5)

AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
AutoInstall.register(Package('jinja2', Version(2, 11, 3)))

0 comments on commit 235f9b4

Please sign in to comment.