Skip to content

Commit

Permalink
Merge pull request #3189 from plone/maurits/no-qi
Browse files Browse the repository at this point in the history
Remove quick installer code [6.0]
  • Loading branch information
mauritsvanrees authored Oct 3, 2020
2 parents 6d73df3 + 85d97e3 commit c3c7ec9
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 257 deletions.
3 changes: 1 addition & 2 deletions Products/CMFPlone/MigrationTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class Addon:
"""A profile or product.
This is meant for core Plone packages, especially packages that
are marked as not installable (INonInstallable from
CMFQuickInstallerTool). These are packages that an admin should
are marked as not installable. These are packages that an admin should
not activate, deactivate or upgrade manually, but that should be
handled by Plone.
Expand Down
27 changes: 0 additions & 27 deletions Products/CMFPlone/QuickInstallerTool.py

This file was deleted.

2 changes: 0 additions & 2 deletions Products/CMFPlone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def initialize(context):
from Products.CMFPlone import TypesTool
from Products.CMFPlone import CatalogTool
from Products.CMFPlone import SkinsTool
from Products.CMFPlone import QuickInstallerTool
from Products.CMFPlone import TranslationServiceTool

tools = (
Expand All @@ -158,7 +157,6 @@ def initialize(context):
TypesTool.TypesTool,
CatalogTool.CatalogTool,
SkinsTool.SkinsTool,
QuickInstallerTool.QuickInstallerTool,
TranslationServiceTool.TranslationServiceTool,
)

Expand Down
5 changes: 2 additions & 3 deletions Products/CMFPlone/controlpanel/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,10 @@
template="usergroups_groupdetails.pt"
/>

<!-- Quick Installer -->
<!-- Add-ons control panel -->

<!-- First register an easy to remember browser view '@@installer'.
Maybe we want this as utility instead. It is intended as
replacement for any use of the portal_quickinstaller. -->
It is the replacement for any use of the portal_quickinstaller. -->
<browser:page
for="*"
name="installer"
Expand Down
153 changes: 2 additions & 151 deletions Products/CMFPlone/controlpanel/browser/quickinstaller.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone import PloneMessageFactory as _
from Products.CMFPlone.interfaces import INonInstallable
from Products.CMFQuickInstallerTool.interfaces import INonInstallable as \
QINonInstallable
from Products.Five.browser import BrowserView
from Products.GenericSetup import EXTENSION
from Products.GenericSetup.tool import UNKNOWN
Expand All @@ -12,7 +10,7 @@
import logging
import pkg_resources
import transaction
import warnings


logger = logging.getLogger('Plone')

Expand All @@ -26,18 +24,6 @@ def __init__(self, *args, **kwargs):
self.ps = getToolByName(self.context, 'portal_setup')
self.errors = {}

def listInstallableProducts(self, skipInstalled=True):
warnings.warn(
'listInstallableProducts is no longer supported since Plone 5.1. '
'It will be removed in Plone 6.0.',
DeprecationWarning)

def listInstalledProducts(self, skipInstalled=True):
warnings.warn(
'listInstalledProducts is no longer supported since Plone 5.1. '
'It will be removed in Plone 6.0.',
DeprecationWarning)

def is_profile_installed(self, profile_id):
return self.ps.getLastVersionForProfile(profile_id) != UNKNOWN

Expand All @@ -47,25 +33,8 @@ def is_product_installed(self, product_id):
return False
return self.is_profile_installed(profile['id'])

def isProductInstalled(self, product_name):
warnings.warn(
'isProductInstalled is deprecated since Plone 5.1. '
'It will be removed in Plone 6.0. '
'Use is_product_installed instead.',
DeprecationWarning)
return self.is_product_installed(product_name)

def notifyInstalled(self, productname, **kwargs):
warnings.warn(
'notifyInstalled is no longer supported since Plone 5.1. '
'It will be removed in Plone 6.0.',
DeprecationWarning)

def _install_profile_info(self, product_id):
"""List extension profile infos of a given product.
From CMFQuickInstallerTool/QuickInstallerTool.py
_install_profile_info
"""
profiles = self.ps.listProfileInfo()
# We are only interested in extension profiles for the product.
Expand All @@ -82,9 +51,6 @@ def _install_profile_info(self, product_id):
def get_install_profiles(self, product_id):
"""List all installer profile ids of the given name.
From CMFQuickInstallerTool/QuickInstallerTool.py
getInstallProfiles
TODO Might be superfluous.
"""
return [prof['id'] for prof in self._install_profile_info(product_id)]
Expand Down Expand Up @@ -153,9 +119,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 @@ -177,28 +140,9 @@ def get_uninstall_profile(self, product_id):
return self._get_profile(
product_id, 'uninstall', strict=True, allow_hidden=True)

def isProductInstallable(self, productname):
warnings.warn(
'isProductInstallable is deprecated since Plone 5.1. '
'It will be removed in Plone 6.0. '
'Use is_product_installable instead.',
DeprecationWarning)
return self.is_product_installable(productname)

def isProductAvailable(self, productname):
warnings.warn(
'isProductAvailable is deprecated since Plone 5.1. '
'It will be removed in Plone 6.0. '
'Use is_product_installable instead.',
DeprecationWarning)
return self.is_product_installable(productname)

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 @@ -217,14 +161,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)
Expand Down Expand Up @@ -271,31 +207,8 @@ def is_product_installable(self, product_id, allow_hidden=False):
return False
return True

def getProductFile(self, productname, fname='readme.txt'):
warnings.warn(
'getProductFile is no longer supported since Plone 5.1. '
'It will be removed in Plone 6.0.',
DeprecationWarning)

def getProductReadme(self, productname):
warnings.warn(
'getProductReadme is no longer supported since Plone 5.1. '
'It will be removed in Plone 6.0.',
DeprecationWarning)

def getProductVersion(self, productname):
warnings.warn(
'getProductVersion is deprecated since Plone 5.1. '
'It will be removed in Plone 6.0. '
'Use get_product_version instead.',
DeprecationWarning)

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:
dist = pkg_resources.get_distribution(product_id)
Expand All @@ -311,8 +224,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 @@ -331,8 +242,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 @@ -368,24 +277,6 @@ def upgrade_info(self, product_id):
newVersion=profile_version,
)

def reinstallProducts(self, products, **kwargs):
"""Reinstalls a list of products, the main difference to
uninstall/install is that it does not remove portal objects
created during install (e.g. tools, etc.)
"""
warnings.warn(
'reinstallProducts is no longer supported since Plone 5.1. '
'It will be removed in Plone 6.0.',
DeprecationWarning)

def upgradeProduct(self, pid):
warnings.warn(
'upgradeProduct is deprecated since Plone 5.1. '
'It will be removed in Plone 6.0. '
'Use upgrade_product instead.',
DeprecationWarning)
return self.upgrade_product(pid)

def upgrade_product(self, product_id):
"""Run the upgrade steps for a product.
Expand All @@ -398,34 +289,9 @@ def upgrade_product(self, product_id):
self.ps.upgradeProfile(profile['id'])
return True

