[SciPy-dev] Long running find in setup_xplt.py
Prabhu Ramachandran
prabhu at aero.iitm.ernet.in
Sun Feb 17 13:03:46 CST 2002
hi,
Each time I run setup.py inside scipy, setup_xplt.py runs a find
command in /usr which in my case has about 3-4 Gigs of stuff. My disk
churns for quite a long while when the command runs and its pretty
irritating when I update my scipy install. Also, the code in
def check_and_save(file='saved_values.py'):
appends to saved_values.py all the time. So right now I have about 38
entries in that file with the same entry 'X11 = 1'.
The configuration function tries to execute ../saved_values.py. I'm
not sure this will work when setup.py is run from the base directory.
So I tried changing this to execfile('saved_values.py'). That also
does not work properly because execfile does not seem to work properly
when called inside a function. I discovered this because I tried
adding a print X11 after the execfile and it fails!
try:
execfile('saved_values.py')
print X11
And it fails here!
Traceback (most recent call last):
File "setup.py", line 126, in ?
install_package()
File "setup.py", line 103, in install_package
config.extend([get_package_config(x,parent_package)for x in unix_packages])
File "setup.py", line 46, in get_package_config
config = mod.configuration(parent)
File "xplt/setup_xplt.py", line 18, in configuration
print X11
So I tried this:
In [14]: def do_func():
....: execfile('saved_values.py')
....: print X11
....:
In [17]: execfile('saved_values.py')
In [18]: print X11
1
In [22]: del X11
In [23]: do_func ()
In saved_values.py
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
?
? in do_func()
NameError: global name 'X11' is not defined
OTOH, if I do a exec(file.read()) it works okay.
In [31]: def do_func ():
....: exec(open('saved_values.py').read())
....: print X11
....:
In [33]: do_func ()
In saved_values.py
1
Is this an execfile bug?
Now there are no annoying finds. So, I'll go ahead and change this in
CVS.
prabhu
More information about the Scipy-dev
mailing list