Commit 0c8a0e92 authored by Chris McDonough's avatar Chris McDonough

Changed product import and install code.

Now, when products are installed, they are installed in alphabetical order by product name, regardless of which Products directory (e.g. INSTANCE_HOME or SOFTWARE_HOME) that they're in EXCEPT FOR PluginIndexes, which are always first, due to the requirement that they register interfaces with the product context machinery before ZCatalog is initialized.
parent 6a846af3
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
############################################################################## ##############################################################################
__doc__='''Application support __doc__='''Application support
$Id: Application.py,v 1.150 2001/06/01 19:51:16 andreas Exp $''' $Id: Application.py,v 1.151 2001/06/18 20:52:33 chrism Exp $'''
__version__='$Revision: 1.150 $'[11:-2] __version__='$Revision: 1.151 $'[11:-2]
import Globals,Folder,os,sys,App.Product, App.ProductRegistry, misc_ import Globals,Folder,os,sys,App.Product, App.ProductRegistry, misc_
import time, traceback, os, string, Products import time, traceback, os, string, Products
...@@ -500,31 +500,30 @@ def initialize(app): ...@@ -500,31 +500,30 @@ def initialize(app):
error=sys.exc_info()) error=sys.exc_info())
get_transaction().abort() get_transaction().abort()
def get_products():
""" Return a list of tuples in the form:
[(priority, dir_name, base_dir), ...] for each Product directory
found, sort before returning """
products = []
for product_dir in Products.__path__:
product_names=os.listdir(product_dir)
for name in product_names:
priority = (name != 'PluginIndexes') # import PluginIndexes 1st
products.append((priority, name, product_dir))
products.sort()
return products
def import_products(): def import_products():
# Try to import each product, checking for and catching errors. # Try to import each product, checking for and catching errors.
done={} done={}
for product_dir in Products.__path__: products = get_products()
product_names=os.listdir(product_dir)
product_names.sort()
# Hack !!!
# We must initialize the PluginIndexes first before
# all other products (ajung)
if "PluginIndexes" in product_names:
product_names.remove("PluginIndexes")
product_names.insert(0,"PluginIndexes")
for product_name in product_names:
for priority, product_name, product_dir in products:
if done.has_key(product_name): continue if done.has_key(product_name): continue
done[product_name]=1 done[product_name]=1
import_product(product_dir, product_name) import_product(product_dir, product_name)
def import_product(product_dir, product_name, raise_exc=0, log_exc=1): def import_product(product_dir, product_name, raise_exc=0, log_exc=1):
path_join=os.path.join path_join=os.path.join
isdir=os.path.isdir isdir=os.path.isdir
...@@ -578,20 +577,9 @@ def install_products(app): ...@@ -578,20 +577,9 @@ def install_products(app):
get_transaction().note('Prior to product installs') get_transaction().note('Prior to product installs')
get_transaction().commit() get_transaction().commit()
for product_dir in Products.__path__: products = get_products()
product_names=os.listdir(product_dir)
product_names.sort()
# Hack !!!
# We must initialize the PluginIndexes first before
# all other products (ajung)
if "PluginIndexes" in product_names:
product_names.remove("PluginIndexes")
product_names.insert(0,"PluginIndexes")
for product_name in product_names: for priority, product_name, product_dir in products:
# For each product, we will import it and try to call the # For each product, we will import it and try to call the
# intialize() method in the product __init__ module. If # intialize() method in the product __init__ module. If
# the method doesnt exist, we put the old-style information # the method doesnt exist, we put the old-style information
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment