Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all traces of Products.CMFQuickInstaller #1267

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions news/1267.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Remove all traces of ``Products.CMFQuickInstaller``.
It was removed in Plone 5.2.
BBB code was in ``plone.app.upgrade`` only.
Plone with Restapi broke if ``plone.app.upgrade` was not available, like when dependening on ``Products.CMFPlone`` only.
[jensens]

34 changes: 2 additions & 32 deletions src/plone/restapi/services/addons/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone import PloneMessageFactory as _
from Products.CMFPlone.interfaces import INonInstallable
from Products.CMFQuickInstallerTool.interfaces import (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm, this is strange, the iface was moved to:

from Products.CMFPlone.interfaces import INonInstallable

And we should have aliases for that:

https://github.com/plone/plone.app.upgrade/blob/ef4aef834c561f7a634e819571b7c3bfb48cf314/plone/app/upgrade/__init__.py#L185

Don't you have plone.app.upgrade?

I think the proper fix is to replace the import given that the alias is there since 5.1:
https://github.com/plone/Products.CMFPlone/blob/5.1.x/Products/CMFPlone/interfaces/__init__.py#L38
and this package supports Plone 5.2 only.

Also the towncrier entry should be updated accordingly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I do only depend on Products.CMFPlone. Which is totally fine. plone.app.upgrade in only installed in a single service instance. The cluster runs usually without.

Copy link
Member Author

@jensens jensens Nov 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the proper fix is to replace the import given that the alias is there since 5.1

Right, this the current master does not support 5.1 anyway. Removal is probably the best.

INonInstallable as QINonInstallable,
)
from Products.GenericSetup import EXTENSION
from Products.GenericSetup.tool import UNKNOWN
from zope.component import getAllUtilitiesRegisteredFor
Expand Down Expand Up @@ -54,11 +51,7 @@ def is_product_installed(self, product_id):
return self.is_profile_installed(profile["id"])

def _install_profile_info(self, product_id):
"""List extension profile infos of a given product.

From CMFQuickInstallerTool/QuickInstallerTool.py
_install_profile_info
"""
"""List extension profile infos of a given product."""
profiles = self.ps.listProfileInfo()
# We are only interested in extension profiles for the product.
# TODO Remove the manual Products.* check here. It is still needed.
Expand Down Expand Up @@ -140,9 +133,6 @@ def _get_profile(self, product_id, name, strict=True, allow_hidden=False):
def get_install_profile(self, product_id, allow_hidden=False):
"""Return the default install profile.

From CMFQuickInstallerTool/QuickInstallerTool.py
getInstallProfile

:param product_id: id of product/package
:type product_id: string
:param allow_hidden: Allow getting otherwise hidden profile.
Expand All @@ -169,9 +159,6 @@ def get_uninstall_profile(self, product_id):
def is_product_installable(self, product_id, allow_hidden=False):
"""Does a product have an installation profile?

From CMFQuickInstallerTool/QuickInstallerTool.py
isProductInstallable (and the deprecated isProductAvailable)

:param allow_hidden: Allow installing otherwise hidden products.
In the UI this will be False, but you can set it to True in
for example a call from plone.app.upgrade where you want to
Expand All @@ -190,14 +177,6 @@ def is_product_installable(self, product_id, allow_hidden=False):
not_installable.extend(gnip())
if product_id in not_installable:
return False
# BBB. For backwards compatibility, we try the INonInstallable
# from the old QI as well.
not_installable = []
utils = getAllUtilitiesRegisteredFor(QINonInstallable)
for util in utils:
not_installable.extend(util.getNonInstallableProducts())
if product_id in not_installable:
return False

profile = self.get_install_profile(product_id, allow_hidden=allow_hidden)
if profile is None:
Expand Down Expand Up @@ -240,8 +219,6 @@ def is_product_installable(self, product_id, allow_hidden=False):
def get_product_version(self, product_id):
"""Return the version of the product (package).

From CMFQuickInstallerTool/QuickInstallerTool
getProductVersion
That implementation used to fall back to getting the version.txt.
"""
try:
Expand All @@ -258,8 +235,6 @@ def get_latest_upgrade_step(self, profile_id):

If anything errors out then go back to "old way" by returning
'unknown'.

From CMFPlone/QuickInstallerTool.py getLatestUpgradeStep
"""
profile_version = UNKNOWN
try:
Expand All @@ -277,8 +252,6 @@ def upgrade_info(self, product_id):
This is a dict with among others two booleans values, stating if
an upgrade is required and available.

From CMFPlone/QuickInstaller.py upgradeInfo

:param product_id: id of product/package
:type product_id: string
:returns: dictionary with info about product
Expand Down Expand Up @@ -327,8 +300,6 @@ def upgrade_product(self, product_id):
def install_product(self, product_id, allow_hidden=False):
"""Install a product by name.

From CMFQuickInstallerTool/QuickInstallerTool.py installProduct

:param product_id: id of product/package
:type product_id: string
:param allow_hidden: Allow installing otherwise hidden products.
Expand Down Expand Up @@ -474,8 +445,7 @@ def marshall_addons(self):

def get_addons(self, apply_filter=None, product_name=None):
"""
100% based on generic setup profiles now. Kinda.
For products magic, use the zope quickinstaller I guess.
Based on generic setup profiles.

@filter:= 'installed': only products that are installed and not hidden
'upgrades': only products with upgrades
Expand Down