From 580acc37c7a08ed6e9aee68a6ade3880c69dc67d Mon Sep 17 00:00:00 2001 From: Joe Shochet Date: Wed, 15 Nov 2000 20:19:36 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/configfiles/Sources.pp | 2 +- direct/src/configfiles/direct.init | 10 +----- direct/src/configfiles/direct.pth | 12 +++++++ direct/src/showbase/sitecustomize.py | 53 ++++++++++++++++++++++++++++ panda/src/configfiles/Sources.pp | 2 +- panda/src/configfiles/panda.init | 2 -- 6 files changed, 68 insertions(+), 13 deletions(-) create mode 100644 direct/src/configfiles/direct.pth create mode 100644 direct/src/showbase/sitecustomize.py diff --git a/direct/src/configfiles/Sources.pp b/direct/src/configfiles/Sources.pp index 9d55cfa8b0..55994c5e36 100644 --- a/direct/src/configfiles/Sources.pp +++ b/direct/src/configfiles/Sources.pp @@ -1,2 +1,2 @@ #define INSTALL_CONFIG \ - direct.init Configrc + direct.init Configrc direct.pth diff --git a/direct/src/configfiles/direct.init b/direct/src/configfiles/direct.init index 04132ccd47..5e1a84c4b8 100644 --- a/direct/src/configfiles/direct.init +++ b/direct/src/configfiles/direct.init @@ -1,13 +1,5 @@ ATTACH panda MODREL ETC_PATH etc SEP PYTHONPATH ; -MODREL PYTHONPATH lib -MODREL PYTHONPATH lib/py -MODREL PYTHONPATH src/ffi -MODREL PYTHONPATH src/actor -MODREL PYTHONPATH src/distributed +# This is needed to find the site configuration file MODREL PYTHONPATH src/showbase -MODREL PYTHONPATH src/directutil -MODREL PYTHONPATH src/tkwidgets -MODREL PYTHONPATH src/tkpanels -MODREL PYTHONPATH src/leveleditor diff --git a/direct/src/configfiles/direct.pth b/direct/src/configfiles/direct.pth new file mode 100644 index 0000000000..821cb81c03 --- /dev/null +++ b/direct/src/configfiles/direct.pth @@ -0,0 +1,12 @@ +lib +lib/py +src/actor +src/directutil +src/distributed +src/ffi +src/gui +src/leveleditor +src/net +src/showbase +src/tkpanels +src/tkwidgets diff --git a/direct/src/showbase/sitecustomize.py b/direct/src/showbase/sitecustomize.py new file mode 100644 index 0000000000..9891781495 --- /dev/null +++ b/direct/src/showbase/sitecustomize.py @@ -0,0 +1,53 @@ +import os +import sys + +print 'Site customize for Panda' + +def getPackages(): + """ + Find all the packages on your ctprojs variable and parse them + to extract the tree name from the long details like this: + TOONTOWN:default DIRECT:default PANDA:personal DTOOL:install + Returns a list of the packages as strings + Note: the ctprojs are reversed to put them in the order of attachment. + """ + packages = [] + ctprojs = os.getenv("CTPROJS").split() + for proj in ctprojs: + projName = proj.split(':')[0] + packages.append(projName) + packages.reverse() + return packages + + +def addpackage(package): + """ + Look in this package name for the file $PACKAGE/etc/package.pth + which contains paths that we want prepended to sys.path + There should be one relative pathname per line (relative to $PACKAGE) + comments and empty lines are ok + """ + tree = os.getenv(package) + lowerPackage = package.lower() + fullname = os.path.join(tree, 'etc' + os.sep + (lowerPackage + '.pth')) + try: + f = open(fullname) + print 'Appending paths in ' + fullname + except IOError: + return + + while 1: + dir = f.readline() + if not dir: + break + if dir[0] == '#': + continue + if dir[-1] == '\n': + dir = dir[:-1] + dir = os.path.join(tree, dir) + if dir not in sys.path and os.path.exists(dir): + sys.path = [dir] + sys.path + +for package in getPackages(): + addpackage(package) + diff --git a/panda/src/configfiles/Sources.pp b/panda/src/configfiles/Sources.pp index 23058353d6..0641c2d633 100644 --- a/panda/src/configfiles/Sources.pp +++ b/panda/src/configfiles/Sources.pp @@ -1,2 +1,2 @@ #define INSTALL_CONFIG \ - panda.emacs panda.emacs.Xdefaults panda.init Configrc + panda.emacs panda.emacs.Xdefaults panda.init Configrc panda.pth diff --git a/panda/src/configfiles/panda.init b/panda/src/configfiles/panda.init index c8cf82ea80..578c9914f2 100644 --- a/panda/src/configfiles/panda.init +++ b/panda/src/configfiles/panda.init @@ -18,7 +18,5 @@ DOSH CONFIG_CONFIG=:configpath=CFG_PATH:configpath=ETC_PATH DOSH CFG_PATH=.:$HOME:/usr/local/etc DOSH export CONFIG_CONFIG CFG_PATH DOSH fi -SEP PYTHONPATH ; -MODREL PYTHONPATH lib DOSH if [ -e /usr/local/libmikmod ]; then USE_MIKMOD="t"; export USE_MIKMOD; fi DOSH if [ -e /for/program/libmikmod ]; then USE_MIKMOD="t"; export USE_MIKMOD; fi