- Revision
- 276442
- Author
- [email protected]
- Date
- 2021-04-22 09:43:31 -0700 (Thu, 22 Apr 2021)
Log Message
Ensure all non-local AutoInstalled libraries specify version
https://bugs.webkit.org/show_bug.cgi?id=224872
Reviewed by Jonathan Bedard.
Currently on Python 3 running test-webkitpy fails due to us attempting to
install flask 2.0.0rc1, recently released. We shouldn't, however, be installing
the latest possible version of flask, but rather specifying one. We do actually
attempt to specify one in webkitflaskpy, but we pass the Version object to the
wrong place.
Now actually specifying the versions, we need to change some of them to the
latest version which supports Python 2 to be able to install them to run
test-webkitpy-python2.
To ensure we don't repeat this, this makes AutoInstall.register raise if you try
to register a non-local package without specifying a version.
Additionally, require AutoInstall.register's package argument be a Package by
passing moving the lookup to AutoInstall.install and requiring it to be
successful.
Finally, while I'm touching this, make registering 'autoinstalled' an outright
failure, and make installing a local package fail if it cannot be found.
* Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:
(AutoInstall.register):
(AutoInstall.install):
* Scripts/libraries/webkitflaskpy/webkitflaskpy/__init__.py:
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (276441 => 276442)
--- trunk/Tools/ChangeLog 2021-04-22 16:38:08 UTC (rev 276441)
+++ trunk/Tools/ChangeLog 2021-04-22 16:43:31 UTC (rev 276442)
@@ -1,3 +1,35 @@
+2021-04-22 Sam Sneddon <[email protected]>
+
+ Ensure all non-local AutoInstalled libraries specify version
+ https://bugs.webkit.org/show_bug.cgi?id=224872
+
+ Reviewed by Jonathan Bedard.
+
+ Currently on Python 3 running test-webkitpy fails due to us attempting to
+ install flask 2.0.0rc1, recently released. We shouldn't, however, be installing
+ the latest possible version of flask, but rather specifying one. We do actually
+ attempt to specify one in webkitflaskpy, but we pass the Version object to the
+ wrong place.
+
+ Now actually specifying the versions, we need to change some of them to the
+ latest version which supports Python 2 to be able to install them to run
+ test-webkitpy-python2.
+
+ To ensure we don't repeat this, this makes AutoInstall.register raise if you try
+ to register a non-local package without specifying a version.
+
+ Additionally, require AutoInstall.register's package argument be a Package by
+ passing moving the lookup to AutoInstall.install and requiring it to be
+ successful.
+
+ Finally, while I'm touching this, make registering 'autoinstalled' an outright
+ failure, and make installing a local package fail if it cannot be found.
+
+ * Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:
+ (AutoInstall.register):
+ (AutoInstall.install):
+ * Scripts/libraries/webkitflaskpy/webkitflaskpy/__init__.py:
+
2021-04-21 Wenson Hsieh <[email protected]>
[iOS] The Look Up text service popover should avoid covering selected text
Modified: trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py (276441 => 276442)
--- trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py 2021-04-22 16:38:08 UTC (rev 276441)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py 2021-04-22 16:43:31 UTC (rev 276442)
@@ -518,22 +518,22 @@
@classmethod
def register(cls, package, local=False):
- if isinstance(package, str):
- if cls.packages.get(package):
- return cls.packages[package]
- else:
- package = Package(package)
- elif isinstance(package, Package):
+ if isinstance(package, Package):
if cls.packages.get(package.name):
if cls.packages.get(package.name)[0].version != package.version:
raise ValueError('Registered version of {} uses {}, but requested version uses {}'.format(package.name, cls.packages.get(package.name)[0].version, package.version))
return cls.packages.get(package.name)
else:
- raise ValueError('Expected package to be str or Package, not {}'.format(type(package)))
+ raise ValueError('Expected package to be Package, not {}'.format(type(package)))
+ if not isinstance(local, bool):
+ raise ValueError('Expected local to be bool, not {}'.format(type(local)))
+
# If inside the WebKit checkout, a local library is likely checked in at Tools/Scripts/libraries.
# When we detect such a library, we should not register it to be auto-installed
- if local and package.name != 'autoinstalled':
+ if local:
+ if package.name == 'autoinstalled':
+ raise ValueError("local package name 'autoinstalled' is forbidden")
libraries = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
checkout_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(libraries))))
for candidate in [
@@ -546,7 +546,13 @@
continue
sys.path.insert(0, candidate)
return [package]
+ else:
+ raise ValueError("unable find local package {}".format(package.name))
+ assert not local # this should follow from the above
+ if package.version is None:
+ raise ValueError("trying to install non-local package {} with unspecified version".format(package.name))
+
for alias in package.aliases:
cls.packages[alias].append(package)
cls.packages[package.name].append(package)
@@ -554,7 +560,13 @@
@classmethod
def install(cls, package):
- return all([to_install.install() for to_install in cls.register(package)])
+ if isinstance(package, str):
+ # we want this to throw if it hasn't been previously registered; in the case
+ # that this is being called from cls.find_module it should always exist
+ packages = cls.packages[package]
+ else:
+ packages = cls.register(package)
+ return all([to_install.install() for to_install in packages])
@classmethod
def install_everything(cls):
Modified: trunk/Tools/Scripts/libraries/webkitflaskpy/webkitflaskpy/__init__.py (276441 => 276442)
--- trunk/Tools/Scripts/libraries/webkitflaskpy/webkitflaskpy/__init__.py 2021-04-22 16:38:08 UTC (rev 276441)
+++ trunk/Tools/Scripts/libraries/webkitflaskpy/webkitflaskpy/__init__.py 2021-04-22 16:43:31 UTC (rev 276442)
@@ -45,11 +45,11 @@
version = Version(0, 1, 1)
-AutoInstall.register(Package('click'), Version(7, 1, 2))
-AutoInstall.register(Package('flask'), Version(1, 1, 2))
-AutoInstall.register(Package('itsdangerous'), Version(2, 0, 0))
-AutoInstall.register(Package('jinja2'), Version(3, 0, 0))
-AutoInstall.register(Package('markupsafe'), Version(2, 0, 0))
-AutoInstall.register(Package('werkzeug'), Version(1, 0, 1))
+AutoInstall.register(Package('click', Version(7, 1, 2)))
+AutoInstall.register(Package('flask', Version(1, 1, 2)))
+AutoInstall.register(Package('itsdangerous', Version(1, 1, 0)))
+AutoInstall.register(Package('jinja2', Version(2, 11, 3)))
+AutoInstall.register(Package('markupsafe', Version(1, 1, 1)))
+AutoInstall.register(Package('werkzeug', Version(1, 0, 1)))
name = 'webkitflaskpy'