1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
|
#this should be automated in the CMFSetup product
#you should be able to define Product dependencies and error messages
#in the config file
import logging
import sys
MINIMUM_PYTHON_VER = (2, 3, 5)
PREFERRED_PYTHON_VER = "2.3.5 or newer"
MINIMUM_ZOPE_VER = (2, 8, 7)
PREFERRED_ZOPE_VER = "2.8.7 or newer"
MINIMUM_CMF_VER = (1, 6, 0)
messages = []
def log(message, summary='', severity=logging.ERROR, optional=0):
if optional:
subsys = 'Plone Option'
else:
subsys = 'Plone Dependency'
messages.append({'message' : message, 'summary' : summary,
'severity' : severity, 'optional' : optional
})
logger = logging.getLogger(subsys)
logger.log(severity, '%s \n%s', summary, message)
# test python version
PYTHON_VER = sys.version_info[:3]
if PYTHON_VER < MINIMUM_PYTHON_VER:
log(("Python version %s found but Plone needs at least "
"Python %s. Please download and install Python %s "
"from http://python.org/" % (PYTHON_VER,
MINIMUM_PYTHON_VER, PREFERRED_PYTHON_VER) ))
# test zope version
ZOPE_VER = "unknown"
try:
from App.version_txt import getZopeVersion
except ImportError:
pass
else:
try:
ZOPE_VER = getZopeVersion()[:3]
except (ValueError, TypeError, KeyError):
pass
if ZOPE_VER in ('unknown', (-1, -1, -1)): # -1, -1, 1 is developer release
log(("Unable to detect Zope version. Please make sure you have Zope "
"%s installed." % PREFERRED_ZOPE_VER))
elif ZOPE_VER < MINIMUM_ZOPE_VER:
log(("Zope version %s found but Plone needs at least "
"Zope %s Please download and install Zope %s "
"from http://zope.org/" %
(ZOPE_VER, MINIMUM_ZOPE_VER, PREFERRED_ZOPE_VER) ))
# make sure CMF is installed
cmfcore = 0
try:
import Products.CMFCore
cmfcore = 1
except ImportError:
log(("CMFCore not found. Please download the CMF "
"from http://cmf.zope.org/download"))
# check the CMF version
if cmfcore:
from Products.CMFCore import cmfcore_globals
from App.Common import package_home
from os.path import join
x = []
CMF_VERSION = 'Unknown'
try:
file = join(package_home(cmfcore_globals), 'version.txt')
CMF_VERSION = open(file, 'r').read().strip()
version = CMF_VERSION.strip()
if version.lower().startswith('cmf-'):
version = version[4:]
filtered = ''
for v in version:
if v in ['0','1','2','3','4','5','6','7','8','9','.']:
filtered += v
else:
break
cmf_ver = [int(x) for x in filtered.split('.')]
except IOError:
# couldnt find file, oh well
pass
except ValueError:
# couldnt make sense of the version number
pass
if tuple(cmf_ver) < MINIMUM_CMF_VER:
log(("Plone requires CMF %s or later. "
"Your version is: %s" % (MINIMUM_CMF_VER, CMF_VERSION)))
try:
import Products.CMFQuickInstallerTool
except ImportError:
log(("CMFQuickInstallerTool not found. Please download it from "
"http://plone.org/products/cmfquickinstallertool"))
try:
# TODO: we might want to check if the user has jpeg and zlib support, too
import PIL.Image
except ImportError:
log(("PIL not found. Plone needs PIL 1.1.5 or newer to scale images. "
"Please download it from http://www.pythonware.com/products/pil/ or "
"http://effbot.org/downloads/#Imaging"),
severity=logging.INFO)
try:
from elementtree import ElementTree
except ImportError:
log(("Elementtree not found. Plone needs Elementtree for XML "
"transformation. Please download it from "
"http://effbot.org/downloads/#elementtree"),
severity=logging.INFO)
try:
import Products.ExternalEditor
except ImportError:
log(("ExternalEditor not found. If you want "
"the external edit functionality, please "
"download it from "
"http://plope.com/software/ExternalEditor"),
severity=logging.INFO, optional=1)
try:
import Products.kupu
except ImportError:
log(("Kupu not found. If you want WYSIWYG capabilities "
"in Plone, you can download it from "
"http://kupu.oscom.org/"),
severity=logging.INFO, optional=1)
try:
import Products.PlacelessTranslationService
except ImportError:
log(("Placeless Translation Service not found. Plone "
"runs without this, but if you want multilingual "
"interface or access keys, you must download it from "
"http://plone.org/products/pts/"),
severity=logging.INFO, optional=1)
try:
import Products.PloneTranslations
except ImportError:
log(("PloneTranslation product with i18n files not found. Plone "
"runs without this, but if you want multilingual "
"interface or access keys, you must download it from "
"http://plone.org/products/plonetranslations"),
severity=logging.INFO, optional=1)
try:
import Products.CMFFormController
except ImportError:
log(("CMFFormController not found. Please "
"download it from http://plone.org/products/cmfformcontroller"))
try:
import Products.GroupUserFolder
except ImportError:
log(("GroupUserFolder not found. Please "
"http://plone.org/products/groupuserfolder"))
try:
import Products.SecureMailHost
except ImportError:
log(("SecureMailHost not found. Please "
"http://plone.org/products/securemailhost"))
try:
import Products.MimetypesRegistry
except ImportError:
log(("MimetypesRegistry not found. Please "
"download it from http://plone.org/products/archetypes"))
try:
import Products.PortalTransforms
except ImportError:
log(("PortalTransforms not found. Please "
"download it from http://plone.org/products/archetypes"))
try:
import Products.Archetypes
except ImportError:
# TODO we might want to check the AT version
log(("Archetypes not found. Please "
"download it from http://plone.org/products/archetypes"))
try:
import Products.ATContentTypes.content.document
except ImportError:
log(("ATContentTypes not found or too old. Please "
"download it from http://plone.org/products/atcontenttypes"))
try:
import Products.ExtendedPathIndex
except ImportError:
log(("ExtendedPathIndex not found. "
"Please download it from http://plone.org/products/extendedpathindex"))
try:
import Products.ResourceRegistries
except ImportError:
log(("ResourceRegistries not found. "
"Please download it from http://plone.org/products/resourceregistries"))
try:
import Products.CMFDynamicViewFTI
except ImportError:
log(("CMFDynamicViewFTI not found. "
"Please download it from http://plone.org/products/cmfdynamicviewfti"))
try:
import Products.PlonePAS
except ImportError:
log(("PlonePAS not found."
"Please download it from http://plone.org/products/plonepas"))
|