Commit 755c332a authored by Jim Fulton's avatar Jim Fulton

Allow Products directories in *both* SOFTWARE_HOME *and* INSTANCE_HOME.

parent 4b7e9c1a
......@@ -85,14 +85,13 @@
"""Commonly used utility functions."""
__version__='$Revision: 1.1 $'[11:-2]
__version__='$Revision: 1.2 $'[11:-2]
import os, sys
import os, sys, Products
from Common import package_home
try: home=os.environ['SOFTWARE_HOME']
except:
import Products
home=package_home(Products.__dict__)
if not os.path.isabs(home):
home=os.path.join(os.getcwd(), home)
......@@ -114,3 +113,11 @@ except:
sys.modules['__builtin__'].INSTANCE_HOME=INSTANCE_HOME=chome
# If there is a Products package in INSTANCE_HOME, add it to the
# Products package path
ip=os.path.join(INSTANCE_HOME, 'Products')
if os.path.isdir(ip) and ip not in Products.__path__:
Products.__path__.insert(0, ip)
......@@ -85,8 +85,8 @@
__doc__='''Application support
$Id: Application.py,v 1.105 1999/05/05 13:24:37 brian Exp $'''
__version__='$Revision: 1.105 $'[11:-2]
$Id: Application.py,v 1.106 1999/05/11 18:31:27 jim Exp $'''
__version__='$Revision: 1.106 $'[11:-2]
import Globals,Folder,os,regex,sys,App.Product, App.ProductRegistry, misc_
......@@ -360,19 +360,25 @@ def initialize(app):
def import_products(_st=type('')):
# Try to import each product, checking for and catching errors.
path_join=os.path.join
product_dir=path_join(SOFTWARE_HOME,'Products')
isdir=os.path.isdir
exists=os.path.exists
DictType=type({})
product_names=os.listdir(product_dir)
product_names.sort()
global_dict=globals()
silly=('__doc__',)
modules=sys.modules
have_module=modules.has_key
done={}
for product_dir in Products.__path__:
product_names=os.listdir(product_dir)
product_names.sort()
for product_name in product_names:
if done.has_key(product_name): continue
done[product_name]=1
package_dir=path_join(product_dir, product_name)
if not isdir(package_dir): continue
if not exists(path_join(package_dir, '__init__.py')):
......@@ -399,7 +405,6 @@ def install_products(app):
# that all folders know about top-level objects, aka products
path_join=os.path.join
product_dir=path_join(SOFTWARE_HOME,'Products')
isdir=os.path.isdir
exists=os.path.exists
DictType=type({})
......@@ -412,12 +417,21 @@ def install_products(app):
meta_types=[]
product_names=os.listdir(product_dir)
product_names.sort()
global_dict=globals()
silly=('__doc__',)
done={}
for product_dir in Products.__path__:
product_names=os.listdir(product_dir)
product_names.sort()
for product_name in product_names:
if done.has_key(product_name): continue
done[product_name]=1
package_dir=path_join(product_dir, product_name)
__traceback_info__=product_name
if not isdir(package_dir): continue
......
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