[Numpy-svn] r4366 - in branches/numpy.scons/numpy: core distutils distutils/command distutils/scons
numpy-svn at scipy.org
numpy-svn at scipy.org
Wed Oct 31 10:57:58 EDT 2007
Author: cdavid
Date: 2007-10-31 09:57:41 -0500 (Wed, 31 Oct 2007)
New Revision: 4366
Modified:
branches/numpy.scons/numpy/core/SConstruct
branches/numpy.scons/numpy/core/setupscons.py
branches/numpy.scons/numpy/distutils/command/scons.py
branches/numpy.scons/numpy/distutils/misc_util.py
branches/numpy.scons/numpy/distutils/scons/configuration.py
branches/numpy.scons/numpy/distutils/scons/numpyenv.py
Log:
Create modules to keep config results in a separate directory scons-configres
Modified: branches/numpy.scons/numpy/core/SConstruct
===================================================================
--- branches/numpy.scons/numpy/core/SConstruct 2007-10-31 12:44:57 UTC (rev 4365)
+++ branches/numpy.scons/numpy/core/SConstruct 2007-10-31 14:57:41 UTC (rev 4366)
@@ -146,6 +146,7 @@
build_blasdot = 0
config.Finish()
+write_info(env)
#==========
# Build
Modified: branches/numpy.scons/numpy/core/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/core/setupscons.py 2007-10-31 12:44:57 UTC (rev 4365)
+++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-31 14:57:41 UTC (rev 4366)
@@ -78,6 +78,7 @@
add_numpyconfig_header()
add_array_api()
add_ufunc_api()
+ config.add_configres()
config.add_sconscript('SConstruct',
post_hook = add_generated_files,
Modified: branches/numpy.scons/numpy/distutils/command/scons.py
===================================================================
--- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-31 12:44:57 UTC (rev 4365)
+++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-31 14:57:41 UTC (rev 4366)
@@ -8,14 +8,9 @@
from numpy.distutils.ccompiler import CCompiler
from numpy.distutils.fcompiler import FCompiler
from numpy.distutils.exec_command import find_executable
+from numpy.distutils.misc_util import get_scons_build_dir
from numpy.distutils import log
-def get_scons_build_dir():
- """Return the top path where everything produced by scons will be put.
-
- The path is relative to the top setup.py"""
- return pjoin('build', 'scons')
-
def get_scons_local_path():
"""This returns the full path where scons.py for scons-local is located."""
import numpy.distutils
Modified: branches/numpy.scons/numpy/distutils/misc_util.py
===================================================================
--- branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-31 12:44:57 UTC (rev 4365)
+++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-31 14:57:41 UTC (rev 4366)
@@ -1277,6 +1277,10 @@
from command.scons import get_scons_build_dir
return get_scons_build_dir()
+ def add_configres(self):
+ file = os.path.join(get_scons_configres_dir(), self.local_path,
+ get_scons_configres_filename())
+
def have_f77c(self):
"""Check for availability of Fortran 77 compiler.
Use it inside source generating function to ensure that
@@ -1475,6 +1479,26 @@
#########################
+def get_scons_build_dir():
+ """Return the top path where everything produced by scons will be put.
+
+ The path is relative to the top setup.py"""
+ return os.path.join('build', 'scons')
+
+def get_scons_configres_dir():
+ """Return the top path where everything produced by scons will be put.
+
+ The path is relative to the top setup.py"""
+ return os.path.join('build', 'scons-configres')
+
+def get_scons_configres_filename():
+ """Return the top path where everything produced by scons will be put.
+
+ The path is relative to the top setup.py"""
+ return '__configres.py'
+
+#########################
+
def default_config_dict(name = None, parent_name = None, local_path=None):
"""Return a configuration dictionary for usage in
configuration() function defined in file setup_<name>.py.
Modified: branches/numpy.scons/numpy/distutils/scons/configuration.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-10-31 12:44:57 UTC (rev 4365)
+++ branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-10-31 14:57:41 UTC (rev 4366)
@@ -1,30 +1,7 @@
#! /usr/bin/env python
# Last Change: Mon Oct 29 06:00 PM 2007 J
+import os
-class opt_info:
- def __init__(self, name, site = 0):
- """If not available, set name to ''."""
- self.name = name
- if len(name) > 0:
- self.available = 1
- else:
- self.available = 0
- self.site = site
-
- def __str__(self):
- if self.available:
- if self.site:
- msg = ['Tweaked from site.cfg']
- else:
- msg = ['Use %s' % self.name]
- else:
- msg = ['None available']
-
- return '\n'.join(msg)
-
- def __repr__(self):
- return self.__str__()
-
def add_info(env, name, opt):
cfg = env['NUMPY_PKG_CONFIG']
cfg[name] = opt
@@ -32,6 +9,9 @@
def write_info(env):
print "File is %s" % env['NUMPY_PKG_CONFIG_FILE']
print "Info is %s" % env['NUMPY_PKG_CONFIG']
+ dir = os.path.dirname(env['NUMPY_PKG_CONFIG_FILE'])
+ if not os.path.exists(dir):
+ os.makedirs()
f = open(env['NUMPY_PKG_CONFIG_FILE'], 'w')
f.writelines("config = %s" % str(env['NUMPY_PKG_CONFIG']))
f.close()
Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-31 12:44:57 UTC (rev 4365)
+++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-31 14:57:41 UTC (rev 4366)
@@ -5,7 +5,8 @@
from distutils.sysconfig import get_config_vars
-from numpy.distutils.command.scons import get_scons_build_dir
+from numpy.distutils.misc_util import get_scons_build_dir, get_scons_configres_dir,\
+ get_scons_configres_filename
from default import tool_list
from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension
@@ -221,6 +222,7 @@
# This will be used to keep configuration information on a per package basis
env['NUMPY_PKG_CONFIG'] = {}
- env['NUMPY_PKG_CONFIG_FILE'] = pjoin(env['build_dir'], '__configres.py')
+ env['NUMPY_PKG_CONFIG_FILE'] = pjoin(get_scons_configres_dir(), env['src_dir'],
+ get_scons_configres_filename())
return env
More information about the Numpy-svn
mailing list