[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] gnumed.py hacks
From: |
David Grant |
Subject: |
Re: [Gnumed-devel] gnumed.py hacks |
Date: |
Fri, 20 Feb 2004 17:27:59 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.6) Gecko/20040207 |
Corrections below...
David Grant wrote:
I was bored today so I started looking into some gnumed code. In
gnumed.py:
appPath = get_base_dir()
if appPath is None:
sys.exit("CRITICAL ERROR: Cannot determine base path.")
# manually extend our module search path
sys.path.append(os.path.join(appPath, 'wxpython'))
sys.path.append(os.path.join(appPath, 'python-common'))
sys.path.append(os.path.join(appPath, 'business'))
This seems like a hack. The way I would have done it would be:
This should only be done for CVS gnumed:
-get_parent_dir()
-append it to PYTHONPATH
-done
The above isn't even necessary. We can have a script called
gnumed-cvs.sh which is only used for people running from a cvs
checkout. The sh script sets PYTHONPATH and then runs "python
gnumed.py". gnumed.py should be moved to the gnumed/client/ directory,
instead of inside the wxpython subdir. The syntax of how the files
import modules would have to change, but after that the get_base_dir and
sys.path.append could all be obsoleted I think.
In a Linux distribution or Windows installation:
-do nothing, modules should all be found because they should somewhere
within sys.path already
-each directory should have an __init__ file to make it a module
-import modules by doing import wxpython.gmMacro, or import
python-common.gmDrugView, etc...
-Each time you create new modules within the client/ directory, you
should have to go into the gnumed.py file and add some sys.path.append
thing. It should become a module because of the __init__ file and you
just import it when you want.
There was a typo above. It should have read "Each time you create new
modules within the client/ directory, you SHOULDN'T have to go into the
gnumed.py file and add some sys.path.append thing. "
Please any comments if you have time?
Thanks,
David
--
David J. Grant
M.A.Sc. Candidate in Electrical Engineering
a-Si and Integrated Circuits Lab
University of Waterloo
Room DC3707
519-888-4567 x2872
http://www.eng.uwaterloo.ca/~djgrant