# This file is part of ZTM.
#
# ZTM is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# ZTM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ZTM; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

from zLOG import *
import os

def log(message,summary='',severity=ERROR, optional=None):
    if optional:
        msg = 'ZTM Option'
    else:
        msg = 'ZTM Dependency'
    LOG(msg,severity,summary,message + "\n")
    
#TODO: Make sure that we have the correct Zope version

# Make sure CMF is installed
try:
    import Products.CMFCore
except ImportError:
    log(("CMFCore not found.  Please download and install the CMF "
         "from http://cmf.zope.org/download"))

# PlacelessTranslationService must be installed
try:
    import Products.PlacelessTranslationService
except ImportError:
    log(("PlacelessTranslationService not found. Please download"
         "it from http://sf.net/projects/collective"))

# BTreeFolder2 must be installed
try:
    import Products.BTreeFolder2
except ImportError:
    log(("BTreeFolder2 not found. Please download it "
         "from http://cvs.zope.org/Products"))

# PyXML is required for importing
try:
    from xml.parsers.xmlproc import xmldtd
except ImportError:
    log(("PyXML is not installed. It is required if you wish to import"
         "XML Topic Maps. You can find it at http://pyxml.sf.net")
       , optional=True
       )