def installProducts(self, products=None, **kwargs):
warnings.warn(
'installProducts is deprecated since Plone 5.1. '
'It will be removed in Plone 6.0. '
'Use install_product with a single product instead. '
'All keyword arguments are ignored.',
DeprecationWarning)
if products is None:
products = []
for product_id in products:
self.install_product(product_id)

def installProduct(self, product_name, **kwargs):
"""Deprecated install product.
"""
warnings.warn(
'installProduct is deprecated since Plone 5.1. '
'It will be removed in Plone 6.0. '
'Use install_product instead. '
'All keyword arguments are ignored.',
DeprecationWarning)
return self.install_product(product_name)

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 @@ -461,20 +327,6 @@ def install_product(self, product_id, allow_hidden=False):
# No problems encountered.
return True

def uninstallProducts(self, products=None, **kwargs):
"""Uninstall a list of products.
"""
warnings.warn(
'uninstallProducts is deprecated since Plone 5.1. '
'It will be removed in Plone 6.0. '
'Use uninstall_product with a single product instead. '
'All keyword arguments are ignored.',
DeprecationWarning)
if products is None:
products = []
for product_id in products:
self.uninstall_product(product_id)

def uninstall_product(self, product_id):
"""Uninstall a product by name.
Expand Down Expand Up @@ -592,8 +444,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.
100% based on generic setup profiles now.
@filter:= 'installed': only products that are installed and not hidden
'upgrades': only products with upgrades
Expand Down
1 change: 0 additions & 1 deletion Products/CMFPlone/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def getNonInstallableProfiles(self):
'Products.CMFFormController:CMFFormController',
'Products.CMFPlone:dependencies',
'Products.CMFPlone:testfixture',
'Products.CMFQuickInstallerTool:CMFQuickInstallerTool',
'Products.NuPlone:uninstall',
'Products.MimetypesRegistry:MimetypesRegistry',
'Products.PasswordResetTool:PasswordResetTool',
Expand Down
2 changes: 0 additions & 2 deletions Products/CMFPlone/interfaces/installable.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ def getNonInstallableProfiles():
def getNonInstallableProducts():
"""Returns a list of products that should not be available for
installation.
This used to be in CMFQuickInstallerTool.
"""
2 changes: 0 additions & 2 deletions Products/CMFPlone/profiles/default/toolset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
class="Products.CMFPlone.PasswordResetTool.PasswordResetTool"/>
<required tool_id="portal_properties"
class="Products.CMFPlone.PropertiesTool.PropertiesTool"/>
<required tool_id="portal_quickinstaller"
class="Products.CMFPlone.QuickInstallerTool.QuickInstallerTool"/>
<required tool_id="portal_registration"
class="Products.CMFPlone.RegistrationTool.RegistrationTool"/>
<required tool_id="portal_skins"
Expand Down
1 change: 0 additions & 1 deletion Products/CMFPlone/setuphandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def assignTitles(portal):
'portal_migration': 'Upgrades to newer Plone versions',
'portal_password_reset': 'Handles password retention policy',
'portal_properties': 'General settings registry',
'portal_quickinstaller': 'Allows to install/uninstall products',
'portal_registration': 'Handles registration of new users',
'portal_setup': 'Add-on and configuration management',
'portal_skins': 'Controls skin behaviour (search order etc)',
Expand Down
2 changes: 0 additions & 2 deletions Products/CMFPlone/tests/testInterfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from Products.CMFPlone.Portal import PloneSite
from Products.CMFPlone.PropertiesTool import PropertiesTool
from Products.CMFPlone.PropertiesTool import SimpleItemWithProperties
from Products.CMFPlone.QuickInstallerTool import QuickInstallerTool
from Products.CMFPlone.RegistrationTool import RegistrationTool
from Products.CMFPlone.SkinsTool import SkinsTool
from Products.CMFPlone.TypesTool import TypesTool
Expand Down Expand Up @@ -266,7 +265,6 @@ def _testStuff(self):
(PloneTool, ()),
(PloneSite, ()),
(PropertiesTool, ()), (SimpleItemWithProperties, ()),
(QuickInstallerTool, ()),
(RegistrationTool, ()),
(SkinsTool, ()),
(TypesTool, ()),
Expand Down
Loading

0 comments on commit c3c7ec9

Please sign in to comment.