From numpy-svn at scipy.org Tue Oct 2 00:07:21 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 1 Oct 2007 23:07:21 -0500 (CDT) Subject: [Numpy-svn] r4144 - trunk/numpy/testing Message-ID: <20071002040721.4A024C7C00D@new.scipy.org> Author: jarrod.millman Date: 2007-10-01 23:07:12 -0500 (Mon, 01 Oct 2007) New Revision: 4144 Modified: trunk/numpy/testing/numpytest.py Log: allow TestCase classes to be prefixed with either 'test' or 'Test' Modified: trunk/numpy/testing/numpytest.py =================================================================== --- trunk/numpy/testing/numpytest.py 2007-09-30 10:47:58 UTC (rev 4143) +++ trunk/numpy/testing/numpytest.py 2007-10-02 04:07:12 UTC (rev 4144) @@ -257,7 +257,7 @@ Old-style test_suite(level=1) hooks are also supported. """ - _check_testcase_name = re.compile(r'test.*').match + _check_testcase_name = re.compile(r'test.*|Test.*').match def check_testcase_name(self, name): """ Return True if name matches TestCase class. """ From numpy-svn at scipy.org Tue Oct 2 02:17:51 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 2 Oct 2007 01:17:51 -0500 (CDT) Subject: [Numpy-svn] r4145 - trunk/numpy/doc Message-ID: <20071002061751.815CBC7C037@new.scipy.org> Author: jarrod.millman Date: 2007-10-02 01:17:47 -0500 (Tue, 02 Oct 2007) New Revision: 4145 Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt Log: more on documentation Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt =================================================================== --- trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-02 04:07:12 UTC (rev 4144) +++ trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-02 06:17:47 UTC (rev 4145) @@ -1,12 +1,26 @@ -================================= -A Guide to NumPy/SciPy Docstrings -================================= +==================================== +A Guide to NumPy/SciPy Documentation +==================================== .. Contents:: Overview -------- +In general, we follow the standard Python style conventions as described here: + * `Style Guide for C Code `__ + * `Style Guide for Python Code `__ + * `Docstring Conventions `__ +Additional PEPs of interest regarding documentation of code: + * Docstring Processing System Framework `__ + * Docutils Design Specification `__ + +Use a code checker: + * `pylint `__ + +Docstring Standard +------------------ + A documentation string (docstring) is a string that describes a module, function, class, or method definition. The docstring is a special attribute of the object (``object.__doc__``) and, for consistency, is surrounded by From numpy-svn at scipy.org Tue Oct 2 02:19:03 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 2 Oct 2007 01:19:03 -0500 (CDT) Subject: [Numpy-svn] r4146 - trunk/numpy/doc Message-ID: <20071002061903.C99B0C7C037@new.scipy.org> Author: jarrod.millman Date: 2007-10-02 01:19:01 -0500 (Tue, 02 Oct 2007) New Revision: 4146 Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt Log: typo Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt =================================================================== --- trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-02 06:17:47 UTC (rev 4145) +++ trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-02 06:19:01 UTC (rev 4146) @@ -12,8 +12,10 @@ * `Docstring Conventions `__ Additional PEPs of interest regarding documentation of code: - * Docstring Processing System Framework `__ - * Docutils Design Specification `__ + * `Docstring Processing System Framework + `__ + * `Docutils Design Specification + `__ Use a code checker: * `pylint `__ From numpy-svn at scipy.org Tue Oct 2 02:19:47 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 2 Oct 2007 01:19:47 -0500 (CDT) Subject: [Numpy-svn] r4147 - trunk/numpy/doc Message-ID: <20071002061947.A679BC7C037@new.scipy.org> Author: jarrod.millman Date: 2007-10-02 01:19:44 -0500 (Tue, 02 Oct 2007) New Revision: 4147 Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt Log: trying to get the rest right Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt =================================================================== --- trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-02 06:19:01 UTC (rev 4146) +++ trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-02 06:19:44 UTC (rev 4147) @@ -13,7 +13,7 @@ Additional PEPs of interest regarding documentation of code: * `Docstring Processing System Framework - `__ +`__ * `Docutils Design Specification `__ From numpy-svn at scipy.org Tue Oct 2 02:21:42 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 2 Oct 2007 01:21:42 -0500 (CDT) Subject: [Numpy-svn] r4148 - trunk/numpy/doc Message-ID: <20071002062142.E5C53C7C037@new.scipy.org> Author: jarrod.millman Date: 2007-10-02 01:21:37 -0500 (Tue, 02 Oct 2007) New Revision: 4148 Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt Log: more rest corrections Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt =================================================================== --- trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-02 06:19:44 UTC (rev 4147) +++ trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-02 06:21:37 UTC (rev 4148) @@ -12,10 +12,8 @@ * `Docstring Conventions `__ Additional PEPs of interest regarding documentation of code: - * `Docstring Processing System Framework -`__ - * `Docutils Design Specification - `__ + * `Docstring Processing Framework `__ + * `Docutils Design Specification `__ Use a code checker: * `pylint `__ From numpy-svn at scipy.org Tue Oct 2 02:57:20 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 2 Oct 2007 01:57:20 -0500 (CDT) Subject: [Numpy-svn] r4149 - trunk/numpy/distutils Message-ID: <20071002065720.20BC5C7C037@new.scipy.org> Author: pearu Date: 2007-10-02 01:57:10 -0500 (Tue, 02 Oct 2007) New Revision: 4149 Modified: trunk/numpy/distutils/ccompiler.py Log: apply gen_lib_options overwrite only when a compiler module is imported Modified: trunk/numpy/distutils/ccompiler.py =================================================================== --- trunk/numpy/distutils/ccompiler.py 2007-10-02 06:21:37 UTC (rev 4148) +++ trunk/numpy/distutils/ccompiler.py 2007-10-02 06:57:10 UTC (rev 4149) @@ -388,9 +388,10 @@ # from distutils.ccompiler import gen_lib_options # Don't bother with mwerks, as we don't support Classic Mac. for _cc in ['msvc', 'bcpp', 'cygwinc', 'emxc', 'unixc']: - _m = __import__('distutils.'+_cc+'compiler') - setattr(getattr(_m, _cc+'compiler'), 'gen_lib_options', - gen_lib_options) + _m = sys.modules.get('distutils.'+_cc+'compiler') + if _m is not None: + setattr(getattr(_m, _cc+'compiler'), 'gen_lib_options', + gen_lib_options) _distutils_gen_preprocess_options = gen_preprocess_options def gen_preprocess_options (macros, include_dirs): From numpy-svn at scipy.org Tue Oct 2 03:32:10 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 2 Oct 2007 02:32:10 -0500 (CDT) Subject: [Numpy-svn] r4150 - trunk/numpy/distutils Message-ID: <20071002073210.88A06C7C037@new.scipy.org> Author: cookedm Date: 2007-10-02 02:32:06 -0500 (Tue, 02 Oct 2007) New Revision: 4150 Modified: trunk/numpy/distutils/cpuinfo.py Log: Remove use of the string module in distutils/cpuinfo.py Modified: trunk/numpy/distutils/cpuinfo.py =================================================================== --- trunk/numpy/distutils/cpuinfo.py 2007-10-02 06:57:10 UTC (rev 4149) +++ trunk/numpy/distutils/cpuinfo.py 2007-10-02 07:32:06 UTC (rev 4150) @@ -21,9 +21,10 @@ __all__ = ['cpu'] -import sys,string,re,types +import sys, re, types +import commands -class cpuinfo_base: +class cpuinfo_base(object): """Holds CPU information and provides methods for requiring the availability of various CPU features. """ @@ -60,18 +61,17 @@ info = [] try: for line in open('/proc/cpuinfo').readlines(): - name_value = map(string.strip,string.split(line,':',1)) + name_value = [s.strip() for s in line.split(':', 1)] if len(name_value)!=2: continue name,value = name_value if not info or info[-1].has_key(name): # next processor info.append({}) info[-1][name] = value - import commands status,output = commands.getstatusoutput('uname -m') if not status: if not info: info.append({}) - info[-1]['uname_m'] = string.strip(output) + info[-1]['uname_m'] = output.strip() except: print sys.exc_value,'(ignoring)' self.__class__.info = info @@ -257,12 +257,11 @@ return info = [] try: - import commands status,output = commands.getstatusoutput('sysconf') if status not in [0,256]: return for line in output.split('\n'): - name_value = map(string.strip,string.split(line,' ',1)) + name_value = [s.strip() for s in line.split(' ', 1)] if len(name_value)!=2: continue name,value = name_value @@ -330,21 +329,20 @@ return info = [] try: - import commands status,output = commands.getstatusoutput('arch') if not status: if not info: info.append({}) - info[-1]['arch'] = string.strip(output) + info[-1]['arch'] = output.strip() status,output = commands.getstatusoutput('machine') if not status: if not info: info.append({}) - info[-1]['machine'] = string.strip(output) + info[-1]['machine'] = output.strip() status,output = commands.getstatusoutput('sysctl hw') if not status: if not info: info.append({}) d = {} - for l in string.split(output,'\n'): - l = map(string.strip,string.split(l, '=')) + for l in output.splitlines(): + l = [s.strip() for s in l.split('=')] if len(l)==2: d[l[0]]=l[1] info[-1]['sysctl_hw'] = d @@ -396,40 +394,44 @@ return info = [] try: - import commands status,output = commands.getstatusoutput('arch') if not status: - if not info: info.append({}) - info[-1]['arch'] = string.strip(output) + if not info: + info.append({}) + info[-1]['arch'] = output.strip() status,output = commands.getstatusoutput('mach') if not status: - if not info: info.append({}) - info[-1]['mach'] = string.strip(output) + if not info: + info.append({}) + info[-1]['mach'] = output.strip() status,output = commands.getstatusoutput('uname -i') if not status: - if not info: info.append({}) - info[-1]['uname_i'] = string.strip(output) + if not info: + info.append({}) + info[-1]['uname_i'] = output.strip() status,output = commands.getstatusoutput('uname -X') if not status: if not info: info.append({}) d = {} - for l in string.split(output,'\n'): - l = map(string.strip,string.split(l, '=')) + for l in output.splitlines(): + l = [s.strip() for s in l.split('=')] if len(l)==2: d[l[0]]=l[1] info[-1]['uname_X'] = d status,output = commands.getstatusoutput('isainfo -b') if not status: - if not info: info.append({}) - info[-1]['isainfo_b'] = string.strip(output) + if not info: + info.append({}) + info[-1]['isainfo_b'] = output.strip() status,output = commands.getstatusoutput('isainfo -n') if not status: - if not info: info.append({}) - info[-1]['isainfo_n'] = string.strip(output) + if not info: + info.append({}) + info[-1]['isainfo_n'] = output.strip() status,output = commands.getstatusoutput('psrinfo -v 0') if not status: if not info: info.append({}) - for l in string.split(output,'\n'): + for l in output.splitlines(): m = re.match(r'\s*The (?P

[\w\d]+) processor operates at',l) if m: info[-1]['processor'] = m.group('p') From numpy-svn at scipy.org Tue Oct 2 03:56:48 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 2 Oct 2007 02:56:48 -0500 (CDT) Subject: [Numpy-svn] r4151 - in trunk/numpy: core/tests distutils/tests distutils/tests/f2py_ext/tests distutils/tests/f2py_f90_ext/tests distutils/tests/gen_ext/tests distutils/tests/pyrex_ext/tests distutils/tests/swig_ext/tests f2py/lib/parser f2py/lib/tests fft/tests lib/tests random/tests tests Message-ID: <20071002075648.CBD8D39C11C@new.scipy.org> Author: stefan Date: 2007-10-02 02:54:11 -0500 (Tue, 02 Oct 2007) New Revision: 4151 Modified: trunk/numpy/core/tests/test_defmatrix.py trunk/numpy/core/tests/test_errstate.py trunk/numpy/core/tests/test_ma.py trunk/numpy/core/tests/test_multiarray.py trunk/numpy/core/tests/test_numeric.py trunk/numpy/core/tests/test_numerictypes.py trunk/numpy/core/tests/test_records.py trunk/numpy/core/tests/test_regression.py trunk/numpy/core/tests/test_scalarmath.py trunk/numpy/core/tests/test_umath.py trunk/numpy/distutils/tests/f2py_ext/tests/test_fib2.py trunk/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py trunk/numpy/distutils/tests/gen_ext/tests/test_fib3.py trunk/numpy/distutils/tests/pyrex_ext/tests/test_primes.py trunk/numpy/distutils/tests/swig_ext/tests/test_example.py trunk/numpy/distutils/tests/swig_ext/tests/test_example2.py trunk/numpy/distutils/tests/test_fcompiler_gnu.py trunk/numpy/distutils/tests/test_misc_util.py trunk/numpy/f2py/lib/parser/test_Fortran2003.py trunk/numpy/f2py/lib/parser/test_parser.py trunk/numpy/f2py/lib/tests/test_derived_scalar.py trunk/numpy/f2py/lib/tests/test_module_module.py trunk/numpy/f2py/lib/tests/test_module_scalar.py trunk/numpy/f2py/lib/tests/test_scalar_function_in.py trunk/numpy/f2py/lib/tests/test_scalar_in_out.py trunk/numpy/fft/tests/test_fftpack.py trunk/numpy/fft/tests/test_helper.py trunk/numpy/lib/tests/test_arraysetops.py trunk/numpy/lib/tests/test_function_base.py trunk/numpy/lib/tests/test_getlimits.py trunk/numpy/lib/tests/test_index_tricks.py trunk/numpy/lib/tests/test_polynomial.py trunk/numpy/lib/tests/test_shape_base.py trunk/numpy/lib/tests/test_twodim_base.py trunk/numpy/lib/tests/test_type_check.py trunk/numpy/lib/tests/test_ufunclike.py trunk/numpy/random/tests/test_random.py trunk/numpy/tests/test_ctypeslib.py Log: Rename test classes to CapWords. Modified: trunk/numpy/core/tests/test_defmatrix.py =================================================================== --- trunk/numpy/core/tests/test_defmatrix.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/core/tests/test_defmatrix.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -4,7 +4,7 @@ from numpy.core import * restore_path() -class test_ctor(NumpyTestCase): +class TestCtor(NumpyTestCase): def check_basic(self): A = array([[1,2],[3,4]]) mA = matrix(A) @@ -23,7 +23,7 @@ mvec = matrix(vec) assert mvec.shape == (1,5) -class test_properties(NumpyTestCase): +class TestProperties(NumpyTestCase): def check_sum(self): """Test whether matrix.sum(axis=1) preserves orientation. Fails in NumPy <= 0.9.6.2127. @@ -91,7 +91,7 @@ assert A.sum() == matrix(2) assert A.mean() == matrix(0.5) -class test_casting(NumpyTestCase): +class TestCasting(NumpyTestCase): def check_basic(self): A = arange(100).reshape(10,10) mA = matrix(A) @@ -109,7 +109,7 @@ assert mC.dtype.type == complex128 assert all(mA != mB) -class test_algebra(NumpyTestCase): +class TestAlgebra(NumpyTestCase): def check_basic(self): import numpy.linalg as linalg @@ -132,7 +132,7 @@ assert allclose((mA + mA).A, (A + A)) assert allclose((3*mA).A, (3*A)) -class test_matrix_return(NumpyTestCase): +class TestMatrixReturn(NumpyTestCase): def check_instance_methods(self): a = matrix([1.0], dtype='f8') methodargs = { @@ -171,7 +171,7 @@ assert type(c) is matrix assert type(d) is matrix -class test_indexing(NumpyTestCase): +class TestIndexing(NumpyTestCase): def check_basic(self): x = asmatrix(zeros((3,2),float)) y = zeros((3,1),float) Modified: trunk/numpy/core/tests/test_errstate.py =================================================================== --- trunk/numpy/core/tests/test_errstate.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/core/tests/test_errstate.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -14,7 +14,7 @@ -class test_errstate(NumpyTestCase): +class TestErrstate(NumpyTestCase): def test_invalid(self): Modified: trunk/numpy/core/tests/test_ma.py =================================================================== --- trunk/numpy/core/tests/test_ma.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/core/tests/test_ma.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -13,7 +13,7 @@ %s"""% (msg, str(v), str(w)) return result -class test_ma(NumpyTestCase): +class TestMa(NumpyTestCase): def __init__(self, *args, **kwds): NumpyTestCase.__init__(self, *args, **kwds) self.setUp() @@ -647,7 +647,7 @@ self.failUnlessEqual(b[0].shape, ()) self.failUnlessEqual(b[1].shape, ()) -class test_ufuncs(NumpyTestCase): +class TestUfuncs(NumpyTestCase): def setUp(self): self.d = (array([1.0, 0, -1, pi/2]*2, mask=[0,1]+[0]*6), array([1.0, 0, -1, pi/2]*2, mask=[1,0]+[0]*6),) @@ -714,7 +714,7 @@ self.failUnless(eq(nonzero(x), [0])) -class test_array_methods(NumpyTestCase): +class TestArrayMethods(NumpyTestCase): def setUp(self): x = numpy.array([ 8.375, 7.545, 8.828, 8.5 , 1.757, 5.928, Modified: trunk/numpy/core/tests/test_multiarray.py =================================================================== --- trunk/numpy/core/tests/test_multiarray.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/core/tests/test_multiarray.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -3,7 +3,7 @@ from numpy import random import numpy as N -class test_flags(NumpyTestCase): +class TestFlags(NumpyTestCase): def setUp(self): self.a = arange(10) @@ -27,7 +27,7 @@ assert_equal(self.a.flags.updateifcopy, False) -class test_attributes(NumpyTestCase): +class TestAttributes(NumpyTestCase): def setUp(self): self.one = arange(10) self.two = arange(20).reshape(4,5) @@ -104,14 +104,14 @@ x.fill(x[0]) assert_equal(x['f1'][1], x['f1'][0]) -class test_dtypedescr(NumpyTestCase): +class TestDtypedescr(NumpyTestCase): def check_construction(self): d1 = dtype('i4') assert_equal(d1, dtype(int32)) d2 = dtype('f8') assert_equal(d2, dtype(float64)) -class test_fromstring(NumpyTestCase): +class TestFromstring(NumpyTestCase): def check_binary(self): a = fromstring('\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@',dtype=' g2, [g1[i] > g2[i] for i in [0,1,2]]) -class test_argmax(NumpyTestCase): +class TestArgmax(NumpyTestCase): def check_all(self): a = random.normal(0,1,(4,5,6,7,8)) for i in xrange(a.ndim): @@ -363,13 +363,13 @@ axes.remove(i) assert all(amax == aargmax.choose(*a.transpose(i,*axes))) -class test_newaxis(NumpyTestCase): +class TestNewaxis(NumpyTestCase): def check_basic(self): sk = array([0,-0.1,0.1]) res = 250*sk[:,newaxis] assert_almost_equal(res.ravel(),250*sk) -class test_clip(NumpyTestCase): +class TestClip(NumpyTestCase): def _check_range(self,x,cmin,cmax): assert N.all(x >= cmin) assert N.all(x <= cmax) Modified: trunk/numpy/core/tests/test_numeric.py =================================================================== --- trunk/numpy/core/tests/test_numeric.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/core/tests/test_numeric.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -31,7 +31,7 @@ return "Vec("+repr(self.array.tolist())+")" __str__=__repr__ -class test_dot(NumpyTestCase): +class TestDot(NumpyTestCase): def setUp(self): self.A = rand(10,8) self.b1 = rand(8,1) @@ -141,7 +141,7 @@ assert_equal(zeros[1].array, zeros_test[1].array) -class test_bool_scalar(NumpyTestCase): +class TestBoolScalar(NumpyTestCase): def test_logical(self): f = False_ t = True_ @@ -174,7 +174,7 @@ self.failUnless((f ^ f) is f) -class test_seterr(NumpyTestCase): +class TestSeterr(NumpyTestCase): def test_set(self): err = seterr() old = seterr(divide='warn') @@ -198,7 +198,7 @@ array([1.]) / array([0.]) -class test_fromiter(NumpyTestCase): +class TestFromiter(NumpyTestCase): def makegen(self): for x in xrange(24): @@ -232,7 +232,7 @@ self.failUnless(alltrue(a == expected,axis=0)) self.failUnless(alltrue(a20 == expected[:20],axis=0)) -class test_index(NumpyTestCase): +class TestIndex(NumpyTestCase): def test_boolean(self): a = rand(3,5,8) V = rand(5,8) @@ -241,7 +241,7 @@ V[g1,g2] = -V[g1,g2] assert (array([a[0][V>0],a[1][V>0],a[2][V>0]]) == a[:,V>0]).all() -class test_binary_repr(NumpyTestCase): +class TestBinaryRepr(NumpyTestCase): def test_zero(self): assert_equal(binary_repr(0),'0') @@ -260,7 +260,7 @@ assert x.dtype.isnative == y.dtype.isnative -class test_clip(NumpyTestCase): +class TestClip(NumpyTestCase): def setUp(self): self.nr = 5 self.nc = 3 Modified: trunk/numpy/core/tests/test_numerictypes.py =================================================================== --- trunk/numpy/core/tests/test_numerictypes.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/core/tests/test_numerictypes.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -331,7 +331,7 @@ multiple_rows = True _buffer = NbufferT -class test_empty_field(NumpyTestCase): +class TestEmptyField(NumpyTestCase): def check_assign(self): a = numpy.arange(10, dtype=numpy.float32) a.dtype = [("int", "<0i4"),("float", "<2f4")] Modified: trunk/numpy/core/tests/test_records.py =================================================================== --- trunk/numpy/core/tests/test_records.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/core/tests/test_records.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -6,7 +6,7 @@ from numpy.core import * restore_path() -class test_fromrecords(NumpyTestCase): +class TestFromrecords(NumpyTestCase): def check_fromrecords(self): r = rec.fromrecords([[456,'dbe',1.2],[2,'de',1.3]],names='col1,col2,col3') assert_equal(r[0].item(),(456, 'dbe', 1.2)) @@ -85,7 +85,7 @@ assert_array_equal(ra['field'], [[5,5,5]]) assert callable(ra.field) -class test_record(NumpyTestCase): +class TestRecord(NumpyTestCase): def setUp(self): self.data = rec.fromrecords([(1,2,3),(4,5,6)], dtype=[("col1", "= rc) -class test_regression(NumpyTestCase): +class TestRegression(NumpyTestCase): def check_invalid_round(self,level=rlevel): """Ticket #3""" v = 4.7599999999999998 Modified: trunk/numpy/core/tests/test_scalarmath.py =================================================================== --- trunk/numpy/core/tests/test_scalarmath.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/core/tests/test_scalarmath.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -12,7 +12,7 @@ # This compares scalarmath against ufuncs. -class test_types(NumpyTestCase): +class TestTypes(NumpyTestCase): def check_types(self, level=1): for atype in types: a = atype(1) @@ -38,7 +38,7 @@ b = atype([1,2,3]) assert_equal(a,b) -class test_power(NumpyTestCase): +class TestPower(NumpyTestCase): def check_small_types(self): for t in [N.int8, N.int16]: a = t(3) @@ -51,7 +51,7 @@ b = a ** 4 assert b == 6765201, "error with %r: got %r" % (t,b) -class test_conversion(NumpyTestCase): +class TestConversion(NumpyTestCase): def test_int_from_long(self): l = [1e6, 1e12, 1e18, -1e6, -1e12, -1e18] li = [10**6, 10**12, 10**18, -10**6, -10**12, -10**18] Modified: trunk/numpy/core/tests/test_umath.py =================================================================== --- trunk/numpy/core/tests/test_umath.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/core/tests/test_umath.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -5,7 +5,7 @@ from numpy import zeros, ndarray, array, choose restore_path() -class test_division(NumpyTestCase): +class TestDivision(NumpyTestCase): def check_division_int(self): # int division should return the floor of the result, a la Python x = array([5, 10, 90, 100, -5, -10, -90, -100, -120]) @@ -13,7 +13,7 @@ assert_equal(x // 100, [0, 0, 0, 1, -1, -1, -1, -1, -2]) assert_equal(x % 100, [5, 10, 90, 0, 95, 90, 10, 0, 80]) -class test_power(NumpyTestCase): +class TestPower(NumpyTestCase): def check_power_float(self): x = array([1., 2., 3.]) assert_equal(x**0, [1., 1., 1.]) @@ -38,30 +38,30 @@ assert_almost_equal(x**14, [-76443+16124j, 23161315+58317492j, 5583548873 + 2465133864j]) -class test_log1p(NumpyTestCase): +class TestLog1p(NumpyTestCase): def check_log1p(self): assert_almost_equal(ncu.log1p(0.2), ncu.log(1.2)) assert_almost_equal(ncu.log1p(1e-6), ncu.log(1+1e-6)) -class test_expm1(NumpyTestCase): +class TestExpm1(NumpyTestCase): def check_expm1(self): assert_almost_equal(ncu.expm1(0.2), ncu.exp(0.2)-1) assert_almost_equal(ncu.expm1(1e-6), ncu.exp(1e-6)-1) -class test_maximum(NumpyTestCase): +class TestMaximum(NumpyTestCase): def check_reduce_complex(self): assert_equal(maximum.reduce([1,2j]),1) assert_equal(maximum.reduce([1+3j,2j]),1+3j) -class test_minimum(NumpyTestCase): +class TestMinimum(NumpyTestCase): def check_reduce_complex(self): assert_equal(minimum.reduce([1,2j]),2j) -class test_floating_point(NumpyTestCase): +class TestFloatingPoint(NumpyTestCase): def check_floating_point(self): assert_equal(ncu.FLOATING_POINT_SUPPORT, 1) -class test_special_methods(NumpyTestCase): +class TestSpecialMethods(NumpyTestCase): def test_wrap(self): class with_wrap(object): def __array__(self): @@ -163,7 +163,7 @@ assert_equal(maximum(a, B()), 0) assert_equal(maximum(a, C()), 0) -class test_choose(NumpyTestCase): +class TestChoose(NumpyTestCase): def test_mixed(self): c = array([True,True]) a = array([True,True]) @@ -183,7 +183,7 @@ assert_almost_equal(fun(self.x),cr.real) assert_almost_equal(0, cr.imag) -class test_choose(NumpyTestCase): +class TestChoose(NumpyTestCase): def test_attributes(self): add = ncu.add assert_equal(add.__name__, 'add') Modified: trunk/numpy/distutils/tests/f2py_ext/tests/test_fib2.py =================================================================== --- trunk/numpy/distutils/tests/f2py_ext/tests/test_fib2.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/distutils/tests/f2py_ext/tests/test_fib2.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -4,7 +4,7 @@ from f2py_ext import fib2 del sys.path[0] -class test_fib2(NumpyTestCase): +class TestFib2(NumpyTestCase): def check_fib(self): assert_array_equal(fib2.fib(6),[0,1,1,2,3,5]) Modified: trunk/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py =================================================================== --- trunk/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -4,7 +4,7 @@ from f2py_f90_ext import foo del sys.path[0] -class test_foo(NumpyTestCase): +class TestFoo(NumpyTestCase): def check_foo_free(self): assert_equal(foo.foo_free.bar13(),13) Modified: trunk/numpy/distutils/tests/gen_ext/tests/test_fib3.py =================================================================== --- trunk/numpy/distutils/tests/gen_ext/tests/test_fib3.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/distutils/tests/gen_ext/tests/test_fib3.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -4,7 +4,7 @@ from gen_ext import fib3 del sys.path[0] -class test_fib3(NumpyTestCase): +class TestFib3(NumpyTestCase): def check_fib(self): assert_array_equal(fib3.fib(6),[0,1,1,2,3,5]) Modified: trunk/numpy/distutils/tests/pyrex_ext/tests/test_primes.py =================================================================== --- trunk/numpy/distutils/tests/pyrex_ext/tests/test_primes.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/distutils/tests/pyrex_ext/tests/test_primes.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -5,7 +5,7 @@ from pyrex_ext.primes import primes restore_path() -class test_primes(NumpyTestCase): +class TestPrimes(NumpyTestCase): def check_simple(self, level=1): l = primes(10) assert_equal(l, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]) Modified: trunk/numpy/distutils/tests/swig_ext/tests/test_example.py =================================================================== --- trunk/numpy/distutils/tests/swig_ext/tests/test_example.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/distutils/tests/swig_ext/tests/test_example.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -4,7 +4,7 @@ from swig_ext import example restore_path() -class test_example(NumpyTestCase): +class TestExample(NumpyTestCase): def check_fact(self): assert_equal(example.fact(10),3628800) Modified: trunk/numpy/distutils/tests/swig_ext/tests/test_example2.py =================================================================== --- trunk/numpy/distutils/tests/swig_ext/tests/test_example2.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/distutils/tests/swig_ext/tests/test_example2.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -4,7 +4,7 @@ from swig_ext import example2 restore_path() -class test_example2(NumpyTestCase): +class TestExample2(NumpyTestCase): def check_zoo(self): z = example2.Zoo() Modified: trunk/numpy/distutils/tests/test_fcompiler_gnu.py =================================================================== --- trunk/numpy/distutils/tests/test_fcompiler_gnu.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/distutils/tests/test_fcompiler_gnu.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -21,7 +21,7 @@ ('GNU Fortran (GCC) 4.3.0 20070316 (experimental)', '4.3.0'), ] -class test_g77_versions(NumpyTestCase): +class TestG77Versions(NumpyTestCase): def test_g77_version(self): fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu') for vs, version in g77_version_strings: @@ -34,7 +34,7 @@ v = fc.version_match(vs) assert v is None, (vs, v) -class test_gortran_versions(NumpyTestCase): +class TestGortranVersions(NumpyTestCase): def test_gfortran_version(self): fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu95') for vs, version in gfortran_version_strings: Modified: trunk/numpy/distutils/tests/test_misc_util.py =================================================================== --- trunk/numpy/distutils/tests/test_misc_util.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/distutils/tests/test_misc_util.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -8,7 +8,7 @@ ajoin = lambda *paths: join(*((sep,)+paths)) -class test_appendpath(NumpyTestCase): +class TestAppendpath(NumpyTestCase): def check_1(self): assert_equal(appendpath('prefix','name'),join('prefix','name')) @@ -32,7 +32,7 @@ assert_equal(appendpath('/prefix/sub/sub2','/prefix/sub/sup/name'), ajoin('prefix','sub','sub2','sup','name')) -class test_minrelpath(NumpyTestCase): +class TestMinrelpath(NumpyTestCase): def check_1(self): import os @@ -47,7 +47,7 @@ assert_equal(minrelpath(n('.././..')),n('../..')) assert_equal(minrelpath(n('aa/bb/.././../dd')),n('dd')) -class test_gpaths(NumpyTestCase): +class TestGpaths(NumpyTestCase): def check_gpaths(self): local_path = minrelpath(os.path.join(os.path.dirname(__file__),'..')) Modified: trunk/numpy/f2py/lib/parser/test_Fortran2003.py =================================================================== --- trunk/numpy/f2py/lib/parser/test_Fortran2003.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/f2py/lib/parser/test_Fortran2003.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -7,7 +7,7 @@ ############################### SECTION 2 #################################### ############################################################################### -class test_Program(NumpyTestCase): # R201 +class TestProgram(NumpyTestCase): # R201 def check_simple(self): reader = get_reader('''\ @@ -21,7 +21,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a), 'SUBROUTINE foo\nEND SUBROUTINE foo\nSUBROUTINE bar\nEND SUBROUTINE bar') -class test_Specification_Part(NumpyTestCase): # R204 +class TestSpecificationPart(NumpyTestCase): # R204 def check_simple(self): from api import get_reader @@ -37,7 +37,7 @@ ############################### SECTION 3 #################################### ############################################################################### -class test_Name(NumpyTestCase): # R304 +class TestName(NumpyTestCase): # R304 def check_name(self): a = Name('a') @@ -55,7 +55,7 @@ ############################### SECTION 4 #################################### ############################################################################### -class test_Type_Param_Value(NumpyTestCase): # 402 +class TestTypeParamValue(NumpyTestCase): # 402 def check_type_param_value(self): cls = Type_Param_Value @@ -72,7 +72,7 @@ assert isinstance(a,Level_2_Expr),`a` assert_equal(str(a),'1 + 2') -class test_Intrinsic_Type_Spec(NumpyTestCase): # R403 +class TestIntrinsicTypeSpec(NumpyTestCase): # R403 def check_intrinsic_type_spec(self): cls = Intrinsic_Type_Spec @@ -109,7 +109,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'DOUBLE PRECISION') -class test_Kind_Selector(NumpyTestCase): # R404 +class TestKindSelector(NumpyTestCase): # R404 def check_kind_selector(self): cls = Kind_Selector @@ -126,7 +126,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'*1') -class test_Signed_Int_Literal_Constant(NumpyTestCase): # R405 +class TestSignedIntLiteralConstant(NumpyTestCase): # R405 def check_int_literal_constant(self): cls = Signed_Int_Literal_Constant @@ -152,7 +152,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'+1976354279568241_8') -class test_Int_Literal_Constant(NumpyTestCase): # R406 +class TestIntLiteralConstant(NumpyTestCase): # R406 def check_int_literal_constant(self): cls = Int_Literal_Constant @@ -178,7 +178,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'1976354279568241_8') -class test_Binary_Constant(NumpyTestCase): # R412 +class TestBinaryConstant(NumpyTestCase): # R412 def check_boz_literal_constant(self): cls = Boz_Literal_Constant @@ -188,7 +188,7 @@ assert_equal(str(a),'B"01"') assert_equal(repr(a),"%s('B\"01\"')" % (bcls.__name__)) -class test_Octal_Constant(NumpyTestCase): # R413 +class TestOctalConstant(NumpyTestCase): # R413 def check_boz_literal_constant(self): cls = Boz_Literal_Constant @@ -198,7 +198,7 @@ assert_equal(str(a),'O"017"') assert_equal(repr(a),"%s('O\"017\"')" % (ocls.__name__)) -class test_Hex_Constant(NumpyTestCase): # R414 +class TestHexConstant(NumpyTestCase): # R414 def check_boz_literal_constant(self): cls = Boz_Literal_Constant @@ -208,7 +208,7 @@ assert_equal(str(a),'Z"01A"') assert_equal(repr(a),"%s('Z\"01A\"')" % (zcls.__name__)) -class test_Signed_Real_Literal_Constant(NumpyTestCase): # R416 +class TestSignedRealLiteralConstant(NumpyTestCase): # R416 def check_signed_real_literal_constant(self): cls = Signed_Real_Literal_Constant @@ -265,7 +265,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'-10.9E-17_quad') -class test_Real_Literal_Constant(NumpyTestCase): # R417 +class TestRealLiteralConstant(NumpyTestCase): # R417 def check_real_literal_constant(self): cls = Real_Literal_Constant @@ -326,7 +326,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'0.0D+0') -class test_Char_Selector(NumpyTestCase): # R424 +class TestCharSelector(NumpyTestCase): # R424 def check_char_selector(self): cls = Char_Selector @@ -352,7 +352,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'(LEN = 2, KIND = 8)') -class test_Complex_Literal_Constant(NumpyTestCase): # R421 +class TestComplexLiteralConstant(NumpyTestCase): # R421 def check_complex_literal_constant(self): cls = Complex_Literal_Constant @@ -374,7 +374,7 @@ assert_equal(str(a),'(0., PI)') -class test_Type_Name(NumpyTestCase): # C424 +class TestTypeName(NumpyTestCase): # C424 def check_simple(self): cls = Type_Name @@ -386,7 +386,7 @@ self.assertRaises(NoMatchError,cls,'integer') self.assertRaises(NoMatchError,cls,'doubleprecision') -class test_Length_Selector(NumpyTestCase): # R425 +class TestLengthSelector(NumpyTestCase): # R425 def check_length_selector(self): cls = Length_Selector @@ -399,7 +399,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'*2') -class test_Char_Length(NumpyTestCase): # R426 +class TestCharLength(NumpyTestCase): # R426 def check_char_length(self): cls = Char_Length @@ -420,7 +420,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'(:)') -class test_Char_Literal_Constant(NumpyTestCase): # R427 +class TestCharLiteralConstant(NumpyTestCase): # R427 def check_char_literal_constant(self): cls = Char_Literal_Constant @@ -454,7 +454,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'"hey ha(ada)\t"') -class test_Logical_Literal_Constant(NumpyTestCase): # R428 +class TestLogicalLiteralConstant(NumpyTestCase): # R428 def check_logical_literal_constant(self): cls = Logical_Literal_Constant @@ -475,7 +475,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'.TRUE._HA') -class test_Derived_Type_Stmt(NumpyTestCase): # R430 +class TestDerivedTypeStmt(NumpyTestCase): # R430 def check_simple(self): cls = Derived_Type_Stmt @@ -492,7 +492,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'TYPE, PRIVATE, ABSTRACT :: a(b, c)') -class test_Type_Name(NumpyTestCase): # C423 +class TestTypeName(NumpyTestCase): # C423 def check_simple(self): cls = Type_Name @@ -501,7 +501,7 @@ assert_equal(str(a),'a') assert_equal(repr(a),"Type_Name('a')") -class test_Type_Attr_Spec(NumpyTestCase): # R431 +class TestTypeAttrSpec(NumpyTestCase): # R431 def check_simple(self): cls = Type_Attr_Spec @@ -523,7 +523,7 @@ assert_equal(str(a),'PRIVATE') -class test_End_Type_Stmt(NumpyTestCase): # R433 +class TestEndTypeStmt(NumpyTestCase): # R433 def check_simple(self): cls = End_Type_Stmt @@ -536,7 +536,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'END TYPE a') -class test_Sequence_Stmt(NumpyTestCase): # R434 +class TestSequenceStmt(NumpyTestCase): # R434 def check_simple(self): cls = Sequence_Stmt @@ -545,7 +545,7 @@ assert_equal(str(a),'SEQUENCE') assert_equal(repr(a),"Sequence_Stmt('SEQUENCE')") -class test_Type_Param_Def_Stmt(NumpyTestCase): # R435 +class TestTypeParamDefStmt(NumpyTestCase): # R435 def check_simple(self): cls = Type_Param_Def_Stmt @@ -558,7 +558,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'INTEGER*2, LEN :: a = 3, b = 2 + c') -class test_Type_Param_Decl(NumpyTestCase): # R436 +class TestTypeParamDecl(NumpyTestCase): # R436 def check_simple(self): cls = Type_Param_Decl @@ -571,7 +571,7 @@ assert isinstance(a, Name),`a` assert_equal(str(a),'a') -class test_Type_Param_Attr_Spec(NumpyTestCase): # R437 +class TestTypeParamAttrSpec(NumpyTestCase): # R437 def check_simple(self): cls = Type_Param_Attr_Spec @@ -584,7 +584,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'LEN') -class test_Component_Attr_Spec(NumpyTestCase): # R441 +class TestComponentAttrSpec(NumpyTestCase): # R441 def check_simple(self): cls = Component_Attr_Spec @@ -605,7 +605,7 @@ assert isinstance(a, Access_Spec),`a` assert_equal(str(a),'PRIVATE') -class test_Component_Decl(NumpyTestCase): # R442 +class TestComponentDecl(NumpyTestCase): # R442 def check_simple(self): cls = Component_Decl @@ -626,7 +626,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a(1) => NULL') -class test_Final_Binding(NumpyTestCase): # R454 +class TestFinalBinding(NumpyTestCase): # R454 def check_simple(self): cls = Final_Binding @@ -639,7 +639,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'FINAL :: a') -class test_Derived_Type_Spec(NumpyTestCase): # R455 +class TestDerivedTypeSpec(NumpyTestCase): # R455 def check_simple(self): cls = Derived_Type_Spec @@ -660,7 +660,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'a()') -class test_Type_Param_Spec(NumpyTestCase): # R456 +class TestTypeParamSpec(NumpyTestCase): # R456 def check_type_param_spec(self): cls = Type_Param_Spec @@ -677,7 +677,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'k = :') -class test_Type_Param_Spec_List(NumpyTestCase): # R456-list +class TestTypeParamSpecList(NumpyTestCase): # R456-list def check_type_param_spec_list(self): cls = Type_Param_Spec_List @@ -694,7 +694,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'k = a, c, g = 1') -class test_Structure_Constructor_2(NumpyTestCase): # R457.b +class TestStructureConstructor2(NumpyTestCase): # R457.b def check_simple(self): cls = Structure_Constructor_2 @@ -707,7 +707,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Structure_Constructor(NumpyTestCase): # R457 +class TestStructureConstructor(NumpyTestCase): # R457 def check_structure_constructor(self): cls = Structure_Constructor @@ -729,7 +729,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Component_Spec(NumpyTestCase): # R458 +class TestComponentSpec(NumpyTestCase): # R458 def check_simple(self): cls = Component_Spec @@ -750,7 +750,7 @@ assert isinstance(a, Component_Spec),`a` assert_equal(str(a),'s = a % b') -class test_Component_Spec_List(NumpyTestCase): # R458-list +class TestComponentSpecList(NumpyTestCase): # R458-list def check_simple(self): cls = Component_Spec_List @@ -763,7 +763,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'k = a, c') -class test_Array_Constructor(NumpyTestCase): # R465 +class TestArrayConstructor(NumpyTestCase): # R465 def check_simple(self): cls = Array_Constructor @@ -785,7 +785,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'[INTEGER :: a, b]') -class test_Ac_Spec(NumpyTestCase): # R466 +class TestAcSpec(NumpyTestCase): # R466 def check_ac_spec(self): cls = Ac_Spec @@ -806,7 +806,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'INTEGER :: a, (a, b, n = 1, 5)') -class test_Ac_Value_List(NumpyTestCase): # R469-list +class TestAcValueList(NumpyTestCase): # R469-list def check_ac_value_list(self): cls = Ac_Value_List @@ -819,7 +819,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Ac_Implied_Do(NumpyTestCase): # R470 +class TestAcImpliedDo(NumpyTestCase): # R470 def check_ac_implied_do(self): cls = Ac_Implied_Do @@ -828,7 +828,7 @@ assert_equal(str(a),'(a, b, n = 1, 5)') assert_equal(repr(a),"Ac_Implied_Do(Ac_Value_List(',', (Name('a'), Name('b'))), Ac_Implied_Do_Control(Name('n'), [Int_Literal_Constant('1', None), Int_Literal_Constant('5', None)]))") -class test_Ac_Implied_Do_Control(NumpyTestCase): # R471 +class TestAcImpliedDoControl(NumpyTestCase): # R471 def check_ac_implied_do_control(self): cls = Ac_Implied_Do_Control @@ -845,7 +845,7 @@ ############################### SECTION 5 #################################### ############################################################################### -class test_Type_Declaration_Stmt(NumpyTestCase): # R501 +class TestTypeDeclarationStmt(NumpyTestCase): # R501 def check_simple(self): cls = Type_Declaration_Stmt @@ -869,7 +869,7 @@ a = cls('DOUBLE PRECISION ALPHA, BETA') assert isinstance(a, cls),`a` -class test_Declaration_Type_Spec(NumpyTestCase): # R502 +class TestDeclarationTypeSpec(NumpyTestCase): # R502 def check_simple(self): cls = Declaration_Type_Spec @@ -882,7 +882,7 @@ assert_equal(str(a), 'TYPE(foo)') assert_equal(repr(a), "Declaration_Type_Spec('TYPE', Type_Name('foo'))") -class test_Attr_Spec(NumpyTestCase): # R503 +class TestAttrSpec(NumpyTestCase): # R503 def check_simple(self): cls = Attr_Spec @@ -894,7 +894,7 @@ assert isinstance(a, Dimension_Attr_Spec),`a` assert_equal(str(a),'DIMENSION(a)') -class test_Dimension_Attr_Spec(NumpyTestCase): # R503.d +class TestDimensionAttrSpec(NumpyTestCase): # R503.d def check_simple(self): cls = Dimension_Attr_Spec @@ -903,7 +903,7 @@ assert_equal(str(a),'DIMENSION(a)') assert_equal(repr(a),"Dimension_Attr_Spec('DIMENSION', Explicit_Shape_Spec(None, Name('a')))") -class test_Intent_Attr_Spec(NumpyTestCase): # R503.f +class TestIntentAttrSpec(NumpyTestCase): # R503.f def check_simple(self): cls = Intent_Attr_Spec @@ -912,7 +912,7 @@ assert_equal(str(a),'INTENT(IN)') assert_equal(repr(a),"Intent_Attr_Spec('INTENT', Intent_Spec('IN'))") -class test_Entity_Decl(NumpyTestCase): # 504 +class TestEntityDecl(NumpyTestCase): # 504 def check_simple(self): cls = Entity_Decl @@ -929,7 +929,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a(1)*(3) = 2') -class test_Access_Spec(NumpyTestCase): # R508 +class TestAccessSpec(NumpyTestCase): # R508 def check_simple(self): cls = Access_Spec @@ -942,7 +942,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'PUBLIC') -class test_Language_Binding_Spec(NumpyTestCase): # R509 +class TestLanguageBindingSpec(NumpyTestCase): # R509 def check_simple(self): cls = Language_Binding_Spec @@ -955,7 +955,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'BIND(C, NAME = "hey")') -class test_Explicit_Shape_Spec(NumpyTestCase): # R511 +class TestExplicitShapeSpec(NumpyTestCase): # R511 def check_simple(self): cls = Explicit_Shape_Spec @@ -968,7 +968,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a') -class test_Upper_Bound(NumpyTestCase): # R513 +class TestUpperBound(NumpyTestCase): # R513 def check_simple(self): cls = Upper_Bound @@ -978,7 +978,7 @@ self.assertRaises(NoMatchError,cls,'*') -class test_Assumed_Shape_Spec(NumpyTestCase): # R514 +class TestAssumedShapeSpec(NumpyTestCase): # R514 def check_simple(self): cls = Assumed_Shape_Spec @@ -991,7 +991,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a :') -class test_Deferred_Shape_Spec(NumpyTestCase): # R515 +class TestDeferredShapeSpec(NumpyTestCase): # R515 def check_simple(self): cls = Deferred_Shape_Spec @@ -1001,7 +1001,7 @@ assert_equal(repr(a),'Deferred_Shape_Spec(None, None)') -class test_Assumed_Size_Spec(NumpyTestCase): # R516 +class TestAssumedSizeSpec(NumpyTestCase): # R516 def check_simple(self): cls = Assumed_Size_Spec @@ -1022,7 +1022,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a : b, 1 : *') -class test_Access_Stmt(NumpyTestCase): # R518 +class TestAccessStmt(NumpyTestCase): # R518 def check_simple(self): cls = Access_Stmt @@ -1039,7 +1039,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'PUBLIC :: a') -class test_Parameter_Stmt(NumpyTestCase): # R538 +class TestParameterStmt(NumpyTestCase): # R538 def check_simple(self): cls = Parameter_Stmt @@ -1056,7 +1056,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'PARAMETER(ONE = 1.0D+0, ZERO = 0.0D+0)') -class test_Named_Constant_Def(NumpyTestCase): # R539 +class TestNamedConstantDef(NumpyTestCase): # R539 def check_simple(self): cls = Named_Constant_Def @@ -1065,7 +1065,7 @@ assert_equal(str(a),'a = 1') assert_equal(repr(a),"Named_Constant_Def(Name('a'), Int_Literal_Constant('1', None))") -class test_Pointer_Decl(NumpyTestCase): # R541 +class TestPointerDecl(NumpyTestCase): # R541 def check_simple(self): cls = Pointer_Decl @@ -1078,7 +1078,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a(:, :)') -class test_Implicit_Stmt(NumpyTestCase): # R549 +class TestImplicitStmt(NumpyTestCase): # R549 def check_simple(self): cls = Implicit_Stmt @@ -1091,7 +1091,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'IMPLICIT REAL(A - D), DOUBLE PRECISION(R - T, X), TYPE(a)(Y - Z)') -class test_Implicit_Spec(NumpyTestCase): # R550 +class TestImplicitSpec(NumpyTestCase): # R550 def check_simple(self): cls = Implicit_Spec @@ -1104,7 +1104,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'DOUBLE COMPLEX(R, D - G)') -class test_Letter_Spec(NumpyTestCase): # R551 +class TestLetterSpec(NumpyTestCase): # R551 def check_simple(self): cls = Letter_Spec @@ -1117,7 +1117,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'D') -class test_Equivalence_Stmt(NumpyTestCase): # R554 +class TestEquivalenceStmt(NumpyTestCase): # R554 def check_simple(self): cls = Equivalence_Stmt @@ -1130,7 +1130,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'EQUIVALENCE(a, b, z), (b, l)') -class test_Common_Stmt(NumpyTestCase): # R557 +class TestCommonStmt(NumpyTestCase): # R557 def check_simple(self): cls = Common_Stmt @@ -1151,7 +1151,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'COMMON /name/ a, b(4, 5) // c /ljuks/ g(2)') -class test_Common_Block_Object(NumpyTestCase): # R558 +class TestCommonBlockObject(NumpyTestCase): # R558 def check_simple(self): cls = Common_Block_Object @@ -1169,7 +1169,7 @@ ############################### SECTION 6 #################################### ############################################################################### -class test_Substring(NumpyTestCase): # R609 +class TestSubstring(NumpyTestCase): # R609 def check_simple(self): cls = Substring @@ -1184,7 +1184,7 @@ assert_equal(repr(a),"Substring(Name('a'), Substring_Range(Int_Literal_Constant('1', None), Int_Literal_Constant('2', None)))") -class test_Substring_Range(NumpyTestCase): # R611 +class TestSubstringRange(NumpyTestCase): # R611 def check_simple(self): cls = Substring_Range @@ -1215,7 +1215,7 @@ assert_equal(str(a),': b') -class test_Data_Ref(NumpyTestCase): # R612 +class TestDataRef(NumpyTestCase): # R612 def check_data_ref(self): cls = Data_Ref @@ -1228,7 +1228,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Part_Ref(NumpyTestCase): # R613 +class TestPartRef(NumpyTestCase): # R613 def check_part_ref(self): cls = Part_Ref @@ -1236,7 +1236,7 @@ assert isinstance(a, Name),`a` assert_equal(str(a),'a') -class test_Type_Param_Inquiry(NumpyTestCase): # R615 +class TestTypeParamInquiry(NumpyTestCase): # R615 def check_simple(self): cls = Type_Param_Inquiry @@ -1246,7 +1246,7 @@ assert_equal(repr(a),"Type_Param_Inquiry(Name('a'), '%', Name('b'))") -class test_Array_Section(NumpyTestCase): # R617 +class TestArraySection(NumpyTestCase): # R617 def check_array_section(self): cls = Array_Section @@ -1260,7 +1260,7 @@ assert_equal(str(a),'a(2 :)') -class test_Section_Subscript(NumpyTestCase): # R619 +class TestSectionSubscript(NumpyTestCase): # R619 def check_simple(self): cls = Section_Subscript @@ -1273,7 +1273,7 @@ assert isinstance(a, Name),`a` assert_equal(str(a),'zzz') -class test_Section_Subscript_List(NumpyTestCase): # R619-list +class TestSectionSubscriptList(NumpyTestCase): # R619-list def check_simple(self): cls = Section_Subscript_List @@ -1290,7 +1290,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),': : 1, 3') -class test_Subscript_Triplet(NumpyTestCase): # R620 +class TestSubscriptTriplet(NumpyTestCase): # R620 def check_simple(self): cls = Subscript_Triplet @@ -1319,7 +1319,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'a + 1 :') -class test_Alloc_Opt(NumpyTestCase): # R624 +class TestAllocOpt(NumpyTestCase): # R624 def check_simple(self): cls = Alloc_Opt @@ -1328,7 +1328,7 @@ assert_equal(str(a),'STAT = a') assert_equal(repr(a),"Alloc_Opt('STAT', Name('a'))") -class test_Nullify_Stmt(NumpyTestCase): # R633 +class TestNullifyStmt(NumpyTestCase): # R633 def check_simple(self): cls = Nullify_Stmt @@ -1345,7 +1345,7 @@ ############################### SECTION 7 #################################### ############################################################################### -class test_Primary(NumpyTestCase): # R701 +class TestPrimary(NumpyTestCase): # R701 def check_simple(self): cls = Primary @@ -1401,7 +1401,7 @@ assert isinstance(a,Real_Literal_Constant),`a` assert_equal(str(a),'0.0E-1') -class test_Parenthesis(NumpyTestCase): # R701.h +class TestParenthesis(NumpyTestCase): # R701.h def check_simple(self): cls = Parenthesis @@ -1422,7 +1422,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'(a + (a + c))') -class test_Level_1_Expr(NumpyTestCase): # R702 +class TestLevel1Expr(NumpyTestCase): # R702 def check_simple(self): cls = Level_1_Expr @@ -1433,7 +1433,7 @@ self.assertRaises(NoMatchError,cls,'.not. a') -class test_Mult_Operand(NumpyTestCase): # R704 +class TestMultOperand(NumpyTestCase): # R704 def check_simple(self): cls = Mult_Operand @@ -1454,7 +1454,7 @@ assert isinstance(a,Real_Literal_Constant),`a` assert_equal(str(a),'0.0E-1') -class test_Add_Operand(NumpyTestCase): # R705 +class TestAddOperand(NumpyTestCase): # R705 def check_simple(self): cls = Add_Operand @@ -1475,7 +1475,7 @@ assert isinstance(a,Real_Literal_Constant),`a` assert_equal(str(a),'0.0E-1') -class test_Level_2_Expr(NumpyTestCase): # R706 +class TestLevel2Expr(NumpyTestCase): # R706 def check_simple(self): cls = Level_2_Expr @@ -1509,7 +1509,7 @@ assert_equal(str(a),'0.0E-1') -class test_Level_2_Unary_Expr(NumpyTestCase): +class TestLevel2UnaryExpr(NumpyTestCase): def check_simple(self): cls = Level_2_Unary_Expr @@ -1531,7 +1531,7 @@ assert_equal(str(a),'0.0E-1') -class test_Level_3_Expr(NumpyTestCase): # R710 +class TestLevel3Expr(NumpyTestCase): # R710 def check_simple(self): cls = Level_3_Expr @@ -1544,7 +1544,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'"a" // "b"') -class test_Level_4_Expr(NumpyTestCase): # R712 +class TestLevel4Expr(NumpyTestCase): # R712 def check_simple(self): cls = Level_4_Expr @@ -1593,7 +1593,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'a > b') -class test_And_Operand(NumpyTestCase): # R714 +class TestAndOperand(NumpyTestCase): # R714 def check_simple(self): cls = And_Operand @@ -1602,7 +1602,7 @@ assert_equal(str(a),'.NOT. a') assert_equal(repr(a),"And_Operand('.NOT.', Name('a'))") -class test_Or_Operand(NumpyTestCase): # R715 +class TestOrOperand(NumpyTestCase): # R715 def check_simple(self): cls = Or_Operand @@ -1612,7 +1612,7 @@ assert_equal(repr(a),"Or_Operand(Name('a'), '.AND.', Name('b'))") -class test_Equiv_Operand(NumpyTestCase): # R716 +class TestEquivOperand(NumpyTestCase): # R716 def check_simple(self): cls = Equiv_Operand @@ -1622,7 +1622,7 @@ assert_equal(repr(a),"Equiv_Operand(Name('a'), '.OR.', Name('b'))") -class test_Level_5_Expr(NumpyTestCase): # R717 +class TestLevel5Expr(NumpyTestCase): # R717 def check_simple(self): cls = Level_5_Expr @@ -1639,7 +1639,7 @@ assert isinstance(a,Level_4_Expr),`a` assert_equal(str(a),'a .EQ. b') -class test_Expr(NumpyTestCase): # R722 +class TestExpr(NumpyTestCase): # R722 def check_simple(self): cls = Expr @@ -1661,7 +1661,7 @@ self.assertRaises(NoMatchError,Scalar_Int_Expr,'a,b') -class test_Assignment_Stmt(NumpyTestCase): # R734 +class TestAssignmentStmt(NumpyTestCase): # R734 def check_simple(self): cls = Assignment_Stmt @@ -1678,7 +1678,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a % c = b + c') -class test_Proc_Component_Ref(NumpyTestCase): # R741 +class TestProcComponentRef(NumpyTestCase): # R741 def check_proc_component_ref(self): cls = Proc_Component_Ref @@ -1687,7 +1687,7 @@ assert_equal(str(a),'a % b') assert_equal(repr(a),"Proc_Component_Ref(Name('a'), '%', Name('b'))") -class test_Where_Stmt(NumpyTestCase): # R743 +class TestWhereStmt(NumpyTestCase): # R743 def check_simple(self): cls = Where_Stmt @@ -1696,7 +1696,7 @@ assert_equal(str(a),'WHERE (a) c = 2') assert_equal(repr(a),"Where_Stmt(Name('a'), Assignment_Stmt(Name('c'), '=', Int_Literal_Constant('2', None)))") -class test_Where_Construct_Stmt(NumpyTestCase): # R745 +class TestWhereConstructStmt(NumpyTestCase): # R745 def check_simple(self): cls = Where_Construct_Stmt @@ -1710,7 +1710,7 @@ ############################### SECTION 8 #################################### ############################################################################### -class test_Continue_Stmt(NumpyTestCase): # R848 +class TestContinueStmt(NumpyTestCase): # R848 def check_simple(self): cls = Continue_Stmt @@ -1723,7 +1723,7 @@ ############################### SECTION 9 #################################### ############################################################################### -class test_Io_Unit(NumpyTestCase): # R901 +class TestIoUnit(NumpyTestCase): # R901 def check_simple(self): cls = Io_Unit @@ -1735,7 +1735,7 @@ assert isinstance(a, Name),`a` assert_equal(str(a),'a') -class test_Write_Stmt(NumpyTestCase): # R911 +class TestWriteStmt(NumpyTestCase): # R911 def check_simple(self): cls = Write_Stmt @@ -1744,7 +1744,7 @@ assert_equal(str(a),'WRITE(UNIT = 123) "hey"') assert_equal(repr(a),'Write_Stmt(Io_Control_Spec_List(\',\', (Io_Control_Spec(\'UNIT\', Int_Literal_Constant(\'123\', None)),)), Char_Literal_Constant(\'"hey"\', None))') -class test_Print_Stmt(NumpyTestCase): # R912 +class TestPrintStmt(NumpyTestCase): # R912 def check_simple(self): cls = Print_Stmt @@ -1757,7 +1757,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'PRINT *, "a=", a') -class test_Io_Control_Spec(NumpyTestCase): # R913 +class TestIoControlSpec(NumpyTestCase): # R913 def check_simple(self): cls = Io_Control_Spec @@ -1766,7 +1766,7 @@ assert_equal(str(a),'END = 123') assert_equal(repr(a),"Io_Control_Spec('END', Label('123'))") -class test_Io_Control_Spec_List(NumpyTestCase): # R913-list +class TestIoControlSpecList(NumpyTestCase): # R913-list def check_simple(self): cls = Io_Control_Spec_List @@ -1793,7 +1793,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'UNIT = 123, NML = a') -class test_Format(NumpyTestCase): # R914 +class TestFormat(NumpyTestCase): # R914 def check_simple(self): cls = Format @@ -1810,7 +1810,7 @@ assert isinstance(a, Label),`a` assert_equal(str(a),'123') -class test_Wait_Stmt(NumpyTestCase): # R921 +class TestWaitStmt(NumpyTestCase): # R921 def check_simple(self): cls = Wait_Stmt @@ -1818,7 +1818,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'WAIT(UNIT = 123)') -class test_Wait_Spec(NumpyTestCase): # R922 +class TestWaitSpec(NumpyTestCase): # R922 def check_simple(self): cls = Wait_Spec @@ -1840,7 +1840,7 @@ ############################### SECTION 11 #################################### ############################################################################### -class test_Use_Stmt(NumpyTestCase): # R1109 +class TestUseStmt(NumpyTestCase): # R1109 def check_simple(self): cls = Use_Stmt @@ -1861,7 +1861,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'USE, INTRINSIC :: a, OPERATOR(.HEY.) => OPERATOR(.HOO.), c => g') -class test_Module_Nature(NumpyTestCase): # R1110 +class TestModuleNature(NumpyTestCase): # R1110 def check_simple(self): cls = Module_Nature @@ -1878,7 +1878,7 @@ ############################### SECTION 12 #################################### ############################################################################### -class test_Function_Reference(NumpyTestCase): # R1217 +class TestFunctionReference(NumpyTestCase): # R1217 def check_simple(self): cls = Function_Reference @@ -1892,7 +1892,7 @@ assert_equal(str(a),'f(2, k = 1, a)') -class test_Procedure_Designator(NumpyTestCase): # R1219 +class TestProcedureDesignator(NumpyTestCase): # R1219 def check_procedure_designator(self): cls = Procedure_Designator @@ -1901,7 +1901,7 @@ assert_equal(str(a),'a % b') assert_equal(repr(a),"Procedure_Designator(Name('a'), '%', Name('b'))") -class test_Actual_Arg_Spec(NumpyTestCase): # R1220 +class TestActualArgSpec(NumpyTestCase): # R1220 def check_simple(self): cls = Actual_Arg_Spec @@ -1914,7 +1914,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Actual_Arg_Spec_List(NumpyTestCase): +class TestActualArgSpecList(NumpyTestCase): def check_simple(self): cls = Actual_Arg_Spec_List @@ -1935,7 +1935,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Alt_Return_Spec(NumpyTestCase): # R1222 +class TestAltReturnSpec(NumpyTestCase): # R1222 def check_alt_return_spec(self): cls = Alt_Return_Spec @@ -1944,7 +1944,7 @@ assert_equal(str(a),'*123') assert_equal(repr(a),"Alt_Return_Spec(Label('123'))") -class test_Prefix(NumpyTestCase): # R1227 +class TestPrefix(NumpyTestCase): # R1227 def check_simple(self): cls = Prefix @@ -1957,7 +1957,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'INTEGER*2 PURE') -class test_Prefix_Spec(NumpyTestCase): # R1228 +class TestPrefixSpec(NumpyTestCase): # R1228 def check_simple(self): cls = Prefix_Spec @@ -1978,7 +1978,7 @@ assert isinstance(a, Intrinsic_Type_Spec),`a` assert_equal(str(a),'INTEGER*2') -class test_Subroutine_Subprogram(NumpyTestCase): # R1231 +class TestSubroutineSubprogram(NumpyTestCase): # R1231 def check_simple(self): from api import get_reader @@ -2000,7 +2000,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'SUBROUTINE foo\n INTEGER :: a\nEND SUBROUTINE foo') -class test_Subroutine_Stmt(NumpyTestCase): # R1232 +class TestSubroutineStmt(NumpyTestCase): # R1232 def check_simple(self): cls = Subroutine_Stmt @@ -2021,7 +2021,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'SUBROUTINE foo BIND(C)') -class test_End_Subroutine_Stmt(NumpyTestCase): # R1234 +class TestEndSubroutineStmt(NumpyTestCase): # R1234 def check_simple(self): cls = End_Subroutine_Stmt @@ -2038,7 +2038,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'END SUBROUTINE') -class test_Return_Stmt(NumpyTestCase): # R1236 +class TestReturnStmt(NumpyTestCase): # R1236 def check_simple(self): cls = Return_Stmt @@ -2047,7 +2047,7 @@ assert_equal(str(a), 'RETURN') assert_equal(repr(a), 'Return_Stmt(None)') -class test_Contains(NumpyTestCase): # R1237 +class TestContains(NumpyTestCase): # R1237 def check_simple(self): cls = Contains_Stmt Modified: trunk/numpy/f2py/lib/parser/test_parser.py =================================================================== --- trunk/numpy/f2py/lib/parser/test_parser.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/f2py/lib/parser/test_parser.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -34,7 +34,7 @@ return r raise ValueError, 'parsing %r with %s pattern failed' % (line, cls.__name__) -class test_Statements(NumpyTestCase): +class TestStatements(NumpyTestCase): def check_assignment(self): assert_equal(parse(Assignment,'a=b'), 'a = b') Modified: trunk/numpy/f2py/lib/tests/test_derived_scalar.py =================================================================== --- trunk/numpy/f2py/lib/tests/test_derived_scalar.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/f2py/lib/tests/test_derived_scalar.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -42,7 +42,7 @@ from numpy import * -class test_m(NumpyTestCase): +class TestM(NumpyTestCase): def check_foo_simple(self, level=1): a = m.myt(2) Modified: trunk/numpy/f2py/lib/tests/test_module_module.py =================================================================== --- trunk/numpy/f2py/lib/tests/test_module_module.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/f2py/lib/tests/test_module_module.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -51,7 +51,7 @@ from numpy import * -class test_m(NumpyTestCase): +class TestM(NumpyTestCase): def check_foo_simple(self, level=1): foo = m.foo Modified: trunk/numpy/f2py/lib/tests/test_module_scalar.py =================================================================== --- trunk/numpy/f2py/lib/tests/test_module_scalar.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/f2py/lib/tests/test_module_scalar.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -40,7 +40,7 @@ from numpy import * -class test_m(NumpyTestCase): +class TestM(NumpyTestCase): def check_foo_simple(self, level=1): foo = m.foo Modified: trunk/numpy/f2py/lib/tests/test_scalar_function_in.py =================================================================== --- trunk/numpy/f2py/lib/tests/test_scalar_function_in.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/f2py/lib/tests/test_scalar_function_in.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -107,7 +107,7 @@ from numpy import * -class test_m(NumpyTestCase): +class TestM(NumpyTestCase): def check_foo_integer1(self, level=1): i = int8(2) Modified: trunk/numpy/f2py/lib/tests/test_scalar_in_out.py =================================================================== --- trunk/numpy/f2py/lib/tests/test_scalar_in_out.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/f2py/lib/tests/test_scalar_in_out.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -104,7 +104,7 @@ from numpy import * -class test_m(NumpyTestCase): +class TestM(NumpyTestCase): def check_foo_integer1(self, level=1): i = int8(2) Modified: trunk/numpy/fft/tests/test_fftpack.py =================================================================== --- trunk/numpy/fft/tests/test_fftpack.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/fft/tests/test_fftpack.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -4,7 +4,7 @@ from numpy.fft import * restore_path() -class test_fftshift(NumpyTestCase): +class TestFFTShift(NumpyTestCase): def check_fft_n(self): self.failUnlessRaises(ValueError,fft,[1,2,3],0) Modified: trunk/numpy/fft/tests/test_helper.py =================================================================== --- trunk/numpy/fft/tests/test_helper.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/fft/tests/test_helper.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -14,7 +14,7 @@ def random(size): return rand(*size) -class test_fftshift(NumpyTestCase): +class TestFFTShift(NumpyTestCase): def check_definition(self): x = [0,1,2,3,4,-4,-3,-2,-1] @@ -31,7 +31,7 @@ x = random((n,)) assert_array_almost_equal(ifftshift(fftshift(x)),x) -class test_fftfreq(NumpyTestCase): +class TestFFTFreq(NumpyTestCase): def check_definition(self): x = [0,1,2,3,4,-4,-3,-2,-1] Modified: trunk/numpy/lib/tests/test_arraysetops.py =================================================================== --- trunk/numpy/lib/tests/test_arraysetops.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/lib/tests/test_arraysetops.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -11,7 +11,7 @@ ################################################## -class test_aso(NumpyTestCase): +class TestAso(NumpyTestCase): ## # 03.11.2005, c def check_unique1d( self ): Modified: trunk/numpy/lib/tests/test_function_base.py =================================================================== --- trunk/numpy/lib/tests/test_function_base.py 2007-10-02 07:32:06 UTC (rev 4150) +++ trunk/numpy/lib/tests/test_function_base.py 2007-10-02 07:54:11 UTC (rev 4151) @@ -7,7 +7,7 @@ from numpy.core import * del sys.path[0] -class test_any(NumpyTestCase): +class TestAny(NumpyTestCase): def check_basic(self): y1 = [0,0,1,0] y2 = [0,0,0,0] @@ -22,7 +22,7 @@ assert_array_equal(sometrue(y1,axis=0),[1,1,0]) assert_array_equal(sometrue(y1,axis=1),[0,1,1]) -class test_all(NumpyTestCase): +class TestAll(NumpyTestCase): def check_basic(self): y1 = [0,1,1,0] y2 = [0,0,0,0] @@ -38,7 +38,7 @@ assert_array_equal(alltrue(y1,axis=0),[0,0,1]) assert_array_equal(alltrue(y1,axis=1),[0,0,1]) -class test_average(NumpyTestCase): +class TestAverage(NumpyTestCase): def check_basic(self): y1 = array([1,2,3]) assert(average(y1,axis=0) == 2.) @@ -64,7 +64,7 @@ desired = array([3.,4.,5.]) assert_array_equal(actual, desired) -class test_select(NumpyTestCase): +class TestSelect(NumpyTestCase): def _select(self,cond,values,default=0): output = [] for m in range(len(cond)): @@ -84,7 +84,7 @@ assert_equal(len(choices),3) assert_equal(len(conditions),3) -class test_logspace(NumpyTestCase): +class TestLogspace(NumpyTestCase): def check_basic(self): y = logspace(0,6) assert(len(y)==50) @@ -95,7 +95,7 @@ y = logspace(0,6,num=7) assert_array_equal(y,[1,10,100,1e3,1e4,1e5,1e6]) -class test_linspace(NumpyTestCase): +class TestLinspace(NumpyTestCase): def check_basic(self): y = linspace(0,10) assert(len(y)==50) @@ -120,14 +120,14 @@ assert_equal(t1, t2) assert_equal(t2, t3) -class test_insert(NumpyTestCase): +class TestInsert(NumpyTestCase): def check_basic(self): a = [1,2,3] assert_equal(insert(a,0,1), [1,1,2,3]) assert_equal(insert(a,3,1), [1,2,3,1]) assert_equal(insert(a,[1,1,1],[1,2,3]), [1,1,2,3,2,3]) -class test_amax(NumpyTestCase): +class TestAmax(NumpyTestCase): def check_basic(self): a = [3,4,5,10,-3,-5,6.0] assert_equal(amax(a),10.0) @@ -137,7 +137,7 @@ assert_equal(amax(b,axis=0),[8.0,10.0,9.0]) assert_equal(amax(b,axis=1),[9.0,10.0,8.0]) -class test_amin(NumpyTestCase): +class TestAmin(NumpyTestCase): def check_basic(self): a = [3,4,5,10,-3,-5,6.0] assert_equal(amin(a),-5.0) @@ -147,7 +147,7 @@ assert_equal(amin(b,axis=0),[3.0,3.0,2.0]) assert_equal(amin(b,axis=1),[3.0,4.0,2.0]) -class test_ptp(NumpyTestCase): +class TestPtp(NumpyTestCase): def check_basic(self): a = [3,4,5,10,-3,-5,6.0] assert_equal(ptp(a,axis=0),15.0) @@ -157,7 +157,7 @@ assert_equal(ptp(b,axis=0),[5.0,7.0,7.0]) assert_equal(ptp(b,axis=-1),[6.0,6.0,6.0]) -class test_cumsum(NumpyTestCase): +class TestCumsum(NumpyTestCase): def check_basic(self): ba = [1,2,10,11,6,5,4] ba2 = [[1,2,3,4],[5,6,7,9],[10,3,4,5]] @@ -173,7 +173,7 @@ [5,11,18,27], [10,13,17,22]],ctype)) -class test_prod(NumpyTestCase): +class TestProd(NumpyTestCase): def check_basic(self): ba = [1,2,10,11,6,5,4] ba2 = [[1,2,3,4],[5,6,7,9],[10,3,4,5]] @@ -191,7 +191,7 @@ array([50,36,84,180],ctype)) assert_array_equal(prod(a2,axis=-1),array([24, 1890, 600],ctype)) -class test_cumprod(NumpyTestCase): +class TestCumprod(NumpyTestCase): def check_basic(self): ba = [1,2,10,11,6,5,4] ba2 = [[1,2,3,4],[5,6,7,9],[10,3,4,5]] @@ -216,7 +216,7 @@ [ 5, 30, 210, 1890], [10, 30, 120, 600]],ctype)) -class test_diff(NumpyTestCase): +class TestDiff(NumpyTestCase): def check_basic(self): x = [1,4,6,7,12] out = array([3,2,1,5]) @@ -237,7 +237,7 @@ assert_array_equal(diff(x,axis=0),out3) assert_array_equal(diff(x,n=2,axis=0),out4) -class test_angle(NumpyTestCase): +class TestAngle(NumpyTestCase): def check_basic(self): x = [1+3j,sqrt(2)/2.0+1j*sqrt(2)/2,1,1j,-1,-1j,1-3j,-1+3j] y = angle(x) @@ -248,7 +248,7 @@ assert_array_almost_equal(y,yo,11) assert_array_almost_equal(z,zo,11) -class test_trim_zeros(NumpyTestCase): +class TestTrimZeros(NumpyTestCase): """ only testing for integer splits. """ def check_basic(self): @@ -265,7 +265,7 @@ assert_array_equal(res,array([1,0,2,3,0,4])) -class test_extins(NumpyTestCase): +class TestExtins(NumpyTestCase): def check_basic(self): a = array([1,3,2,1,2,3,3]) b = extract(a>1,a) @@ -283,7 +283,7 @@ place(a,mask,c) assert_array_equal(a,ac) -class test_vectorize(NumpyTestCase): +class TestVectorize(NumpyTestCase): def check_simple(self): def addsubtract(a,b): if a > b: @@ -308,7 +308,7 @@ y = f(x) assert_array_equal(y, x) -class test_digitize(NumpyTestCase): +class TestDigitize(NumpyTestCase): def check_forward(self): x = arange(-6,5) bins = arange(-5,5) @@ -324,7 +324,7 @@ bin = linspace(x.min(), x.max(), 10) assert all(digitize(x,bin) != 0) -class test_unwrap(NumpyTestCase): +class TestUnwrap(NumpyTestCase): def check_simple(self): #check that unwrap removes jumps greather that 2*pi assert_array_equal(unwrap([1,1+2*pi]),[1,1]) @@ -332,7 +332,7 @@ assert(all(diff(unwrap(rand(10)*100)) Author: cookedm Date: 2007-10-02 14:14:52 -0500 (Tue, 02 Oct 2007) New Revision: 4152 Modified: trunk/numpy/distutils/cpuinfo.py Log: Update distutils/cpuinfo.py * convert class names to CamelCase * Add PentiumM to LinuxCPUInfo and Win32CPUInfo. Also add it to SSE2 detection. * remove is_Athlon64() and is_Operton() from Win32CPUInfo, and add is_AMD64(). We can't reliably distinguish between the two (or from other 64-bit Athlons). Also add is_AMD64() to LinuxCPUInfo. * Factor out common command output checking, and remove (most) of the bare try/excepts used in the __init__ methods (exception is Win32CPUInfo; don't know what exceptions could be thrown). Use warnings.warn instead of printing exceptions to stderr Modified: trunk/numpy/distutils/cpuinfo.py =================================================================== --- trunk/numpy/distutils/cpuinfo.py 2007-10-02 07:54:11 UTC (rev 4151) +++ trunk/numpy/distutils/cpuinfo.py 2007-10-02 19:14:52 UTC (rev 4152) @@ -8,23 +8,55 @@ terms of the NumPy (BSD style) license. See LICENSE.txt that came with this distribution for specifics. -Note: This should be merged into proc at some point. Perhaps proc should -be returning classes like this instead of using dictionaries. - NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. -$Revision: 1.1 $ -$Date: 2005/04/09 19:29:34 $ Pearu Peterson """ -__version__ = "$Id: cpuinfo.py,v 1.1 2005/04/09 19:29:34 pearu Exp $" - __all__ = ['cpu'] import sys, re, types +import os import commands +import warnings -class cpuinfo_base(object): +def getoutput(cmd, successful_status=(0,), stacklevel=1): + try: + status, output = commands.getstatusoutput(cmd) + except EnvironmentError, e: + warnings.warn(str(e), UserWarning, stacklevel=stacklevel) + return False, output + if os.WIFEXITED(status) and os.WEXITSTATUS(status) in successful_status: + return True, output + return False, output + +def command_info(successful_status=(0,), stacklevel=1, **kw): + info = {} + for key in kw: + ok, output = getoutput(kw[key], successful_status=successful_status, + stacklevel=stacklevel+1) + if ok: + info[key] = output.strip() + return info + +def command_by_line(cmd, successful_status=(0,), stacklevel=1): + ok, output = getoutput(cmd, successful_status=successful_status, + stacklevel=stacklevel+1) + if not ok: + return + for line in output.splitlines(): + yield line.strip() + +def key_value_from_command(cmd, sep, successful_status=(0,), + stacklevel=1): + d = {} + for line in command_by_line(cmd, successful_status=successful_status, + stacklevel=stacklevel+1): + l = [s.strip() for s in line.split(sep, 1)] + if len(l) == 2: + d[l[0]] = l[1] + return d + +class CPUInfoBase(object): """Holds CPU information and provides methods for requiring the availability of various CPU features. """ @@ -36,7 +68,7 @@ pass def __getattr__(self,name): - if name[0]!='_': + if not name.startswith('_'): if hasattr(self,'_'+name): attr = getattr(self,'_'+name) if type(attr) is types.MethodType: @@ -51,29 +83,31 @@ def _is_32bit(self): return not self.is_64bit() -class linux_cpuinfo(cpuinfo_base): +class LinuxCPUInfo(CPUInfoBase): info = None def __init__(self): if self.info is not None: return - info = [] + info = [ {} ] + ok, output = getoutput('uname -m') + if ok: + info[0]['uname_m'] = output.strip() try: - for line in open('/proc/cpuinfo').readlines(): + fo = open('/proc/cpuinfo') + except EnvironmentError, e: + warnings.warn(str(e), UserWarning) + else: + for line in fo: name_value = [s.strip() for s in line.split(':', 1)] - if len(name_value)!=2: + if len(name_value) != 2: continue - name,value = name_value + name, value = name_value if not info or info[-1].has_key(name): # next processor info.append({}) info[-1][name] = value - status,output = commands.getstatusoutput('uname -m') - if not status: - if not info: info.append({}) - info[-1]['uname_m'] = output.strip() - except: - print sys.exc_value,'(ignoring)' + fo.close() self.__class__.info = info def _not_impl(self): pass @@ -99,6 +133,9 @@ return re.match(r'.*?Athlon\(tm\) MP\b', self.info[0]['model name']) is not None + def _is_AMD64(self): + return self.is_AMD() and self.info[0]['family'] == '15' + def _is_Athlon64(self): return re.match(r'.*?Athlon\(tm\) 64\b', self.info[0]['model name']) is not None @@ -248,41 +285,26 @@ def _is_32bit(self): return not self.is_64bit() -class irix_cpuinfo(cpuinfo_base): - +class IRIXCPUInfo(CPUInfoBase): info = None def __init__(self): if self.info is not None: return - info = [] - try: - status,output = commands.getstatusoutput('sysconf') - if status not in [0,256]: - return - for line in output.split('\n'): - name_value = [s.strip() for s in line.split(' ', 1)] - if len(name_value)!=2: - continue - name,value = name_value - if not info: - info.append({}) - info[-1][name] = value - except: - print sys.exc_value,'(ignoring)' + info = key_value_from_command('sysconf', sep=' ', + successful_status=(0,1)) self.__class__.info = info - #print info def _not_impl(self): pass def _is_singleCPU(self): - return self.info[0].get('NUM_PROCESSORS') == '1' + return self.info.get('NUM_PROCESSORS') == '1' def _getNCPUs(self): - return int(self.info[0].get('NUM_PROCESSORS')) + return int(self.info.get('NUM_PROCESSORS', 1)) def __cputype(self,n): - return self.info[0].get('PROCESSORS').split()[0].lower() == 'r%s' % (n) + return self.info.get('PROCESSORS').split()[0].lower() == 'r%s' % (n) def _is_r2000(self): return self.__cputype(2000) def _is_r3000(self): return self.__cputype(3000) def _is_r3900(self): return self.__cputype(3900) @@ -300,10 +322,10 @@ def _is_rorion(self): return self.__cputype('orion') def get_ip(self): - try: return self.info[0].get('MACHINE') + try: return self.info.get('MACHINE') except: pass def __machine(self,n): - return self.info[0].get('MACHINE').lower() == 'ip%s' % (n) + return self.info.get('MACHINE').lower() == 'ip%s' % (n) def _is_IP19(self): return self.__machine(19) def _is_IP20(self): return self.__machine(20) def _is_IP21(self): return self.__machine(21) @@ -320,52 +342,33 @@ def _is_IP32_5k(self): return self.__machine(32) and self._is_r5000() def _is_IP32_10k(self): return self.__machine(32) and self._is_r10000() -class darwin_cpuinfo(cpuinfo_base): +class DarwinCPUInfo(CPUInfoBase): info = None def __init__(self): if self.info is not None: return - info = [] - try: - status,output = commands.getstatusoutput('arch') - if not status: - if not info: info.append({}) - info[-1]['arch'] = output.strip() - status,output = commands.getstatusoutput('machine') - if not status: - if not info: info.append({}) - info[-1]['machine'] = output.strip() - status,output = commands.getstatusoutput('sysctl hw') - if not status: - if not info: info.append({}) - d = {} - for l in output.splitlines(): - l = [s.strip() for s in l.split('=')] - if len(l)==2: - d[l[0]]=l[1] - info[-1]['sysctl_hw'] = d - except: - print sys.exc_value,'(ignoring)' + info = command_info(arch='arch', + machine='machine') + info['sysctl_hw'] = key_value_from_command('sysctl hw', sep='=') self.__class__.info = info def _not_impl(self): pass def _getNCPUs(self): - try: return int(self.info[0]['sysctl_hw']['hw.ncpu']) - except: return 1 + return int(self.info['sysctl_hw'].get('hw.ncpu', 1)) def _is_Power_Macintosh(self): - return self.info[0]['sysctl_hw']['hw.machine']=='Power Macintosh' + return self.info['sysctl_hw']['hw.machine']=='Power Macintosh' def _is_i386(self): - return self.info[0]['arch']=='i386' + return self.info['arch']=='i386' def _is_ppc(self): - return self.info[0]['arch']=='ppc' + return self.info['arch']=='ppc' def __machine(self,n): - return self.info[0]['machine'] == 'ppc%s'%n + return self.info['machine'] == 'ppc%s'%n def _is_ppc601(self): return self.__machine(601) def _is_ppc602(self): return self.__machine(602) def _is_ppc603(self): return self.__machine(603) @@ -385,124 +388,90 @@ def _is_ppc823(self): return self.__machine(823) def _is_ppc860(self): return self.__machine(860) -class sunos_cpuinfo(cpuinfo_base): +class SunOSCPUInfo(CPUInfoBase): + info = None def __init__(self): if self.info is not None: return - info = [] - try: - status,output = commands.getstatusoutput('arch') - if not status: - if not info: - info.append({}) - info[-1]['arch'] = output.strip() - status,output = commands.getstatusoutput('mach') - if not status: - if not info: - info.append({}) - info[-1]['mach'] = output.strip() - status,output = commands.getstatusoutput('uname -i') - if not status: - if not info: - info.append({}) - info[-1]['uname_i'] = output.strip() - status,output = commands.getstatusoutput('uname -X') - if not status: - if not info: info.append({}) - d = {} - for l in output.splitlines(): - l = [s.strip() for s in l.split('=')] - if len(l)==2: - d[l[0]]=l[1] - info[-1]['uname_X'] = d - status,output = commands.getstatusoutput('isainfo -b') - if not status: - if not info: - info.append({}) - info[-1]['isainfo_b'] = output.strip() - status,output = commands.getstatusoutput('isainfo -n') - if not status: - if not info: - info.append({}) - info[-1]['isainfo_n'] = output.strip() - status,output = commands.getstatusoutput('psrinfo -v 0') - if not status: - if not info: info.append({}) - for l in output.splitlines(): - m = re.match(r'\s*The (?P

[\w\d]+) processor operates at',l) - if m: - info[-1]['processor'] = m.group('p') - break - except: - print sys.exc_value,'(ignoring)' + info = command_info(arch='arch', + mach='mach', + uname_i='uname_i', + isainfo_b='isainfo -b', + isainfo_n='isainfo -n', + ) + info['uname_X'] = key_value_from_command('uname -X', sep='=') + for line in command_by_line('psrinfo -v 0'): + m = re.match(r'\s*The (?P

[\w\d]+) processor operates at', line) + if m: + info['processor'] = m.group('p') + break self.__class__.info = info def _not_impl(self): pass def _is_32bit(self): - return self.info[0]['isainfo_b']=='32' + return self.info['isainfo_b']=='32' def _is_64bit(self): - return self.info[0]['isainfo_b']=='64' + return self.info['isainfo_b']=='64' def _is_i386(self): - return self.info[0]['isainfo_n']=='i386' + return self.info['isainfo_n']=='i386' def _is_sparc(self): - return self.info[0]['isainfo_n']=='sparc' + return self.info['isainfo_n']=='sparc' def _is_sparcv9(self): - return self.info[0]['isainfo_n']=='sparcv9' + return self.info['isainfo_n']=='sparcv9' def _getNCPUs(self): - try: return int(self.info[0]['uname_X']['NumCPU']) - except: return 1 + return int(self.info['uname_X'].get('NumCPU', 1)) def _is_sun4(self): - return self.info[0]['arch']=='sun4' + return self.info['arch']=='sun4' def _is_SUNW(self): - return re.match(r'SUNW',self.info[0]['uname_i']) is not None + return re.match(r'SUNW',self.info['uname_i']) is not None def _is_sparcstation5(self): - return re.match(r'.*SPARCstation-5',self.info[0]['uname_i']) is not None + return re.match(r'.*SPARCstation-5',self.info['uname_i']) is not None def _is_ultra1(self): - return re.match(r'.*Ultra-1',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-1',self.info['uname_i']) is not None def _is_ultra250(self): - return re.match(r'.*Ultra-250',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-250',self.info['uname_i']) is not None def _is_ultra2(self): - return re.match(r'.*Ultra-2',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-2',self.info['uname_i']) is not None def _is_ultra30(self): - return re.match(r'.*Ultra-30',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-30',self.info['uname_i']) is not None def _is_ultra4(self): - return re.match(r'.*Ultra-4',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-4',self.info['uname_i']) is not None def _is_ultra5_10(self): - return re.match(r'.*Ultra-5_10',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-5_10',self.info['uname_i']) is not None def _is_ultra5(self): - return re.match(r'.*Ultra-5',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-5',self.info['uname_i']) is not None def _is_ultra60(self): - return re.match(r'.*Ultra-60',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-60',self.info['uname_i']) is not None def _is_ultra80(self): - return re.match(r'.*Ultra-80',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-80',self.info['uname_i']) is not None def _is_ultraenterprice(self): - return re.match(r'.*Ultra-Enterprise',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-Enterprise',self.info['uname_i']) is not None def _is_ultraenterprice10k(self): - return re.match(r'.*Ultra-Enterprise-10000',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-Enterprise-10000',self.info['uname_i']) is not None def _is_sunfire(self): - return re.match(r'.*Sun-Fire',self.info[0]['uname_i']) is not None + return re.match(r'.*Sun-Fire',self.info['uname_i']) is not None def _is_ultra(self): - return re.match(r'.*Ultra',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra',self.info['uname_i']) is not None def _is_cpusparcv7(self): - return self.info[0]['processor']=='sparcv7' + return self.info['processor']=='sparcv7' def _is_cpusparcv8(self): - return self.info[0]['processor']=='sparcv8' + return self.info['processor']=='sparcv8' def _is_cpusparcv9(self): - return self.info[0]['processor']=='sparcv9' + return self.info['processor']=='sparcv9' -class win32_cpuinfo(cpuinfo_base): +class Win32CPUInfo(CPUInfoBase): info = None - pkey = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor" + pkey = r"HARDWARE\DESCRIPTION\System\CentralProcessor" # XXX: what does the value of # HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0 # mean? @@ -514,10 +483,9 @@ try: #XXX: Bad style to use so long `try:...except:...`. Fix it! import _winreg - pkey = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor" prgx = re.compile(r"family\s+(?P\d+)\s+model\s+(?P\d+)"\ "\s+stepping\s+(?P\d+)",re.IGNORECASE) - chnd=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,pkey) + chnd=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, self.pkey) pnum=0 while 1: try: @@ -576,16 +544,15 @@ return self.is_AMD() and self.info[0]['Family']==5 \ and self.info[0]['Model']==9 - def _is_Athlon(self): - return self.is_AMD() and self.info[0]['Family']==6 + def _is_AMDK7(self): + return self.is_AMD() and self.info[0]['Family'] == 6 - def _is_Athlon64(self): - return self.is_AMD() and self.info[0]['Family']==15 \ - and self.info[0]['Model']==4 + # To reliably distinguish between the different types of AMD64 chips + # (Athlon64, Operton, Athlon64 X2, Semperon, Turion 64, etc.) would + # require looking at the 'brand' from cpuid - def _is_Opteron(self): - return self.is_AMD() and self.info[0]['Family']==15 \ - and self.info[0]['Model']==5 + def _is_AMD64(self): + return self.is_AMD() and self.info[0]['Family'] == 15 # Intel @@ -626,6 +593,14 @@ def _is_PentiumIV(self): return self.is_Intel() and self.info[0]['Family']==15 + def _is_PentiumM(self): + return self.is_Intel() and self.info[0]['Family'] == 6 \ + and self.info[0]['Model'] in [9, 13, 14] + + def _is_Core2(self): + return self.is_Intel() and self.info[0]['Family'] == 6 \ + and self.info[0]['Model'] in [15, 16, 17] + # Varia def _is_singleCPU(self): @@ -640,6 +615,8 @@ or (self.info[0]['Family'] in [6,15]) elif self.is_AMD(): return self.info[0]['Family'] in [5,6,15] + else: + return False def _has_sse(self): if self.is_Intel(): @@ -650,32 +627,39 @@ return (self.info[0]['Family']==6 and \ self.info[0]['Model'] in [6,7,8,10]) \ or self.info[0]['Family']==15 + else: + return False def _has_sse2(self): - return self.info[0]['Family']==15 + if self.is_Intel(): + return self.is_Pentium4() or self.is_PentiumM() \ + or self.is_Core2() + elif self.is_AMD(): + return self.is_AMD64() + else: + return False def _has_3dnow(self): - # XXX: does only AMD have 3dnow?? return self.is_AMD() and self.info[0]['Family'] in [5,6,15] def _has_3dnowext(self): return self.is_AMD() and self.info[0]['Family'] in [6,15] -if sys.platform[:5] == 'linux': # variations: linux2,linux-i386 (any others?) - cpuinfo = linux_cpuinfo -elif sys.platform[:4] == 'irix': - cpuinfo = irix_cpuinfo +if sys.platform.startswith('linux'): # variations: linux2,linux-i386 (any others?) + cpuinfo = LinuxCPUInfo +elif sys.platform.startswith('irix'): + cpuinfo = IRIXCPUInfo elif sys.platform == 'darwin': - cpuinfo = darwin_cpuinfo -elif sys.platform[:5] == 'sunos': - cpuinfo = sunos_cpuinfo -elif sys.platform[:5] == 'win32': - cpuinfo = win32_cpuinfo -elif sys.platform[:6] == 'cygwin': - cpuinfo = linux_cpuinfo + cpuinfo = DarwinCPUInfo +elif sys.platform.startswith('sunos'): + cpuinfo = SunOSCPUInfo +elif sys.platform.startswith('win32'): + cpuinfo = Win32CPUInfo +elif sys.platform.startswith('cygwin'): + cpuinfo = LinuxCPUInfo #XXX: other OS's. Eg. use _winreg on Win32. Or os.uname on unices. else: - cpuinfo = cpuinfo_base + cpuinfo = CPUInfoBase cpu = cpuinfo() From numpy-svn at scipy.org Tue Oct 2 15:18:31 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 2 Oct 2007 14:18:31 -0500 (CDT) Subject: [Numpy-svn] r4153 - trunk/numpy/distutils/fcompiler Message-ID: <20071002191831.B150E39C06C@new.scipy.org> Author: cookedm Date: 2007-10-02 14:18:29 -0500 (Tue, 02 Oct 2007) New Revision: 4153 Modified: trunk/numpy/distutils/fcompiler/gnu.py Log: distutils/fcompiler/gnu.py: add -march=k8 when cpu.is_AMD64() Modified: trunk/numpy/distutils/fcompiler/gnu.py =================================================================== --- trunk/numpy/distutils/fcompiler/gnu.py 2007-10-02 19:14:52 UTC (rev 4152) +++ trunk/numpy/distutils/fcompiler/gnu.py 2007-10-02 19:18:29 UTC (rev 4153) @@ -237,10 +237,13 @@ march_opt = '-march=pentium2' if gnu_ver >= '3.4': + # Actually, I think these all do the same things if cpu.is_Opteron(): march_opt = '-march=opteron' elif cpu.is_Athlon64(): march_opt = '-march=athlon64' + elif cpu.is_AMD64(): + march_opt = '-march=k8' if gnu_ver >= '3.4.4': if cpu.is_PentiumM(): From numpy-svn at scipy.org Tue Oct 2 19:35:35 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 2 Oct 2007 18:35:35 -0500 (CDT) Subject: [Numpy-svn] r4154 - trunk/numpy/doc Message-ID: <20071002233535.32C7839C170@new.scipy.org> Author: chris.burns Date: 2007-10-02 18:35:32 -0500 (Tue, 02 Oct 2007) New Revision: 4154 Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt Log: Add Docutils dependency for Epydoc. Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt =================================================================== --- trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-02 19:18:29 UTC (rev 4153) +++ trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-02 23:35:32 UTC (rev 4154) @@ -177,6 +177,15 @@ Use optional in the "type" field for parameters that are non-keyword optional for C-functions. +Epydoc depends on Docutils for reStructuredText parsing. You can download +Docutils from the +`Docutils sourceforge page. `__ +You may also be able to use a package manager like yum to install a +current version:: + + $ sudo yum install python-docutils + + Example ------- From numpy-svn at scipy.org Thu Oct 4 15:40:52 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 4 Oct 2007 14:40:52 -0500 (CDT) Subject: [Numpy-svn] r4155 - trunk/numpy/doc Message-ID: <20071004194052.BFDD539C23D@new.scipy.org> Author: chris.burns Date: 2007-10-04 14:40:50 -0500 (Thu, 04 Oct 2007) New Revision: 4155 Modified: trunk/numpy/doc/DISTUTILS.txt Log: Some documentation cleanup of disutils. Modified: trunk/numpy/doc/DISTUTILS.txt =================================================================== --- trunk/numpy/doc/DISTUTILS.txt 2007-10-02 23:35:32 UTC (rev 4154) +++ trunk/numpy/doc/DISTUTILS.txt 2007-10-04 19:40:50 UTC (rev 4155) @@ -34,39 +34,37 @@ ''''''''''''''''''''''''''''''' SciPy consists of Python packages, called SciPy packages, that are -available to Python users via ``scipy`` name space. Each SciPy package -may contain other SciPy packages. And so on. So, SciPy directory tree -is a tree of packages with arbitrary depth and width. Any SciPy -package may depend on NumPy packages but the dependence on other +available to Python users via the ``scipy`` namespace. Each SciPy package +may contain other SciPy packages. And so on. Therefore, the SciPy +directory tree is a tree of packages with arbitrary depth and width. +Any SciPy package may depend on NumPy packages but the dependence on other SciPy packages should be kept minimal or zero. -A SciPy package contains in addition to its sources, the following +A SciPy package contains, in addition to its sources, the following files and directories: - ``setup.py`` --- building script - ``info.py`` --- contains documentation and import flags - ``__init__.py`` --- package initializer - ``tests/`` --- directory of unittests + + ``setup.py`` --- building script + + ``info.py`` --- contains documentation and import flags + + ``__init__.py`` --- package initializer + + ``tests/`` --- directory of unittests -Their contents will be described below. +Their contents are described below. The ``setup.py`` file ''''''''''''''''''''' -In order to add a Python package to SciPy, its building script (the -``setup.py`` file) must meet certain requirements. The minimal and the -most important one is that it must define a function -``configuration(parent_package='',top_path=None)`` that returns a -dictionary suitable for passing to ``numpy.distutils.core.setup(..)`` -function. In order to simplify the construction of such an distionary, -``numpy.distutils.misc_util`` provides a class ``Configuration``, the -usage of will be described below. +In order to add a Python package to SciPy, its build script (``setup.py``) +must meet certain requirements. The most important requirement is that the +package define a ``configuration(parent_package='',top_path=None)`` function +which returns a dictionary suitable for passing to +``numpy.distutils.core.setup(..)``. To simplify the construction of +this dictionary, ``numpy.distutils.misc_util`` provides the +``Configuration`` class, described below. SciPy pure Python package example --------------------------------- -Here follows a minimal example for a pure Python SciPy package -``setup.py`` file that will be explained in detail below:: +Below is an example of a minimal ``setup.py`` file for a pure Scipy package:: #!/usr/bin/env python def configuration(parent_package='',top_path=None): @@ -79,16 +77,15 @@ #setup(**configuration(top_path='').todict()) setup(configuration=configuration) -The first argument ``parent_package`` of the main configuration -function will contain a name of the parent SciPy package and the -second argument ``top_path`` contains the name of the directory where -the main ``setup.py`` script is located. Both arguments should be -passed to the ``Configuration`` constructor after the name of the -current package. +The arguments of the ``configuration`` function specifiy the name of +parent SciPy package (``parent_package``) and the directory location +of the main ``setup.py`` script (``top_path``). These arguments, +along with the name of the current package, should be passed to the +``Configuration`` constructor. -The ``Configuration`` constructor has also fourth optional argument, +The ``Configuration`` constructor has a fourth optional argument, ``package_path``, that can be used when package files are located in -some other location than the directory of the ``setup.py`` file. +a different location than the directory of the ``setup.py`` file. Remaining ``Configuration`` arguments are all keyword arguments that will be used to initialize attributes of ``Configuration`` @@ -122,7 +119,7 @@ ``Configuration`` instance methods ---------------------------------- -+ ``config.todict()`` --- returns configuration distionary suitable for ++ ``config.todict()`` --- returns configuration dictionary suitable for passing to ``numpy.distutils.core.setup(..)`` function. + ``config.paths(*paths) --- applies ``glob.glob(..)`` to items of @@ -409,12 +406,12 @@ The ``info.py`` file '''''''''''''''''''' -Scipy package import hooks assume that each Scipy package contains -``info.py`` file that contains overall documentation about the package -and some variables defining the order of package imports, dependence +Scipy package import hooks assume that each package contains a +``info.py`` file. This file contains overall documentation about the package +and variables defining the order of package imports, dependency relations between packages, etc. -The following information will be looked in the ``info.py`` file: +On import, the following information will be looked for in ``info.py``: __doc__ The documentation string of the package. @@ -444,15 +441,14 @@ The ``__init__.py`` file '''''''''''''''''''''''' -To speed up the import time as well as to minimize memory usage, numpy -uses ppimport hooks to transparently postpone importing large modules -that might not be used during the Scipy usage session. But in order to -have an access to the documentation of all Scipy packages, including -of the postponed packages, the documentation string of a package (that would -usually reside in ``__init__.py`` file) should be copied also -to ``info.py`` file. +To speed up the import time and minimize memory usage, numpy +uses ``ppimport`` hooks to transparently postpone importing large modules, +which might not be used during the Scipy session. In order to +have access to the documentation of all Scipy packages, including +postponed packages, the docstring from ``info.py`` is imported +into ``__init__.py``. -So, the header a typical ``__init__.py`` file is:: +The header of a typical ``__init__.py`` is:: # # Package ... - ... From numpy-svn at scipy.org Mon Oct 8 23:08:33 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 8 Oct 2007 22:08:33 -0500 (CDT) Subject: [Numpy-svn] r4156 - in trunk/numpy: core/blasdot core/src core/tests lib Message-ID: <20071009030833.566F639C03B@new.scipy.org> Author: oliphant Date: 2007-10-08 22:08:26 -0500 (Mon, 08 Oct 2007) New Revision: 4156 Modified: trunk/numpy/core/blasdot/_dotblas.c trunk/numpy/core/src/arraytypes.inc.src trunk/numpy/core/tests/test_regression.py trunk/numpy/lib/function_base.py Log: Fix Ticket #588: problem with negative striding and fast blas implementation of dot Modified: trunk/numpy/core/blasdot/_dotblas.c =================================================================== --- trunk/numpy/core/blasdot/_dotblas.c 2007-10-04 19:40:50 UTC (rev 4155) +++ trunk/numpy/core/blasdot/_dotblas.c 2007-10-09 03:08:26 UTC (rev 4156) @@ -20,7 +20,8 @@ register int nb = strideb / sizeof(float); if ((sizeof(float) * na == stridea) && - (sizeof(float) * nb == strideb)) + (sizeof(float) * nb == strideb) && + (na >= 0) && (nb >= 0)) *((float *)res) = cblas_sdot((int)n, (float *)a, na, (float *)b, nb); else @@ -35,7 +36,8 @@ register int nb = strideb / sizeof(double); if ((sizeof(double) * na == stridea) && - (sizeof(double) * nb == strideb)) + (sizeof(double) * nb == strideb) && + (na >= 0) && (nb >= 0)) *((double *)res) = cblas_ddot((int)n, (double *)a, na, (double *)b, nb); else oldFunctions[PyArray_DOUBLE](a, stridea, b, strideb, res, n, tmp); @@ -50,7 +52,8 @@ register int nb = strideb / sizeof(cfloat); if ((sizeof(cfloat) * na == stridea) && - (sizeof(cfloat) * nb == strideb)) + (sizeof(cfloat) * nb == strideb) && + (na >= 0) && (nb >= 0)) cblas_cdotu_sub((int)n, (float *)a, na, (float *)b, nb, (float *)res); else oldFunctions[PyArray_CFLOAT](a, stridea, b, strideb, res, n, tmp); @@ -64,7 +67,8 @@ register int nb = strideb / sizeof(cdouble); if ((sizeof(cdouble) * na == stridea) && - (sizeof(cdouble) * nb == strideb)) + (sizeof(cdouble) * nb == strideb) && + (na >= 0) && (nb >= 0)) cblas_zdotu_sub((int)n, (double *)a, na, (double *)b, nb, (double *)res); else oldFunctions[PyArray_CDOUBLE](a, stridea, b, strideb, res, n, tmp); @@ -172,6 +176,21 @@ } +static int +_bad_strides(PyArrayObject *ap) +{ + register int itemsize = PyArray_ITEMSIZE(ap); + register int i, N=PyArray_NDIM(ap); + register intp *strides = PyArray_STRIDES(ap); + + for (i=0; ind > 2) || (ap2->nd > 2)) { - /* This function doesn't handle dimensions greater than 2 -- other + /* This function doesn't handle dimensions greater than 2 + (or negative striding) -- other than to ensure the dot function is altered */ if (!altered) { @@ -235,13 +256,13 @@ return PyArray_Return(ret); } - if (!PyArray_ElementStrides((PyObject *)ap1)) { + if (_bad_strides(ap1)) { op1 = PyArray_NewCopy(ap1, PyArray_ANYORDER); Py_DECREF(ap1); ap1 = (PyArrayObject *)op1; if (ap1 == NULL) goto fail; } - if (!PyArray_ElementStrides((PyObject *)ap2)) { + if (_bad_strides(ap2)) { op2 = PyArray_NewCopy(ap2, PyArray_ANYORDER); Py_DECREF(ap2); ap2 = (PyArrayObject *)op2; Modified: trunk/numpy/core/src/arraytypes.inc.src =================================================================== --- trunk/numpy/core/src/arraytypes.inc.src 2007-10-04 19:40:50 UTC (rev 4155) +++ trunk/numpy/core/src/arraytypes.inc.src 2007-10-09 03:08:26 UTC (rev 4156) @@ -397,6 +397,9 @@ return -1; } memcpy(ov, ptr, MIN(ap->descr->elsize,len)); + /* If string lenth is smaller than room in array + Then fill the rest of the element size + with NULL */ if (ap->descr->elsize > len) { memset(ov + len, 0, (ap->descr->elsize - len)); } Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2007-10-04 19:40:50 UTC (rev 4155) +++ trunk/numpy/core/tests/test_regression.py 2007-10-09 03:08:26 UTC (rev 4156) @@ -725,6 +725,13 @@ """Ticket #572""" N.lib.place(1,1,1) + def check_dot_negative_stride(self, level=rlevel): + """Ticket #588""" + x = N.array([[1,5,25,125.,625]]) + y = N.array([[20.],[160.],[640.],[1280.],[1024.]]) + z = y[::-1].copy() + y2 = y[::-1] + assert_equal(N.dot(x,z),N.dot(x,y2)) if __name__ == "__main__": NumpyTest().run() Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2007-10-04 19:40:50 UTC (rev 4155) +++ trunk/numpy/lib/function_base.py 2007-10-09 03:08:26 UTC (rev 4156) @@ -1,7 +1,7 @@ __docformat__ = "restructuredtext en" __all__ = ['logspace', 'linspace', 'select', 'piecewise', 'trim_zeros', - 'copy', 'iterable', #'base_repr', 'binary_repr', + 'copy', 'iterable', 'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp', 'unique', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax', 'nanargmin', 'nanmin', 'vectorize', 'asarray_chkfinite', 'average', From numpy-svn at scipy.org Tue Oct 9 05:43:16 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 9 Oct 2007 04:43:16 -0500 (CDT) Subject: [Numpy-svn] r4157 - in branches/numpy.scons: . numpy/distutils/command Message-ID: <20071009094316.B64B339C0F2@new.scipy.org> Author: cdavid Date: 2007-10-09 04:43:05 -0500 (Tue, 09 Oct 2007) New Revision: 4157 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/command/scons.py Log: Do not print debug info when no sconscripts are used Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-09-26 17:53:29.147000074 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-09 17:49:06.331000090 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-09 03:08:26 UTC (rev 4156) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-09 09:43:05 UTC (rev 4157) @@ -46,12 +46,14 @@ def get_compiler_executable(compiler): """For any give CCompiler instance, this gives us the name of C compiler - (the actual executable.""" + (the actual executable).""" # Geez, why does distutils has no common way to get the compiler name... if compiler.compiler_type == 'msvc': # this is harcoded in distutils... A bit cleaner way would be to # initialize the compiler instance and then get compiler.cc, but this # may be costly: we really just want a string. + # XXX: we need to initialize the compiler anyway, so do not use + # hardcoded string #compiler.initialize() #print compiler.cc return 'cl.exe' @@ -76,6 +78,9 @@ return '"' + path + '"' class scons(old_build_ext): + # XXX: I really do not like the way distutils add attributes "on the fly". + # We should eally avoid that and remove all the code which does it before + # release. description = "Scons builder" #user_options = [] user_options = [('fcompiler=', None, "specify the Fortran compiler type"), @@ -90,6 +95,8 @@ if self.distribution.has_scons_scripts(): print "Got it: scons scripts are %s" % self.distribution.scons_scripts self.scons_scripts = self.distribution.scons_scripts + else: + self.scons_scripts = [] # Try to get the same compiler than the ones used by distutils: this is # non trivial because distutils and scons have totally different @@ -111,16 +118,18 @@ if hasattr(self.compiler, 'initialize'): self.compiler.initialize() - #print "++++++++++++++++++++++++++++++++++++++++" - #print "self.compiler is %s, this gives us scons tool %s" % (compiler_type, - # dist2sconscc(self.compiler)) - #print get_tool_path(self.compiler) - #print "++++++++++++++++++++++++++++++++++++++++" + # XXX: debug, remove + if self.scons_scripts: + #print "++++++++++++++++++++++++++++++++++++++++" + #print "self.compiler is %s, this gives us scons tool %s" % (compiler_type, + # dist2sconscc(self.compiler)) + #print get_tool_path(self.compiler) + #print "++++++++++++++++++++++++++++++++++++++++" - print "++++++++++++++++++++++++++++++++++++++++" - print get_scons_local_path() - print get_python_exec_invoc() - print "++++++++++++++++++++++++++++++++++++++++" + print "++++++++++++++++++++++++++++++++++++++++" + print get_scons_local_path() + print get_python_exec_invoc() + print "++++++++++++++++++++++++++++++++++++++++" def run(self): # XXX: when a scons script is missing, scons only prints warnings, and From numpy-svn at scipy.org Tue Oct 9 05:43:35 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 9 Oct 2007 04:43:35 -0500 (CDT) Subject: [Numpy-svn] r4158 - in branches/numpy.scons: . numpy/distutils/scons Message-ID: <20071009094335.00A5AC7C007@new.scipy.org> Author: cdavid Date: 2007-10-09 04:43:24 -0500 (Tue, 09 Oct 2007) New Revision: 4158 Added: branches/numpy.scons/numpy/distutils/scons/extension.py branches/numpy.scons/numpy/distutils/scons/extension_scons.py branches/numpy.scons/numpy/distutils/scons/libinfo.py branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py branches/numpy.scons/numpy/distutils/scons/utils.py Modified: branches/numpy.scons/ Log: Importing files from separate bzr branch (not used yet) Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-09 17:49:06.331000090 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-09 18:33:39.446000099 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:file-ids - + numpy/distutils/scons/libinfo.py libinfo.py-20071009093303-550dnrlqoermhxvl-1 numpy/distutils/scons/extension_scons.py extension_scons.py-20071009093253-tzixdx7w5zen0j57-2 numpy/distutils/scons/libinfo_scons.py libinfo_scons.py-20071009093303-550dnrlqoermhxvl-2 numpy/distutils/scons/utils.py utils.py-20071009093305-fhqfd6xjru0te58v-1 numpy/distutils/scons/extension.py extension.py-20071009093253-tzixdx7w5zen0j57-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 Added: branches/numpy.scons/numpy/distutils/scons/extension.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/extension.py 2007-10-09 09:43:05 UTC (rev 4157) +++ branches/numpy.scons/numpy/distutils/scons/extension.py 2007-10-09 09:43:24 UTC (rev 4158) @@ -0,0 +1,25 @@ +#! /usr/bin/env python +# Last Change: Tue Oct 09 03:00 PM 2007 J + +# Module for support to build python extension. KEEP THIS INDEPENDANT OF SCONS + +# XXX: we should avoid clashing between distutils and numpy.distutils. Maybe by +# defining our own functions here, and accessing any info related to python +# build option and co from here only. +import sys +import os +from os.path import join as pjoin + +from distutils.sysconfig import get_python_version, get_python_inc, get_config_vars + +def get_pythonlib_dir(): + """Returns a list of path to look for the python engine library + (pythonX.X.lib on win32, libpythonX.X.so on unix, etc...).""" + if os.name == 'nt': + return [pjoin(sys.exec_prefix, 'libs')] + else: + return [pjoin(sys.exec_prefix, 'lib')] + +if __name__ == '__main__': + print "Python version is %s" % get_python_version() + print "Python include dir is %s" % get_python_inc() Added: branches/numpy.scons/numpy/distutils/scons/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-09 09:43:05 UTC (rev 4157) +++ branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-09 09:43:24 UTC (rev 4158) @@ -0,0 +1,41 @@ +#! /usr/bin/env python +# Last Change: Tue Oct 09 04:00 PM 2007 J + +# Module for support to build python extension. scons specific code goes here. +import sys +from copy import deepcopy + +from extension import get_pythonlib_dir, get_python_inc + +def built_with_mstools(env): + """Return True if built with MS tools (compiler + linker).""" + return env.has_key('MSVS') + +def PythonExtension(env, target, source, *args, **kw): + # XXX Check args and kw + # XXX: Some things should not be set here... + if env.has_key('LINKFLAGS'): + LINKFLAGS = deepcopy(env['LINKFLAGS']) + else: + LINKFLAGS = [] + if env.has_key('CPPPPATH'): + CPPPATH = deepcopy(env['CPPPATH']) + else: + CPPPATH = [] + CPPPATH.append(get_python_inc()) + if sys.platform == 'win32': + # XXX: pyext should definitely not be set here + pyext = '.pyd' + if built_with_mstools(env): + # # XXX is the export necessary ? (this seems to work wo) + # LINKFLAGS += " /EXPORT:init%s " % target[0] + + # XXX: We add the path where to find python2.5.lib (or any other + # version, of course). This seems to be necessary for MS compilers. + env.AppendUnique(LIBPATH = get_pythonlib_dir()) + else: + pyext = env['SHLIBSUFFIX'] + wrap = env.SharedLibrary(target, source, SHLIBPREFIX = '', + SHLIBSUFFIX = pyext, LINKFLAGS = LINKFLAGS, + CPPPATH = CPPPATH, *args, **kw) + return wrap Added: branches/numpy.scons/numpy/distutils/scons/libinfo.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-10-09 09:43:05 UTC (rev 4157) +++ branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-10-09 09:43:24 UTC (rev 4158) @@ -0,0 +1,64 @@ +#! /usr/bin/env python +# Last Change: Fri Oct 05 02:00 PM 2007 J + +# Module for support to look for external code (replacement of +# numpy.distutils.system_info). KEEP THIS INDEPENDANT OF SCONS ! +import os +import ConfigParser + +from numpy.distutils.system_info import default_lib_dirs, \ + default_include_dirs, default_src_dirs, get_standard_file + +def get_config(): + """ This tries to read .cfg files in several locations, and merge its + information into a ConfigParser object for the first found file. + + Returns the ConfigParser instance. This copies the logic in system_info + from numpy.distutils.""" + # Below is the feature we are copying from numpy.distutils: + # + # The file 'site.cfg' is looked for in + + # 1) Directory of main setup.py file being run. + # 2) Home directory of user running the setup.py file as ~/.numpy-site.cfg + # 3) System wide directory (location of this file...) + + # The first one found is used to get system configuration options The + # format is that used by ConfigParser (i.e., Windows .INI style). The + # section DEFAULT has options that are the default for each section. The + # available sections are fftw, atlas, and x11. Appropiate defaults are + # used if nothing is specified. + + section = 'DEFAULT' + defaults = {} + defaults['libraries'] = '' + defaults['library_dirs'] = os.pathsep.join(default_lib_dirs) + defaults['include_dirs'] = os.pathsep.join(default_include_dirs) + defaults['src_dirs'] = os.pathsep.join(default_src_dirs) + cp = ConfigParser.ConfigParser(defaults) + files = [] + files.extend(get_standard_file('.numpy-site.cfg')) + files.extend(get_standard_file('site.cfg')) + + def parse_config_files(): + cp.read(files) + if not cp.has_section(section): + cp.add_section(section) + + parse_config_files() + return cp, files + +def parse_config_param(var): + """Given var, the output of ConfirParser.get(section, name), returns a list + of each item of its content.""" + pass + +def get_paths(var): + """Given var, the output of ConfirParser.get(section, name), returns a list + of each item of its content, assuming the content is a list of directoris. + + Example: if var is foo:bar, it will return ['foo', 'bar'] on posix.""" + return var.split(os.pathsep) + +if __name__ == '__main__': + pass Added: branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-10-09 09:43:05 UTC (rev 4157) +++ branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-10-09 09:43:24 UTC (rev 4158) @@ -0,0 +1,189 @@ +#! /usr/bin/env python +# Last Change: Tue Oct 09 04:00 PM 2007 J + +# Module for support to look for external code (replacement of +# numpy.distutils.system_info). scons dependant code. +import ConfigParser +from copy import deepcopy + +from SCons.Util import is_List + +from libinfo import get_config, get_paths +from utils import get_empty + +_SYMBOL_DEF_STR = """ +#ifdef __cplusplus +extern "C" +#endif +char %s();\n""" + +_MAIN_CALL_CENTER = """ +int main(int argc, char** argv) +{ + %s + return 0; +}\n """ + +def _CheckLib(context, libs, symbols, header, language, section, siteconfig, + libpath, cpppath): + """Implementation for checking a list of symbols, with libs. + + Assumes that libs, symbol, header, libpath and cpppath are sequences (list + or tuples). DO NOT USE DIRECTLY IN SCONSCRIPT !!!""" + # XXX: sanitize API for section/siteconfig option: if sectionis not given, + # can we just say to ignore the sitecfg ? + if not siteconfig: + siteconfig, cfgfiles = get_config() + + def get_descr(): + descr = siteconfig.items(section) + sdescr = "" + for i in descr: + sdescr += str(i) + '\n' + return sdescr + + # Generate the source string of the conftest + src = "" + callstr = "" + + if symbols: + for s in symbols: + # XXX: should put undef here (ala autoconf) + src += _SYMBOL_DEF_STR % s + callstr += "%s();" % s + + src += _MAIN_CALL_CENTER % callstr + # HUGE HACK: we want this test to depend on site.cfg files obviously, since + # a change in them can change the libraries tested. But Depends does not + # seem to work in configuration context, and I don't see any simple way to + # have the same functionality. So I put the configuration we got from + # get_config into the source code, such as a change in site.cfg will change + # the source file, and thus taken into account to decide whether to rebuild + # from tjhe SconfTaskMaster point of view. + + # XXX: I put the content between #if 0 / #endif, which is the most portable + # way I am aware of for multilines comments in C and C++ (this is also + # recommended in C++ portability guide of mozilla for nested comments, + # which may happen here). This is also the most robust, since it seems + # unlikely to have any #endif somewhere in the return value of get_descr. + #src += "#if 0\n" + #src += get_descr() + #src += "\n#endif\n" + + # XXX: handle autoadd + # XXX: handle extension + extension = '.c' + + if section and siteconfig: + #print "Checking %s from section %s" % (libs[0], section) + res = _check_lib_section(context, siteconfig, section, src, libs, + libpath, cpppath) + else: + oldLIBS = context.env.has_key('LIBS') and deepcopy(context.env['LIBS']) + context.env.Append(LIBS = libs) + res = context.TryLink(src, '.c') + if not res: + context.env.Replace(LIBS = oldLIBS) + + return res + + +def NumpyCheckLib(context, libs, symbols = None, header = None, + language = None, section = None, siteconfig = None, name = None): + """Check for symbol in libs. + + This is the general purpose replacement for numpy.distutils.system_info. It + uses the options in siteconfig so that search path can be overwritten in + *.cfg files (using section given by section argument). If siteconfig is + None, it does uses get_config function to get the configuration, which + gives the old numpy.distutils behaviour to get options. + + + Convention: if the section has *dirs parameters, it will use them all in + one pass, e.g if library_dirs is ['/usr/local/lib', '/usr/local/mylib'], it + will try to link the given libraries by appending both directories to the + LIBPATH.""" + #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + # This is really preliminary, and needs a lot of love before being in good + # shape !!!!! + # + # Biggest problem: how to show information about found libraries ? Since + # they are found implicitely through build tools (compiler and linker), we + # can not give explicit information. IMHO (David Cournapeau), it is better + # to find them implicitely because it is much more robust. But for the info... + # + # This needs testing, too. + #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + env = context.env + + # XXX: would be nice for each extension to add an option to command line. + # XXX: handle env var + # XXX: handle language + if language: + raise NotImplementedError("FIXME: language selection not implemented yet !") + + # Make sure libs and symbols are lists + if libs and not is_List(libs): + libs = [libs] + if symbols and not is_List(symbols): + symbols = [symbols] + + if not name: + name = libs[0] + + # Display message + if symbols: + sbstr = ', '.join(symbols) + context.Message('Checking for symbol(s) %s in %s... ' % (sbstr, name)) + else: + context.Message('Checking for %s... ' % name) + + # Call the implementation + libpath = None + cpppath = None + res = _CheckLib(context, libs, symbols, header, language, section, + siteconfig, libpath, cpppath, ) + context.Result(res) + return res + +def _check_lib_section(context, siteconfig, section, src, libs, libpath, cpppath): + # Convention: if an option is found in site.cfg for the given section, it + # takes precedence on the arguments libs, libpath, cpppath. + res = 1 + try: + newLIBPATH = get_paths(siteconfig.get(section, 'library_dirs')) + except ConfigParser.NoSectionError, e: + if libpath: + newLIBPATH = libpath + else: + newLIBPATH = [] + + try: + newCPPPATH = get_paths(siteconfig.get(section, 'include_dirs')) + except ConfigParser.NoSectionError, e: + if cpppath: + newCPPPATH = cpppath + else: + newCPPPATH = [] + + try: + newLIBS = siteconfig.get(section, 'libraries') + except ConfigParser.NoSectionError, e: + if libs: + newLIBS = libs + else: + newLIBS = [] + + lastLIBPATH = get_empty(context.env,'LIBPATH') + lastLIBS = get_empty(context.env,'LIBS') + lastCPPPATH = get_empty(context.env,'CPPPATH') + context.env.Append(LIBPATH = newLIBPATH) + context.env.Append(LIBS = newLIBS) + context.env.Append(CPPPATH = newCPPPATH) + res *= context.TryLink(src, '.c') + if not res: + context.env.Replace(LIBS = lastLIBS, + LIBPATH = lastLIBPATH, + CPPPATH = lastCPPPATH) + + return res Added: branches/numpy.scons/numpy/distutils/scons/utils.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-09 09:43:05 UTC (rev 4157) +++ branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-09 09:43:24 UTC (rev 4158) @@ -0,0 +1,44 @@ +import os +import re + +from copy import deepcopy + +_START_WITH_MINUS = re.compile('^\s*-') + +def popen_wrapper(cmd, merge = False): + """This works like popen, but it returns both the status and the output. + + If merge is True, then output contains both stdout and stderr. + + Returns: (st, out), where st is an integer (the return status of the + subprocess, and out the string of the output). + + NOTE: + - it tries to be robust to find non existing command. For example, is + cmd starts with a minus, a nonzero status is returned, and no junk is + displayed on the interpreter stdout.""" + if _START_WITH_MINUS.match(cmd): + return 1, '' + if merge: + # XXX: I have a bad feeling about this. Does it really work reliably on + # all supported platforms ? + cmd += ' 2>& 1 ' + output = os.popen(cmd) + out = output.read() + st = output.close() + if st: + status = st + else: + status = 0 + + return status, out + +def get_empty(dict, key): + """Assuming dict is a dictionary with lists as values, returns an empty + list if key is not found, or a (deep) copy of the existing value if it + does.""" + try: + return deepcopy(dict[key]) + except KeyError, e: + return [] + From numpy-svn at scipy.org Tue Oct 9 11:24:33 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 9 Oct 2007 10:24:33 -0500 (CDT) Subject: [Numpy-svn] r4159 - in branches/numpy.scons: . numpy/distutils/scons numpy/scons_fake numpy/scons_fake/tests Message-ID: <20071009152433.E1E2F39C08E@new.scipy.org> Author: cdavid Date: 2007-10-09 10:24:09 -0500 (Tue, 09 Oct 2007) New Revision: 4159 Added: branches/numpy.scons/numpy/distutils/scons/custom_builders.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py branches/numpy.scons/numpy/scons_fake/hellomodule.c branches/numpy.scons/numpy/scons_fake/tests/test_spam.py Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/scons_fake/SConstruct branches/numpy.scons/numpy/scons_fake/__init__.py Log: Refactor distutils.scons module, get some code from separate numpy.scons project Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-09 18:33:39.446000099 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-10 00:21:08.450999975 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:file-ids - numpy/distutils/scons/libinfo.py libinfo.py-20071009093303-550dnrlqoermhxvl-1 numpy/distutils/scons/extension_scons.py extension_scons.py-20071009093253-tzixdx7w5zen0j57-2 numpy/distutils/scons/libinfo_scons.py libinfo_scons.py-20071009093303-550dnrlqoermhxvl-2 numpy/distutils/scons/utils.py utils.py-20071009093305-fhqfd6xjru0te58v-1 numpy/distutils/scons/extension.py extension.py-20071009093253-tzixdx7w5zen0j57-1 + numpy/scons_fake/hellomodule.c hellomodule.c-20071009151603-naqbhw7952s3b5pl-1 numpy/scons_fake/tests/test_spam.py test_spam.py-20071009151607-wobzeu6ne1916j3p-1 numpy/distutils/scons/numpyenv.py numpyenv.py-20071009151555-cl8a4vlu5xp3pzsg-1 numpy/distutils/scons/custom_builders.py custom_builders.py-20071009151552-c0fhgo48e2t0lha6-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-09 09:43:24 UTC (rev 4158) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-09 15:24:09 UTC (rev 4159) @@ -1,155 +1,9 @@ -from os.path import join as pjoin -import os.path -import ConfigParser -import sys +from numpyenv import GetNumpyEnvironment, GetNumpyOptions +from libinfo_scons import NumpyCheckLib -from SCons.Options import Options -from SCons.Tool import Tool, FindTool, FindAllTools -from SCons.Environment import Environment -from SCons.Script import BuildDir, Help -from SCons.Util import is_List - -from default import tool_list - -def pyplat2sconsplat(): - # XXX: should see how env['PLATFORM'] is defined - if sys.platform[:5] == 'linux': - return 'posix' - else: - return sys.platform - -DEF_LINKERS, DEF_C_COMPILERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS, \ -DEF_FORTRAN_COMPILERS, DEF_ARS, DEF_OTHER_TOOLS = tool_list(pyplat2sconsplat()) # XXX: all this should be put in another files eventually once it is getting in # shape -def NumpySharedLibrary(env, target, source, *args, **kw): - """This builder is the same than SharedLibrary, except for the fact that it - takes into account build dir info passed by distutils, and put the target at - the right location in distutils build directory for correct installation.""" - source = [pjoin(env['build_dir'], i) for i in source] - # XXX: why target is a list ? It is always true ? - lib = env.SharedLibrary("$build_dir/%s" % target[0], source, *args, **kw) - - inst_lib = env.Install("$distutils_installdir", lib) - return lib, inst_lib - - -def NumpyCTypes(env, target, source, *args, **kw): - """This builder is essentially the same than SharedLibrary, but should be - used for libraries which will only be used through ctypes. - - In particular, it does not install .exp/.lib files on windows. """ - source = [pjoin(env['build_dir'], i) for i in source] - # XXX: why target is a list ? It is always true ? - # XXX: handle cases where SHLIBPREFIX is in args - lib = env.SharedLibrary("$build_dir/%s" % target[0], - source, - SHLIBPREFIX = '', - *args, - **kw) - lib = [i for i in lib if not (str(i).endswith('.exp') or str(i).endswith('.lib')) ] - inst_lib = env.Install("$distutils_installdir", lib) - return lib, inst_lib - -def GetNumpyOptions(args): - """Call this with args=ARGUMENTS to take into account command line args.""" - opts = Options(None, args) - # Add directories related info - opts.Add('pkg_name', 'name of the package (including parent package if any)', '') - opts.Add('src_dir', 'src dir relative to top called', '.') - opts.Add('build_prefix', 'build prefix (NOT including the package name)', - pjoin('build', 'scons')) - opts.Add('distutils_libdir', - 'build dir for libraries of distutils (NOT including the package name)', - pjoin('build', 'lib')) - - # Add compiler related info - opts.Add('cc_opt', 'name of C compiler', '') - opts.Add('cc_opt_path', 'path of the C compiler set in cc_opt', '') - return opts - -def GetNumpyEnvironment(args): - """Call this with args = ARGUMENTS.""" - # XXX: I would prefer subclassing Environment, because we really expect - # some different behaviour than just Environment instances... - opts = GetNumpyOptions(args) - # We set tools to an empty list, to be sure that the custom options are - # given first. We have to - env = Environment(options = opts, tools = []) - - # Setting dirs according to command line options - env.AppendUnique(build_dir = pjoin(env['build_prefix'])) - env.AppendUnique(distutils_installdir = pjoin(env['distutils_libdir'], - env['pkg_name'])) - - # =============================================== - # Setting tools according to command line options - - # XXX: how to handle tools which are not in standard location ? Is adding - # the full path of the compiler enough ? (I am sure some compilers also - # need LD_LIBRARY_SHARED and other variables to be set, too....) - if len(env['cc_opt']) > 0: - try: - if len(env['cc_opt_path']) > 0: - if env['cc_opt'] == 'intelc': - # Intel Compiler SCons.Tool has a special way to set the - # path, o we use this one instead of changing - # env['ENV']['PATH']. - t = Tool(env['cc_opt'], - topdir = os.path.split(env['cc_opt_path'])[0]) - t(env) - else: - # XXX: what is the right way to add one directory in the - # PATH ? (may not work on windows). - t = Tool(env['cc_opt']) - t(env) - if sys.platform == 'win32': - env['ENV']['PATH'] += ';%s' % env['cc_opt_path'] - else: - env['ENV']['PATH'] += ':%s' % env['cc_opt_path'] - except EnvironmentError, e: - # scons could not understand cc_opt (bad name ?) - raise AssertionError("SCONS: Could not initialize tool ? Error is %s" % \ - str(e)) - else: - t = Tool(FindTool(DEF_C_COMPILERS)) - t(env) - - # ======================================================================== - # Adding default tools for the one we do not customize: mingw is special - # according to scons, don't ask me why, but this does not work as expected - # for this tool. - if not env['cc_opt'] == 'mingw': - for i in [DEF_LINKERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS, - DEF_FORTRAN_COMPILERS]: - t = FindTool(i, env) or i[0] - Tool(t)(env) - - for t in FindAllTools(DEF_OTHER_TOOLS, env): - Tool(t)(env) - - #print env.Dump() - #print Environment().Dump('TOOLS') - # Adding custom builder - env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary - env['BUILDERS']['NumpyCTypes'] = NumpyCTypes - - # Setting build directory according to command line option - if len(env['src_dir']) > 0: - BuildDir(env['build_dir'], env['src_dir']) - else: - BuildDir(env['build_dir'], '.') - - # Generate help (if calling scons directly during debugging, this could be useful) - Help(opts.GenerateHelpText(env)) - - # Getting the config options from *.cfg files - config = get_config() - env['NUMPYCONFIG'] = config - - return env - def _get_empty(dict, key): print "++++++ Deprecated, do not use _get_empty +++++++++" try: @@ -161,97 +15,3 @@ """This convert one entry in a section of .cfg file to something usable in scons.""" pass - -def NumpyCheckLib(context, section, libs, symbol = None): - #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # This is really preliminary, and needs a lot of love before being in good - # shape !!!!! - #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # XXX: handle env var - - # XXX: handle extension in arg list - extension = '.c' - # XXX: handle symbol - src = """ -int main(int argc, char** argv) -{ - return 0; -}""" - - # Make sure libs is a list of libs: - if not is_List(libs): - libs = [libs] - - config = context.env['NUMPYCONFIG'] - context.Message('Checking for library %s...' % libs) - if config.has_section(section): - #print "Checking %s from section %s" % (library, section) - try: - # XXX: handle list of directories here - # XXX: factorize this away - newLIBPATH = config.get(section, 'library_dirs') - newCPPPATH = config.get(section, 'include_dirs') - newLIBS = config.get(section, 'libraries') - lastLIBPATH = _get_empty(context.env,'LIBPATH') - lastLIBS = _get_empty(context.env,'LIBS') - lastCPPPATH = _get_empty(context.env,'CPPPATH') - res = context.TryLink(src, extension) - if not res: - context.env.Replace(LIBS = lastLIBS, - LIBPATH = lastLIBPATH, - CPPPATH = lastCPPPATH) - except ConfigParser.NoOptionError, e: - print "+++++++++++++++++++++++++++++++" - print e - print "+++++++++++++++++++++++++++++++" - res = 0 - else: - lastLIBS = context.AppendLIBS(libs) - res = context.TryLink(src, extension) - if not res: - context.env.Replace(LIBS = lastLIBS) - return context.Result(res) - -def get_config(): - """ This tries to read .cfg files in several locations, and merge its - information into a ConfigParser object for the first found file. - - Returns the ConfigParser instance. This copies the logic in system_info - from numpy.distutils.""" - # Below is the feature we are copying from numpy.distutils: - # - # The file 'site.cfg' is looked for in - - # 1) Directory of main setup.py file being run. - # 2) Home directory of user running the setup.py file as ~/.numpy-site.cfg - # 3) System wide directory (location of this file...) - - # The first one found is used to get system configuration options The - # format is that used by ConfigParser (i.e., Windows .INI style). The - # section DEFAULT has options that are the default for each section. The - # available sections are fftw, atlas, and x11. Appropiate defaults are - # used if nothing is specified. - - from numpy.distutils.system_info import default_lib_dirs - from numpy.distutils.system_info import default_include_dirs - from numpy.distutils.system_info import default_src_dirs - from numpy.distutils.system_info import get_standard_file - - section = 'DEFAULT' - defaults = {} - defaults['libraries'] = '' - defaults['library_dirs'] = os.pathsep.join(default_lib_dirs) - defaults['include_dirs'] = os.pathsep.join(default_include_dirs) - defaults['src_dirs'] = os.pathsep.join(default_src_dirs) - cp = ConfigParser.ConfigParser(defaults) - files = [] - files.extend(get_standard_file('.numpy-site.cfg')) - files.extend(get_standard_file('site.cfg')) - - def parse_config_files(): - cp.read(files) - if not cp.has_section(section): - cp.add_section(section) - - parse_config_files() - return cp Added: branches/numpy.scons/numpy/distutils/scons/custom_builders.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_builders.py 2007-10-09 09:43:24 UTC (rev 4158) +++ branches/numpy.scons/numpy/distutils/scons/custom_builders.py 2007-10-09 15:24:09 UTC (rev 4159) @@ -0,0 +1,44 @@ +from os.path import join as pjoin + +from SCons.Environment import Environment + +def NumpySharedLibrary(env, target, source, *args, **kw): + """This builder is the same than SharedLibrary, except for the fact that it + takes into account build dir info passed by distutils, and put the target at + the right location in distutils build directory for correct installation.""" + source = [pjoin(env['build_dir'], i) for i in source] + # XXX: why target is a list ? It is always true ? + lib = env.SharedLibrary("$build_dir/%s" % target[0], source, *args, **kw) + + inst_lib = env.Install("$distutils_installdir", lib) + return lib, inst_lib + +def NumpyPythonExtension(env, target, source, *args, **kw): + """This builder is the same than PythonExtension, except for the fact that it + takes into account build dir info passed by distutils, and put the target at + the right location in distutils build directory for correct installation.""" + source = [pjoin(env['build_dir'], i) for i in source] + # XXX: why target is a list ? It is always true ? + lib = env.PythonExtension("$build_dir/%s" % target[0], source, *args, **kw) + + inst_lib = env.Install("$distutils_installdir", lib) + return lib, inst_lib + + +def NumpyCtypes(env, target, source, *args, **kw): + """This builder is essentially the same than SharedLibrary, but should be + used for libraries which will only be used through ctypes. + + In particular, it does not install .exp/.lib files on windows. """ + source = [pjoin(env['build_dir'], i) for i in source] + # XXX: why target is a list ? It is always true ? + # XXX: handle cases where SHLIBPREFIX is in args + lib = env.SharedLibrary("$build_dir/%s" % target[0], + source, + SHLIBPREFIX = '', + *args, + **kw) + lib = [i for i in lib if not (str(i).endswith('.exp') or str(i).endswith('.lib')) ] + inst_lib = env.Install("$distutils_installdir", lib) + return lib, inst_lib + Added: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-09 09:43:24 UTC (rev 4158) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-09 15:24:09 UTC (rev 4159) @@ -0,0 +1,124 @@ +# Last Changed: . +from os.path import join as pjoin +import sys + +from SCons.Options import Options +from SCons.Environment import Environment +from SCons.Tool import Tool, FindTool, FindAllTools +from SCons.Script import BuildDir, Help + +from default import tool_list +from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension +from libinfo import get_config +from extension_scons import PythonExtension + +def pyplat2sconsplat(): + # XXX: should see how env['PLATFORM'] is defined + if sys.platform[:5] == 'linux': + return 'posix' + else: + return sys.platform + +DEF_LINKERS, DEF_C_COMPILERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS, \ +DEF_FORTRAN_COMPILERS, DEF_ARS, DEF_OTHER_TOOLS = tool_list(pyplat2sconsplat()) + +def GetNumpyOptions(args): + """Call this with args=ARGUMENTS to take into account command line args.""" + opts = Options(None, args) + # Add directories related info + opts.Add('pkg_name', 'name of the package (including parent package if any)', '') + opts.Add('src_dir', 'src dir relative to top called', '.') + opts.Add('build_prefix', 'build prefix (NOT including the package name)', + pjoin('build', 'scons')) + opts.Add('distutils_libdir', + 'build dir for libraries of distutils (NOT including the package name)', + pjoin('build', 'lib')) + + # Add compiler related info + opts.Add('cc_opt', 'name of C compiler', '') + opts.Add('cc_opt_path', 'path of the C compiler set in cc_opt', '') + return opts + +def GetNumpyEnvironment(args): + """Call this with args = ARGUMENTS.""" + # XXX: I would prefer subclassing Environment, because we really expect + # some different behaviour than just Environment instances... + opts = GetNumpyOptions(args) + # We set tools to an empty list, to be sure that the custom options are + # given first. We have to + env = Environment(options = opts, tools = []) + + # Setting dirs according to command line options + env.AppendUnique(build_dir = pjoin(env['build_prefix'])) + env.AppendUnique(distutils_installdir = pjoin(env['distutils_libdir'], + env['pkg_name'])) + + # =============================================== + # Setting tools according to command line options + + # XXX: how to handle tools which are not in standard location ? Is adding + # the full path of the compiler enough ? (I am sure some compilers also + # need LD_LIBRARY_SHARED and other variables to be set, too....) + if len(env['cc_opt']) > 0: + try: + if len(env['cc_opt_path']) > 0: + if env['cc_opt'] == 'intelc': + # Intel Compiler SCons.Tool has a special way to set the + # path, o we use this one instead of changing + # env['ENV']['PATH']. + t = Tool(env['cc_opt'], + topdir = os.path.split(env['cc_opt_path'])[0]) + t(env) + else: + # XXX: what is the right way to add one directory in the + # PATH ? (may not work on windows). + t = Tool(env['cc_opt']) + t(env) + if sys.platform == 'win32': + env['ENV']['PATH'] += ';%s' % env['cc_opt_path'] + else: + env['ENV']['PATH'] += ':%s' % env['cc_opt_path'] + except EnvironmentError, e: + # scons could not understand cc_opt (bad name ?) + raise AssertionError("SCONS: Could not initialize tool ? Error is %s" % \ + str(e)) + else: + t = Tool(FindTool(DEF_C_COMPILERS)) + t(env) + + # ======================================================================== + # Adding default tools for the one we do not customize: mingw is special + # according to scons, don't ask me why, but this does not work as expected + # for this tool. + if not env['cc_opt'] == 'mingw': + for i in [DEF_LINKERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS, + DEF_FORTRAN_COMPILERS]: + t = FindTool(i, env) or i[0] + Tool(t)(env) + + for t in FindAllTools(DEF_OTHER_TOOLS, env): + Tool(t)(env) + + #print env.Dump() + #print Environment().Dump('TOOLS') + # Adding custom builder + env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary + env['BUILDERS']['NumpyCtypes'] = NumpyCtypes + env['BUILDERS']['PythonExtension'] = PythonExtension + env['BUILDERS']['NumpyPythonExtension'] = NumpyPythonExtension + + # Setting build directory according to command line option + if len(env['src_dir']) > 0: + BuildDir(env['build_dir'], env['src_dir']) + else: + BuildDir(env['build_dir'], '.') + + # Generate help (if calling scons directly during debugging, this could be useful) + Help(opts.GenerateHelpText(env)) + + # Getting the config options from *.cfg files + config = get_config() + env['NUMPYCONFIG'] = config + + return env + Modified: branches/numpy.scons/numpy/scons_fake/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/SConstruct 2007-10-09 09:43:24 UTC (rev 4158) +++ branches/numpy.scons/numpy/scons_fake/SConstruct 2007-10-09 15:24:09 UTC (rev 4159) @@ -6,13 +6,12 @@ config = env.Configure(custom_tests = {'NumpyCheckLib' : NumpyCheckLib}) config.CheckHeader('stdio.h') config.CheckLib('c', 'printf') -#config.NumpyCheckLib('sndfile', 'sndfile', 'sf_open') -config.NumpyCheckLib('bmeps', 'bmeps') -config.NumpyCheckLib('atlas', ['atlas', 'f77blas', 'cblas']) +config.NumpyCheckLib(libs = 'sndfile', symbols = 'sf_open', section = 'sndfile') config.Finish() source = ['foo.c'] import sys if sys.platform == 'win32': env.AppendUnique(CPPDEFINES = 'WIN32') -env.NumpyCTypes('foo', source) +env.NumpyCtypes('foo', source) +env.NumpyPythonExtension('spam', 'hellomodule.c') Modified: branches/numpy.scons/numpy/scons_fake/__init__.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/__init__.py 2007-10-09 09:43:24 UTC (rev 4158) +++ branches/numpy.scons/numpy/scons_fake/__init__.py 2007-10-09 15:24:09 UTC (rev 4159) @@ -1,6 +1,7 @@ from foo_py import foo +from spam import system -__all__ = ['foo'] +__all__ = ['foo', 'system'] def test(level=1, verbosity=1): from numpy.testing import NumpyTest return NumpyTest().test(level, verbosity) Added: branches/numpy.scons/numpy/scons_fake/hellomodule.c =================================================================== --- branches/numpy.scons/numpy/scons_fake/hellomodule.c 2007-10-09 09:43:24 UTC (rev 4158) +++ branches/numpy.scons/numpy/scons_fake/hellomodule.c 2007-10-09 15:24:09 UTC (rev 4159) @@ -0,0 +1,25 @@ +#include + +static PyObject * +spam_system(PyObject *self, PyObject *args) +{ + const char *command; + int sts; + + if (!PyArg_ParseTuple(args, "s", &command)) + return NULL; + sts = system(command); + return Py_BuildValue("i", sts); +} + +static PyMethodDef SpamMethods[] = { + {"system", spam_system, METH_VARARGS, + "Execute a shell command."}, + {NULL, NULL, 0, NULL} /* Sentinel */ +}; + +PyMODINIT_FUNC +initspam(void) +{ + (void) Py_InitModule("spam", SpamMethods); +} Added: branches/numpy.scons/numpy/scons_fake/tests/test_spam.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/tests/test_spam.py 2007-10-09 09:43:24 UTC (rev 4158) +++ branches/numpy.scons/numpy/scons_fake/tests/test_spam.py 2007-10-09 15:24:09 UTC (rev 4159) @@ -0,0 +1,10 @@ +from numpy.testing import * + +from numpy.scons_fake import spam + +class test_ra(NumpyTestCase): + def test(self): + spam.system('dir') + +if __name__ == "__main__": + NumpyTest('numpy.scons_fake.foo').run() From numpy-svn at scipy.org Tue Oct 9 11:50:55 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 9 Oct 2007 10:50:55 -0500 (CDT) Subject: [Numpy-svn] r4160 - in branches/numpy.scons: . numpy/distutils/scons Message-ID: <20071009155055.A39C539C07F@new.scipy.org> Author: cdavid Date: 2007-10-09 10:50:42 -0500 (Tue, 09 Oct 2007) New Revision: 4160 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Import HOME in scons environment if available Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-10 00:21:08.450999975 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-10 00:49:54.707000017 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:file-ids - numpy/scons_fake/hellomodule.c hellomodule.c-20071009151603-naqbhw7952s3b5pl-1 numpy/scons_fake/tests/test_spam.py test_spam.py-20071009151607-wobzeu6ne1916j3p-1 numpy/distutils/scons/numpyenv.py numpyenv.py-20071009151555-cl8a4vlu5xp3pzsg-1 numpy/distutils/scons/custom_builders.py custom_builders.py-20071009151552-c0fhgo48e2t0lha6-1 + Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-09 15:24:09 UTC (rev 4159) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-09 15:50:42 UTC (rev 4160) @@ -1,4 +1,5 @@ # Last Changed: . +import os.path from os.path import join as pjoin import sys @@ -99,6 +100,10 @@ for t in FindAllTools(DEF_OTHER_TOOLS, env): Tool(t)(env) + try: + env['ENV']['HOME'] = os.environ['HOME'] + except KeyError: + pass #print env.Dump() #print Environment().Dump('TOOLS') # Adding custom builder From numpy-svn at scipy.org Tue Oct 9 19:17:05 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 9 Oct 2007 18:17:05 -0500 (CDT) Subject: [Numpy-svn] r4161 - in branches/numpy.scons: . numpy/scons_fake numpy/scons_fake/ctypesext numpy/scons_fake/ctypesext/tests numpy/scons_fake/pyext numpy/scons_fake/pyext/tests Message-ID: <20071009231705.6F2FA39C061@new.scipy.org> Author: cdavid Date: 2007-10-09 18:16:37 -0500 (Tue, 09 Oct 2007) New Revision: 4161 Added: branches/numpy.scons/numpy/scons_fake/ctypesext/ branches/numpy.scons/numpy/scons_fake/ctypesext/SConstruct branches/numpy.scons/numpy/scons_fake/ctypesext/__init__.py branches/numpy.scons/numpy/scons_fake/ctypesext/foo.c branches/numpy.scons/numpy/scons_fake/ctypesext/foo_py.py branches/numpy.scons/numpy/scons_fake/ctypesext/setup.py branches/numpy.scons/numpy/scons_fake/ctypesext/tests/ branches/numpy.scons/numpy/scons_fake/ctypesext/tests/test_foo_py.py branches/numpy.scons/numpy/scons_fake/pyext/ branches/numpy.scons/numpy/scons_fake/pyext/hellomodule.c branches/numpy.scons/numpy/scons_fake/pyext/tests/ branches/numpy.scons/numpy/scons_fake/pyext/tests/test_spam.py Removed: branches/numpy.scons/numpy/scons_fake/SConstruct branches/numpy.scons/numpy/scons_fake/__init__.py branches/numpy.scons/numpy/scons_fake/foo.c branches/numpy.scons/numpy/scons_fake/foo_py.py branches/numpy.scons/numpy/scons_fake/hellomodule.c branches/numpy.scons/numpy/scons_fake/pyext/tests/test_foo_py.py branches/numpy.scons/numpy/scons_fake/pyext/tests/test_spam.py branches/numpy.scons/numpy/scons_fake/setup.py branches/numpy.scons/numpy/scons_fake/tests/ Modified: branches/numpy.scons/ Log: Split the scons_fake example package into two Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-10 00:49:54.707000017 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-10 07:31:02.891999960 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:file-ids - + numpy/scons_fake/ctypesext numpyscons_fakectype-20071009222126-tpzs2312hkp03hcu-1 numpy/scons_fake/ctypesext/__init__.py __init__.py-20070922113634-7m61zd3x0182bwro-1 numpy/scons_fake/ctypesext/foo.c foo.c-20070920125943-f6sf0rnbhik75mtj-1 numpy/scons_fake/ctypesext/SConstruct sconstruct-20070920125938-jw3np1dk1gtr5a4s-1 numpy/scons_fake/ctypesext/setup.py setup.py-20070920081521-unftng09muypbx5t-2 numpy/scons_fake/ctypesext/foo_py.py foo_py.py-20070924164547-m01dunwfr91x9rg1-1 numpy/scons_fake/ctypesext/tests numpyscons_fakectype-20071009222215-v9ksajiiyzlhsmmp-1 numpy/scons_fake/ctypesext/tests/test_foo_py.py test_foo_py.py-20070924163456-f1o01h1eksm5bevu-2 numpy/scons_fake/pyext numpyscons_fakepyext-20071009222120-mfloawjkwdaonpel-1 numpy/scons_fake/pyext/hellomodule.c hellomodule.c-20071009151603-naqbhw7952s3b5pl-1 numpy/scons_fake/pyext/tests tests-20070924163456-f1o01h1eksm5bevu-1 numpy/scons_fake/pyext/tests/test_spam.py test_spam.py-20071009151607-wobzeu6ne1916j3p-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 Deleted: branches/numpy.scons/numpy/scons_fake/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/SConstruct 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/SConstruct 2007-10-09 23:16:37 UTC (rev 4161) @@ -1,17 +0,0 @@ -# vim:syntax=python -from numpy.distutils.scons import GetNumpyEnvironment, NumpyCheckLib - -env = GetNumpyEnvironment(ARGUMENTS) - -config = env.Configure(custom_tests = {'NumpyCheckLib' : NumpyCheckLib}) -config.CheckHeader('stdio.h') -config.CheckLib('c', 'printf') -config.NumpyCheckLib(libs = 'sndfile', symbols = 'sf_open', section = 'sndfile') -config.Finish() - -source = ['foo.c'] -import sys -if sys.platform == 'win32': - env.AppendUnique(CPPDEFINES = 'WIN32') -env.NumpyCtypes('foo', source) -env.NumpyPythonExtension('spam', 'hellomodule.c') Deleted: branches/numpy.scons/numpy/scons_fake/__init__.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/__init__.py 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/__init__.py 2007-10-09 23:16:37 UTC (rev 4161) @@ -1,7 +0,0 @@ -from foo_py import foo -from spam import system - -__all__ = ['foo', 'system'] -def test(level=1, verbosity=1): - from numpy.testing import NumpyTest - return NumpyTest().test(level, verbosity) Copied: branches/numpy.scons/numpy/scons_fake/ctypesext/SConstruct (from rev 4160, branches/numpy.scons/numpy/scons_fake/SConstruct) =================================================================== --- branches/numpy.scons/numpy/scons_fake/SConstruct 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/SConstruct 2007-10-09 23:16:37 UTC (rev 4161) @@ -0,0 +1,17 @@ +# vim:syntax=python +from numpy.distutils.scons import GetNumpyEnvironment, NumpyCheckLib + +env = GetNumpyEnvironment(ARGUMENTS) + +config = env.Configure(custom_tests = {'NumpyCheckLib' : NumpyCheckLib}) +config.CheckHeader('stdio.h') +config.CheckLib('c', 'printf') +config.NumpyCheckLib(libs = 'sndfile', symbols = 'sf_open', section = 'sndfile') +config.Finish() + +source = ['foo.c'] +import sys +if sys.platform == 'win32': + env.AppendUnique(CPPDEFINES = 'WIN32') +env.NumpyCtypes('foo', source) +env.NumpyPythonExtension('spam', 'hellomodule.c') Copied: branches/numpy.scons/numpy/scons_fake/ctypesext/__init__.py (from rev 4160, branches/numpy.scons/numpy/scons_fake/__init__.py) =================================================================== --- branches/numpy.scons/numpy/scons_fake/__init__.py 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/__init__.py 2007-10-09 23:16:37 UTC (rev 4161) @@ -0,0 +1,7 @@ +from foo_py import foo +from spam import system + +__all__ = ['foo', 'system'] +def test(level=1, verbosity=1): + from numpy.testing import NumpyTest + return NumpyTest().test(level, verbosity) Copied: branches/numpy.scons/numpy/scons_fake/ctypesext/foo.c (from rev 4160, branches/numpy.scons/numpy/scons_fake/foo.c) =================================================================== --- branches/numpy.scons/numpy/scons_fake/foo.c 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/foo.c 2007-10-09 23:16:37 UTC (rev 4161) @@ -0,0 +1,13 @@ +#include + +#ifdef WIN32 +#define FOO_EXPORT __declspec(dllexport) +#else +#define FOO_EXPORT +#endif + +int FOO_EXPORT foo(void) +{ + printf("hello\n"); + return 0; +} Copied: branches/numpy.scons/numpy/scons_fake/ctypesext/foo_py.py (from rev 4160, branches/numpy.scons/numpy/scons_fake/foo_py.py) =================================================================== --- branches/numpy.scons/numpy/scons_fake/foo_py.py 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/foo_py.py 2007-10-09 23:16:37 UTC (rev 4161) @@ -0,0 +1,6 @@ +from numpy.ctypeslib import load_library + +_FOO = load_library("foo", __file__) +def foo(): + _FOO.foo() + Copied: branches/numpy.scons/numpy/scons_fake/ctypesext/setup.py (from rev 4160, branches/numpy.scons/numpy/scons_fake/setup.py) =================================================================== --- branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/setup.py 2007-10-09 23:16:37 UTC (rev 4161) @@ -0,0 +1,44 @@ +import os +import os.path + +def get_object_names(source_filenames, strip_dir=0, output_dir=''): + # ripped off distutilc.ccompiler (CCompiler_object_filenames) + if output_dir is None: + output_dir = '' + obj_names = [] + for src_name in source_filenames: + base, ext = os.path.splitext(os.path.normpath(src_name)) + base = os.path.splitdrive(base)[1] # Chop off the drive + base = base[os.path.isabs(base):] # If abs, chop off leading / + if base.startswith('..'): + # Resolve starting relative path components, middle ones + # (if any) have been handled by os.path.normpath above. + i = base.rfind('..')+2 + d = base[:i] + d = os.path.basename(os.path.abspath(d)) + base = d + base[i:] + #XXX: how to know which file types are supported ? + #if ext not in self.src_extensions: + # raise UnknownFileError, \ + # "unknown file type '%s' (from '%s')" % (ext, src_name) + if strip_dir: + base = os.path.basename(base) + #XXX: change '.o' to something like obj_extension + obj_name = os.path.join(output_dir,base + '.o') + obj_names.append(obj_name) + return obj_names + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + from numpy.distutils.system_info import get_info + config = Configuration('scons_fake',parent_package,top_path) + + #config.add_library('_fortran_foo', + # sources=['foo.f']) + config.add_sconscript('SConstruct') + config.add_data_dir('tests') + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Copied: branches/numpy.scons/numpy/scons_fake/ctypesext/tests/test_foo_py.py (from rev 4160, branches/numpy.scons/numpy/scons_fake/tests/test_foo_py.py) =================================================================== --- branches/numpy.scons/numpy/scons_fake/tests/test_foo_py.py 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/tests/test_foo_py.py 2007-10-09 23:16:37 UTC (rev 4161) @@ -0,0 +1,10 @@ +from numpy.testing import * + +from numpy.scons_fake import foo + +class test_ra(NumpyTestCase): + def test(self): + foo() + +if __name__ == "__main__": + NumpyTest('numpy.scons_fake.foo').run() Deleted: branches/numpy.scons/numpy/scons_fake/foo.c =================================================================== --- branches/numpy.scons/numpy/scons_fake/foo.c 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/foo.c 2007-10-09 23:16:37 UTC (rev 4161) @@ -1,13 +0,0 @@ -#include - -#ifdef WIN32 -#define FOO_EXPORT __declspec(dllexport) -#else -#define FOO_EXPORT -#endif - -int FOO_EXPORT foo(void) -{ - printf("hello\n"); - return 0; -} Deleted: branches/numpy.scons/numpy/scons_fake/foo_py.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/foo_py.py 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/foo_py.py 2007-10-09 23:16:37 UTC (rev 4161) @@ -1,6 +0,0 @@ -from numpy.ctypeslib import load_library - -_FOO = load_library("foo", __file__) -def foo(): - _FOO.foo() - Deleted: branches/numpy.scons/numpy/scons_fake/hellomodule.c =================================================================== --- branches/numpy.scons/numpy/scons_fake/hellomodule.c 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/hellomodule.c 2007-10-09 23:16:37 UTC (rev 4161) @@ -1,25 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return Py_BuildValue("i", sts); -} - -static PyMethodDef SpamMethods[] = { - {"system", spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL, NULL, 0, NULL} /* Sentinel */ -}; - -PyMODINIT_FUNC -initspam(void) -{ - (void) Py_InitModule("spam", SpamMethods); -} Copied: branches/numpy.scons/numpy/scons_fake/pyext/hellomodule.c (from rev 4160, branches/numpy.scons/numpy/scons_fake/hellomodule.c) =================================================================== --- branches/numpy.scons/numpy/scons_fake/hellomodule.c 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/pyext/hellomodule.c 2007-10-09 23:16:37 UTC (rev 4161) @@ -0,0 +1,25 @@ +#include + +static PyObject * +spam_system(PyObject *self, PyObject *args) +{ + const char *command; + int sts; + + if (!PyArg_ParseTuple(args, "s", &command)) + return NULL; + sts = system(command); + return Py_BuildValue("i", sts); +} + +static PyMethodDef SpamMethods[] = { + {"system", spam_system, METH_VARARGS, + "Execute a shell command."}, + {NULL, NULL, 0, NULL} /* Sentinel */ +}; + +PyMODINIT_FUNC +initspam(void) +{ + (void) Py_InitModule("spam", SpamMethods); +} Copied: branches/numpy.scons/numpy/scons_fake/pyext/tests (from rev 4160, branches/numpy.scons/numpy/scons_fake/tests) Deleted: branches/numpy.scons/numpy/scons_fake/pyext/tests/test_foo_py.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/tests/test_foo_py.py 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/pyext/tests/test_foo_py.py 2007-10-09 23:16:37 UTC (rev 4161) @@ -1,10 +0,0 @@ -from numpy.testing import * - -from numpy.scons_fake import foo - -class test_ra(NumpyTestCase): - def test(self): - foo() - -if __name__ == "__main__": - NumpyTest('numpy.scons_fake.foo').run() Deleted: branches/numpy.scons/numpy/scons_fake/pyext/tests/test_spam.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/tests/test_spam.py 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/pyext/tests/test_spam.py 2007-10-09 23:16:37 UTC (rev 4161) @@ -1,10 +0,0 @@ -from numpy.testing import * - -from numpy.scons_fake import spam - -class test_ra(NumpyTestCase): - def test(self): - spam.system('dir') - -if __name__ == "__main__": - NumpyTest('numpy.scons_fake.foo').run() Copied: branches/numpy.scons/numpy/scons_fake/pyext/tests/test_spam.py (from rev 4160, branches/numpy.scons/numpy/scons_fake/tests/test_spam.py) Deleted: branches/numpy.scons/numpy/scons_fake/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-09 15:50:42 UTC (rev 4160) +++ branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-09 23:16:37 UTC (rev 4161) @@ -1,44 +0,0 @@ -import os -import os.path - -def get_object_names(source_filenames, strip_dir=0, output_dir=''): - # ripped off distutilc.ccompiler (CCompiler_object_filenames) - if output_dir is None: - output_dir = '' - obj_names = [] - for src_name in source_filenames: - base, ext = os.path.splitext(os.path.normpath(src_name)) - base = os.path.splitdrive(base)[1] # Chop off the drive - base = base[os.path.isabs(base):] # If abs, chop off leading / - if base.startswith('..'): - # Resolve starting relative path components, middle ones - # (if any) have been handled by os.path.normpath above. - i = base.rfind('..')+2 - d = base[:i] - d = os.path.basename(os.path.abspath(d)) - base = d + base[i:] - #XXX: how to know which file types are supported ? - #if ext not in self.src_extensions: - # raise UnknownFileError, \ - # "unknown file type '%s' (from '%s')" % (ext, src_name) - if strip_dir: - base = os.path.basename(base) - #XXX: change '.o' to something like obj_extension - obj_name = os.path.join(output_dir,base + '.o') - obj_names.append(obj_name) - return obj_names - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - from numpy.distutils.system_info import get_info - config = Configuration('scons_fake',parent_package,top_path) - - #config.add_library('_fortran_foo', - # sources=['foo.f']) - config.add_sconscript('SConstruct') - config.add_data_dir('tests') - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) From numpy-svn at scipy.org Tue Oct 9 19:17:31 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 9 Oct 2007 18:17:31 -0500 (CDT) Subject: [Numpy-svn] r4162 - in branches/numpy.scons: . numpy/scons_fake numpy/scons_fake/ctypesext numpy/scons_fake/pyext Message-ID: <20071009231731.A006D39C061@new.scipy.org> Author: cdavid Date: 2007-10-09 18:17:14 -0500 (Tue, 09 Oct 2007) New Revision: 4162 Added: branches/numpy.scons/numpy/scons_fake/pyext/SConstruct branches/numpy.scons/numpy/scons_fake/pyext/setup.py branches/numpy.scons/numpy/scons_fake/setup.py Modified: branches/numpy.scons/ branches/numpy.scons/numpy/scons_fake/ctypesext/SConstruct branches/numpy.scons/numpy/scons_fake/ctypesext/setup.py Log: Finish the split of scons_fake into two packages Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-10 07:31:02.891999960 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-10 07:52:59.790999889 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:file-ids - numpy/scons_fake/ctypesext numpyscons_fakectype-20071009222126-tpzs2312hkp03hcu-1 numpy/scons_fake/ctypesext/__init__.py __init__.py-20070922113634-7m61zd3x0182bwro-1 numpy/scons_fake/ctypesext/foo.c foo.c-20070920125943-f6sf0rnbhik75mtj-1 numpy/scons_fake/ctypesext/SConstruct sconstruct-20070920125938-jw3np1dk1gtr5a4s-1 numpy/scons_fake/ctypesext/setup.py setup.py-20070920081521-unftng09muypbx5t-2 numpy/scons_fake/ctypesext/foo_py.py foo_py.py-20070924164547-m01dunwfr91x9rg1-1 numpy/scons_fake/ctypesext/tests numpyscons_fakectype-20071009222215-v9ksajiiyzlhsmmp-1 numpy/scons_fake/ctypesext/tests/test_foo_py.py test_foo_py.py-20070924163456-f1o01h1eksm5bevu-2 numpy/scons_fake/pyext numpyscons_fakepyext-20071009222120-mfloawjkwdaonpel-1 numpy/scons_fake/pyext/hellomodule.c hellomodule.c-20071009151603-naqbhw7952s3b5pl-1 numpy/scons_fake/pyext/tests tests-20070924163456-f1o01h1eksm5bevu-1 numpy/scons_fake/pyext/tests/test_spam.py test_spam.py-20071009151607-wobzeu6ne1916j3p-1 + numpy/scons_fake/setup.py setup.py-20071009225234-65q3519bx0wvuhyp-1 numpy/scons_fake/pyext/SConstruct sconstruct-20071009225241-1u6tr190flp1g15l-1 numpy/scons_fake/pyext/setup.py setup.py-20071009225238-6cteldy08e4udc0o-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe Modified: branches/numpy.scons/numpy/scons_fake/ctypesext/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/ctypesext/SConstruct 2007-10-09 23:16:37 UTC (rev 4161) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/SConstruct 2007-10-09 23:17:14 UTC (rev 4162) @@ -3,15 +3,7 @@ env = GetNumpyEnvironment(ARGUMENTS) -config = env.Configure(custom_tests = {'NumpyCheckLib' : NumpyCheckLib}) -config.CheckHeader('stdio.h') -config.CheckLib('c', 'printf') -config.NumpyCheckLib(libs = 'sndfile', symbols = 'sf_open', section = 'sndfile') -config.Finish() - -source = ['foo.c'] import sys if sys.platform == 'win32': env.AppendUnique(CPPDEFINES = 'WIN32') -env.NumpyCtypes('foo', source) -env.NumpyPythonExtension('spam', 'hellomodule.c') +env.NumpyCtypes('foo', source = ['foo.c']) Modified: branches/numpy.scons/numpy/scons_fake/ctypesext/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/ctypesext/setup.py 2007-10-09 23:16:37 UTC (rev 4161) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/setup.py 2007-10-09 23:17:14 UTC (rev 4162) @@ -1,40 +1,10 @@ import os import os.path -def get_object_names(source_filenames, strip_dir=0, output_dir=''): - # ripped off distutilc.ccompiler (CCompiler_object_filenames) - if output_dir is None: - output_dir = '' - obj_names = [] - for src_name in source_filenames: - base, ext = os.path.splitext(os.path.normpath(src_name)) - base = os.path.splitdrive(base)[1] # Chop off the drive - base = base[os.path.isabs(base):] # If abs, chop off leading / - if base.startswith('..'): - # Resolve starting relative path components, middle ones - # (if any) have been handled by os.path.normpath above. - i = base.rfind('..')+2 - d = base[:i] - d = os.path.basename(os.path.abspath(d)) - base = d + base[i:] - #XXX: how to know which file types are supported ? - #if ext not in self.src_extensions: - # raise UnknownFileError, \ - # "unknown file type '%s' (from '%s')" % (ext, src_name) - if strip_dir: - base = os.path.basename(base) - #XXX: change '.o' to something like obj_extension - obj_name = os.path.join(output_dir,base + '.o') - obj_names.append(obj_name) - return obj_names - def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration - from numpy.distutils.system_info import get_info - config = Configuration('scons_fake',parent_package,top_path) + config = Configuration('ctypesext',parent_package,top_path) - #config.add_library('_fortran_foo', - # sources=['foo.f']) config.add_sconscript('SConstruct') config.add_data_dir('tests') return config Added: branches/numpy.scons/numpy/scons_fake/pyext/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/pyext/SConstruct 2007-10-09 23:16:37 UTC (rev 4161) +++ branches/numpy.scons/numpy/scons_fake/pyext/SConstruct 2007-10-09 23:17:14 UTC (rev 4162) @@ -0,0 +1,6 @@ +# vim:syntax=python +from numpy.distutils.scons import GetNumpyEnvironment + +env = GetNumpyEnvironment(ARGUMENTS) + +env.NumpyPythonExtension('spam', source = ['hellomodule.c']) Added: branches/numpy.scons/numpy/scons_fake/pyext/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/pyext/setup.py 2007-10-09 23:16:37 UTC (rev 4161) +++ branches/numpy.scons/numpy/scons_fake/pyext/setup.py 2007-10-09 23:17:14 UTC (rev 4162) @@ -0,0 +1,14 @@ +import os +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('pyext',parent_package,top_path) + + config.add_sconscript('SConstruct') + config.add_data_dir('tests') + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Added: branches/numpy.scons/numpy/scons_fake/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-09 23:16:37 UTC (rev 4161) +++ branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-09 23:17:14 UTC (rev 4162) @@ -0,0 +1,14 @@ +import os +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('scons_fake',parent_package,top_path) + + config.add_subpackage('pyext') + config.add_subpackage('ctypesext') + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) From numpy-svn at scipy.org Tue Oct 9 22:28:38 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 9 Oct 2007 21:28:38 -0500 (CDT) Subject: [Numpy-svn] r4163 - in branches/numpy.scons: . numpy/scons_fake numpy/scons_fake/ctypesext numpy/scons_fake/ctypesext/tests numpy/scons_fake/pyext numpy/scons_fake/pyext/tests Message-ID: <20071010022838.EED8839C232@new.scipy.org> Author: cdavid Date: 2007-10-09 21:27:53 -0500 (Tue, 09 Oct 2007) New Revision: 4163 Added: branches/numpy.scons/numpy/scons_fake/__init__.py branches/numpy.scons/numpy/scons_fake/pyext/__init__.py branches/numpy.scons/test.sh Modified: branches/numpy.scons/ branches/numpy.scons/numpy/scons_fake/ctypesext/__init__.py branches/numpy.scons/numpy/scons_fake/ctypesext/tests/test_foo_py.py branches/numpy.scons/numpy/scons_fake/pyext/tests/test_spam.py Log: Make scons_fake a realy python package, for the tests to work Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-10 07:52:59.790999889 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-10 11:17:10.790999889 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:file-ids - numpy/scons_fake/setup.py setup.py-20071009225234-65q3519bx0wvuhyp-1 numpy/scons_fake/pyext/SConstruct sconstruct-20071009225241-1u6tr190flp1g15l-1 numpy/scons_fake/pyext/setup.py setup.py-20071009225238-6cteldy08e4udc0o-1 + test.sh test.sh-20071010021651-sb161covas3h5rf8-1 numpy/scons_fake/__init__.py __init__.py-20071010021643-a8zje05xk9kn70r1-1 numpy/scons_fake/pyext/__init__.py __init__.py-20071010021648-c3je6ovvif87gtea-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi Added: branches/numpy.scons/numpy/scons_fake/__init__.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/__init__.py 2007-10-09 23:17:14 UTC (rev 4162) +++ branches/numpy.scons/numpy/scons_fake/__init__.py 2007-10-10 02:27:53 UTC (rev 4163) @@ -0,0 +1,2 @@ +import pyext +import ctypesext Modified: branches/numpy.scons/numpy/scons_fake/ctypesext/__init__.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/ctypesext/__init__.py 2007-10-09 23:17:14 UTC (rev 4162) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/__init__.py 2007-10-10 02:27:53 UTC (rev 4163) @@ -1,7 +1,6 @@ from foo_py import foo -from spam import system -__all__ = ['foo', 'system'] +__all__ = ['foo'] def test(level=1, verbosity=1): from numpy.testing import NumpyTest return NumpyTest().test(level, verbosity) Modified: branches/numpy.scons/numpy/scons_fake/ctypesext/tests/test_foo_py.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/ctypesext/tests/test_foo_py.py 2007-10-09 23:17:14 UTC (rev 4162) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/tests/test_foo_py.py 2007-10-10 02:27:53 UTC (rev 4163) @@ -1,10 +1,10 @@ from numpy.testing import * -from numpy.scons_fake import foo +from numpy.scons_fake.ctypesext import foo class test_ra(NumpyTestCase): def test(self): foo() if __name__ == "__main__": - NumpyTest('numpy.scons_fake.foo').run() + NumpyTest('numpy.scons_fake.ctypesext').run() Added: branches/numpy.scons/numpy/scons_fake/pyext/__init__.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/pyext/__init__.py 2007-10-09 23:17:14 UTC (rev 4162) +++ branches/numpy.scons/numpy/scons_fake/pyext/__init__.py 2007-10-10 02:27:53 UTC (rev 4163) @@ -0,0 +1,6 @@ +from spam import system + +__all__ = ['system'] +def test(level=1, verbosity=1): + from numpy.testing import NumpyTest + return NumpyTest().test(level, verbosity) Modified: branches/numpy.scons/numpy/scons_fake/pyext/tests/test_spam.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/pyext/tests/test_spam.py 2007-10-09 23:17:14 UTC (rev 4162) +++ branches/numpy.scons/numpy/scons_fake/pyext/tests/test_spam.py 2007-10-10 02:27:53 UTC (rev 4163) @@ -1,10 +1,10 @@ from numpy.testing import * -from numpy.scons_fake import spam +from numpy.scons_fake.pyext import spam class test_ra(NumpyTestCase): def test(self): spam.system('dir') if __name__ == "__main__": - NumpyTest('numpy.scons_fake.foo').run() + NumpyTest('numpy.scons_fake.pyext').run() Added: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-10-09 23:17:14 UTC (rev 4162) +++ branches/numpy.scons/test.sh 2007-10-10 02:27:53 UTC (rev 4163) @@ -0,0 +1,5 @@ +PREFIX=/usr/media/src/src/dsp/bzrversion/numpy.scons/tmp +#rm -rf build +rm -rf $PREFIX +python setup.py install --prefix=$PREFIX +(cd $PREFIX && PYTHONPATH=$PREFIX/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") From numpy-svn at scipy.org Tue Oct 9 23:31:53 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 9 Oct 2007 22:31:53 -0500 (CDT) Subject: [Numpy-svn] r4164 - in branches/numpy.scons: . numpy/distutils/scons Message-ID: <20071010033153.2E90D39C249@new.scipy.org> Author: cdavid Date: 2007-10-09 22:31:41 -0500 (Tue, 09 Oct 2007) New Revision: 4164 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Try to detect if suncc is used, for special initialization of scons env. Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-10 11:17:10.790999889 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-10 12:22:18.861999989 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:file-ids - test.sh test.sh-20071010021651-sb161covas3h5rf8-1 numpy/scons_fake/__init__.py __init__.py-20071010021643-a8zje05xk9kn70r1-1 numpy/scons_fake/pyext/__init__.py __init__.py-20071010021648-c3je6ovvif87gtea-1 + Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 02:27:53 UTC (rev 4163) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 03:31:41 UTC (rev 4164) @@ -23,6 +23,21 @@ DEF_LINKERS, DEF_C_COMPILERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS, \ DEF_FORTRAN_COMPILERS, DEF_ARS, DEF_OTHER_TOOLS = tool_list(pyplat2sconsplat()) +def is_cc_suncc(fullpath): + """Return true if the compiler is suncc.""" + # I wish there was a better way: we launch suncc -V, read the output, and + # returns true if this succeeds and Sun is found in the output. + import os + import re + suncc = re.compile('[Ss][Uu][Nn]') + # Redirect stderr to stdout + cmd = fullpath + ' -V 2>1' + out = os.popen(cmd) + cnt = out.read() + st = out.close() + + return not(st) and suncc.search(cnt) + def GetNumpyOptions(args): """Call this with args=ARGUMENTS to take into account command line args.""" opts = Options(None, args) @@ -71,6 +86,8 @@ topdir = os.path.split(env['cc_opt_path'])[0]) t(env) else: + if is_cc_suncc(pjoin(env['cc_opt_path'], env['cc_opt'])): + env['cc_opt'] == 'suncc' # XXX: what is the right way to add one directory in the # PATH ? (may not work on windows). t = Tool(env['cc_opt']) From numpy-svn at scipy.org Tue Oct 9 23:35:06 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 9 Oct 2007 22:35:06 -0500 (CDT) Subject: [Numpy-svn] r4165 - in branches/numpy.scons: . numpy/distutils/scons Message-ID: <20071010033506.DC13539C07C@new.scipy.org> Author: cdavid Date: 2007-10-09 22:34:53 -0500 (Tue, 09 Oct 2007) New Revision: 4165 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Print a message if suncc is detected Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-10 12:22:18.861999989 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-10 12:23:23.635999918 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 03:31:41 UTC (rev 4164) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 03:34:53 UTC (rev 4165) @@ -87,6 +87,7 @@ t(env) else: if is_cc_suncc(pjoin(env['cc_opt_path'], env['cc_opt'])): + print "++ overwriting cc to suncc ++" env['cc_opt'] == 'suncc' # XXX: what is the right way to add one directory in the # PATH ? (may not work on windows). From numpy-svn at scipy.org Wed Oct 10 01:57:26 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 10 Oct 2007 00:57:26 -0500 (CDT) Subject: [Numpy-svn] r4166 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071010055726.2AC2739C0FB@new.scipy.org> Author: cdavid Date: 2007-10-10 00:57:06 -0500 (Wed, 10 Oct 2007) New Revision: 4166 Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Correct suncc detection in scons env Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 03:34:53 UTC (rev 4165) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 05:57:06 UTC (rev 4166) @@ -36,7 +36,7 @@ cnt = out.read() st = out.close() - return not(st) and suncc.search(cnt) + return st == 0 and suncc.search(cnt) def GetNumpyOptions(args): """Call this with args=ARGUMENTS to take into account command line args.""" From numpy-svn at scipy.org Wed Oct 10 02:06:10 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 10 Oct 2007 01:06:10 -0500 (CDT) Subject: [Numpy-svn] r4167 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071010060610.A1DB039C017@new.scipy.org> Author: cdavid Date: 2007-10-10 01:06:03 -0500 (Wed, 10 Oct 2007) New Revision: 4167 Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Correct suncc detection in scons env Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 05:57:06 UTC (rev 4166) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 06:06:03 UTC (rev 4167) @@ -27,6 +27,8 @@ """Return true if the compiler is suncc.""" # I wish there was a better way: we launch suncc -V, read the output, and # returns true if this succeeds and Sun is found in the output. + + print "Testing suncc..." import os import re suncc = re.compile('[Ss][Uu][Nn]') @@ -34,7 +36,9 @@ cmd = fullpath + ' -V 2>1' out = os.popen(cmd) cnt = out.read() + print "content is %s" % cnt st = out.close() + print "st is %d" % st return st == 0 and suncc.search(cnt) From numpy-svn at scipy.org Wed Oct 10 03:07:15 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 10 Oct 2007 02:07:15 -0500 (CDT) Subject: [Numpy-svn] r4168 - in branches/numpy.scons/numpy/distutils: command scons Message-ID: <20071010070715.AC01939C226@new.scipy.org> Author: cdavid Date: 2007-10-10 02:07:03 -0500 (Wed, 10 Oct 2007) New Revision: 4168 Modified: branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: New version for suncc detection Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-10 06:06:03 UTC (rev 4167) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-10 07:07:03 UTC (rev 4168) @@ -114,7 +114,7 @@ force=self.force) self.compiler.customize(self.distribution) - # This initialization seems necessary, sometimes, for find_executable to work... + # This initialization seems necessary, sometimes, for find_executable to work... if hasattr(self.compiler, 'initialize'): self.compiler.initialize() @@ -140,8 +140,6 @@ # there is a size limitation ? What is the standard solution in thise # case ? - # XXX: does this work everywhere in all situations ? This assumes - # scons.py is executable. scons_exec = get_python_exec_invoc() scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py')) for i in self.scons_scripts: @@ -150,7 +148,6 @@ cmd += ' distutils_libdir=%s ' % protect_path(pjoin(self.build_lib, pdirname(i))) cmd += ' cc_opt=%s ' % dist2sconscc(self.compiler) cmd += ' cc_opt_path=%s ' % protect_path(get_tool_path(self.compiler)) - print cmd st = os.system(cmd) if st: print "status is %d" % st Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 06:06:03 UTC (rev 4167) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 07:07:03 UTC (rev 4168) @@ -26,21 +26,21 @@ def is_cc_suncc(fullpath): """Return true if the compiler is suncc.""" # I wish there was a better way: we launch suncc -V, read the output, and - # returns true if this succeeds and Sun is found in the output. + # returns true if Sun is found in the output. We cannot check the status code, because - print "Testing suncc..." import os import re - suncc = re.compile('[Ss][Uu][Nn]') + suncc = re.compile('Sun C') # Redirect stderr to stdout - cmd = fullpath + ' -V 2>1' + cmd = fullpath + ' -V 2>&1' + print "Testing suncc with command %s..." % cmd out = os.popen(cmd) cnt = out.read() print "content is %s" % cnt st = out.close() print "st is %d" % st - return st == 0 and suncc.search(cnt) + return suncc.search(cnt) def GetNumpyOptions(args): """Call this with args=ARGUMENTS to take into account command line args.""" From numpy-svn at scipy.org Wed Oct 10 03:20:39 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 10 Oct 2007 02:20:39 -0500 (CDT) Subject: [Numpy-svn] r4169 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071010072039.0B3E539C033@new.scipy.org> Author: cdavid Date: 2007-10-10 02:20:31 -0500 (Wed, 10 Oct 2007) New Revision: 4169 Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: More work for sunos Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 07:07:03 UTC (rev 4168) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 07:20:31 UTC (rev 4169) @@ -26,19 +26,18 @@ def is_cc_suncc(fullpath): """Return true if the compiler is suncc.""" # I wish there was a better way: we launch suncc -V, read the output, and - # returns true if Sun is found in the output. We cannot check the status code, because + # returns true if Sun is found in the output. We cannot check the status + # code, because the compiler does not seem to have a way to do nothing + # while returning success (0). import os import re suncc = re.compile('Sun C') # Redirect stderr to stdout cmd = fullpath + ' -V 2>&1' - print "Testing suncc with command %s..." % cmd out = os.popen(cmd) cnt = out.read() - print "content is %s" % cnt st = out.close() - print "st is %d" % st return suncc.search(cnt) @@ -126,7 +125,7 @@ env['ENV']['HOME'] = os.environ['HOME'] except KeyError: pass - #print env.Dump() + print env.Dump('TOOLS') #print Environment().Dump('TOOLS') # Adding custom builder env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary From numpy-svn at scipy.org Wed Oct 10 05:51:43 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 10 Oct 2007 04:51:43 -0500 (CDT) Subject: [Numpy-svn] r4170 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071010095143.4685739C0D6@new.scipy.org> Author: cdavid Date: 2007-10-10 04:51:24 -0500 (Wed, 10 Oct 2007) New Revision: 4170 Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Fix == to = in numpyenv for suncc overwriting Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 07:20:31 UTC (rev 4169) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 09:51:24 UTC (rev 4170) @@ -90,8 +90,7 @@ t(env) else: if is_cc_suncc(pjoin(env['cc_opt_path'], env['cc_opt'])): - print "++ overwriting cc to suncc ++" - env['cc_opt'] == 'suncc' + env['cc_opt'] = 'suncc' # XXX: what is the right way to add one directory in the # PATH ? (may not work on windows). t = Tool(env['cc_opt']) From numpy-svn at scipy.org Wed Oct 10 06:04:21 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 10 Oct 2007 05:04:21 -0500 (CDT) Subject: [Numpy-svn] r4171 - in branches/numpy.scons/numpy: distutils/scons scons_fake/ctypesext Message-ID: <20071010100421.11B5539C0D6@new.scipy.org> Author: cdavid Date: 2007-10-10 05:04:06 -0500 (Wed, 10 Oct 2007) New Revision: 4171 Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py branches/numpy.scons/numpy/scons_fake/ctypesext/__init__.py Log: More work for sunos support Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 09:51:24 UTC (rev 4170) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 10:04:06 UTC (rev 4171) @@ -14,9 +14,11 @@ from extension_scons import PythonExtension def pyplat2sconsplat(): - # XXX: should see how env['PLATFORM'] is defined + # XXX: should see how env['PLATFORM'] is defined, make this a dictionary if sys.platform[:5] == 'linux': return 'posix' + elif sys.platform[:5] == 'sunos': + return 'sunos' else: return sys.platform @@ -124,7 +126,6 @@ env['ENV']['HOME'] = os.environ['HOME'] except KeyError: pass - print env.Dump('TOOLS') #print Environment().Dump('TOOLS') # Adding custom builder env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary Modified: branches/numpy.scons/numpy/scons_fake/ctypesext/__init__.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/ctypesext/__init__.py 2007-10-10 09:51:24 UTC (rev 4170) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/__init__.py 2007-10-10 10:04:06 UTC (rev 4171) @@ -1,6 +1,10 @@ -from foo_py import foo +try: + from foo_py import foo + __all__ = ['foo'] +except ImportError, e: + print "Warning: Error importing pyext, error was %s" % e + __all__ = [] -__all__ = ['foo'] def test(level=1, verbosity=1): from numpy.testing import NumpyTest return NumpyTest().test(level, verbosity) From numpy-svn at scipy.org Wed Oct 10 08:47:02 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 10 Oct 2007 07:47:02 -0500 (CDT) Subject: [Numpy-svn] r4172 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071010124702.2C17A39C25D@new.scipy.org> Author: cdavid Date: 2007-10-10 07:46:47 -0500 (Wed, 10 Oct 2007) New Revision: 4172 Modified: branches/numpy.scons/numpy/distutils/scons/extension_scons.py Log: Making PythonExtension builder work on mac os X Modified: branches/numpy.scons/numpy/distutils/scons/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-10 10:04:06 UTC (rev 4171) +++ branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-10 12:46:47 UTC (rev 4172) @@ -33,9 +33,14 @@ # XXX: We add the path where to find python2.5.lib (or any other # version, of course). This seems to be necessary for MS compilers. env.AppendUnique(LIBPATH = get_pythonlib_dir()) + elif sys.platform == "darwin": + pyext = '.so' #env['LDMODULESUFFIX'] + print pyext + # XXX: When those should be used ? (which version of Mac OS X ?) + LINKFLAGS += ' -undefined dynamic_lookup ' else: pyext = env['SHLIBSUFFIX'] - wrap = env.SharedLibrary(target, source, SHLIBPREFIX = '', - SHLIBSUFFIX = pyext, LINKFLAGS = LINKFLAGS, + wrap = env.LoadableModule(target, source, SHLIBPREFIX = '', + LDMODULESUFFIX = pyext, LINKFLAGS = LINKFLAGS, CPPPATH = CPPPATH, *args, **kw) return wrap From numpy-svn at scipy.org Wed Oct 10 23:42:21 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 10 Oct 2007 22:42:21 -0500 (CDT) Subject: [Numpy-svn] r4173 - in branches/numpy.scons: . numpy/distutils/scons Message-ID: <20071011034221.5158A39C03C@new.scipy.org> Author: cdavid Date: 2007-10-10 22:42:03 -0500 (Wed, 10 Oct 2007) New Revision: 4173 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/scons/extension_scons.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Get python extension suffix from distutils Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-10 12:23:23.635999918 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-11 12:32:23.678999901 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h Modified: branches/numpy.scons/numpy/distutils/scons/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-10 12:46:47 UTC (rev 4172) +++ branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-11 03:42:03 UTC (rev 4173) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Oct 09 04:00 PM 2007 J +# Last Change: Thu Oct 11 12:00 PM 2007 J # Module for support to build python extension. scons specific code goes here. import sys @@ -18,14 +18,14 @@ LINKFLAGS = deepcopy(env['LINKFLAGS']) else: LINKFLAGS = [] + if env.has_key('CPPPPATH'): CPPPATH = deepcopy(env['CPPPATH']) else: CPPPATH = [] + CPPPATH.append(get_python_inc()) if sys.platform == 'win32': - # XXX: pyext should definitely not be set here - pyext = '.pyd' if built_with_mstools(env): # # XXX is the export necessary ? (this seems to work wo) # LINKFLAGS += " /EXPORT:init%s " % target[0] @@ -34,13 +34,11 @@ # version, of course). This seems to be necessary for MS compilers. env.AppendUnique(LIBPATH = get_pythonlib_dir()) elif sys.platform == "darwin": - pyext = '.so' #env['LDMODULESUFFIX'] - print pyext - # XXX: When those should be used ? (which version of Mac OS X ?) - LINKFLAGS += ' -undefined dynamic_lookup ' - else: - pyext = env['SHLIBSUFFIX'] + # XXX: When those should be used ? (which version of Mac OS X ?) + LINKFLAGS += ' -undefined dynamic_lookup ' + + # Use LoadableModule because of Mac OS X wrap = env.LoadableModule(target, source, SHLIBPREFIX = '', - LDMODULESUFFIX = pyext, LINKFLAGS = LINKFLAGS, + LDMODULESUFFIX = "$PYEXTSUFFIX", LINKFLAGS = LINKFLAGS, CPPPATH = CPPPATH, *args, **kw) return wrap Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-10 12:46:47 UTC (rev 4172) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-11 03:42:03 UTC (rev 4173) @@ -3,6 +3,8 @@ from os.path import join as pjoin import sys +from distutils.sysconfig import get_config_vars + from SCons.Options import Options from SCons.Environment import Environment from SCons.Tool import Tool, FindTool, FindAllTools @@ -65,9 +67,13 @@ # XXX: I would prefer subclassing Environment, because we really expect # some different behaviour than just Environment instances... opts = GetNumpyOptions(args) + + # Get the python extension suffix + pyextsuffix = get_config_vars('SO') + # We set tools to an empty list, to be sure that the custom options are # given first. We have to - env = Environment(options = opts, tools = []) + env = Environment(options = opts, tools = [], PYEXTSUFFIX = pyextsuffix) # Setting dirs according to command line options env.AppendUnique(build_dir = pjoin(env['build_prefix'])) @@ -126,7 +132,7 @@ env['ENV']['HOME'] = os.environ['HOME'] except KeyError: pass - #print Environment().Dump('TOOLS') + #print Environment().Dump() # Adding custom builder env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary env['BUILDERS']['NumpyCtypes'] = NumpyCtypes From numpy-svn at scipy.org Wed Oct 10 23:42:47 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 10 Oct 2007 22:42:47 -0500 (CDT) Subject: [Numpy-svn] r4174 - in branches/numpy.scons: . numpy/scons_fake numpy/scons_fake/checklib Message-ID: <20071011034247.0AACA39C05F@new.scipy.org> Author: cdavid Date: 2007-10-10 22:42:34 -0500 (Wed, 10 Oct 2007) New Revision: 4174 Added: branches/numpy.scons/numpy/scons_fake/checklib/ branches/numpy.scons/numpy/scons_fake/checklib/SConstruct branches/numpy.scons/numpy/scons_fake/checklib/setup.py Modified: branches/numpy.scons/ branches/numpy.scons/numpy/scons_fake/setup.py Log: Add one fake example for checking library Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-11 12:32:23.678999901 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-11 12:32:41.559999943 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:file-ids - + numpy/scons_fake/checklib checklib-20071011033204-1grjkgi22nafyjk7-1 numpy/scons_fake/checklib/SConstruct sconstruct-20071011033204-1grjkgi22nafyjk7-2 numpy/scons_fake/checklib/setup.py setup.py-20071011033204-1grjkgi22nafyjk7-4 numpy/scons_fake/checklib/__init__.py __init__.py-20071011033204-1grjkgi22nafyjk7-3 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf Added: branches/numpy.scons/numpy/scons_fake/checklib/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checklib/SConstruct 2007-10-11 03:42:03 UTC (rev 4173) +++ branches/numpy.scons/numpy/scons_fake/checklib/SConstruct 2007-10-11 03:42:34 UTC (rev 4174) @@ -0,0 +1,9 @@ +# vim:syntax=python +from numpy.distutils.scons import GetNumpyEnvironment, NumpyCheckLib + +env = GetNumpyEnvironment(ARGUMENTS) + +config = env.Configure(custom_tests = {'NumpyCheckLib' : NumpyCheckLib}) +if not config.NumpyCheckLib('sndfile', 'sf_open', section = 'sndfile'): + print "sndfile not found, this package cannot work without sndfile !" +config.Finish() Added: branches/numpy.scons/numpy/scons_fake/checklib/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/checklib/setup.py 2007-10-11 03:42:03 UTC (rev 4173) +++ branches/numpy.scons/numpy/scons_fake/checklib/setup.py 2007-10-11 03:42:34 UTC (rev 4174) @@ -0,0 +1,13 @@ +import os +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('checklib',parent_package,top_path) + + config.add_sconscript('SConstruct') + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Modified: branches/numpy.scons/numpy/scons_fake/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-11 03:42:03 UTC (rev 4173) +++ branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-11 03:42:34 UTC (rev 4174) @@ -7,6 +7,7 @@ config.add_subpackage('pyext') config.add_subpackage('ctypesext') + config.add_subpackage('checklib') return config if __name__ == '__main__': From numpy-svn at scipy.org Thu Oct 11 05:29:23 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 11 Oct 2007 04:29:23 -0500 (CDT) Subject: [Numpy-svn] r4175 - in branches/numpy.scons: . numpy/distutils/scons Message-ID: <20071011092923.0252839C04E@new.scipy.org> Author: cdavid Date: 2007-10-11 04:29:06 -0500 (Thu, 11 Oct 2007) New Revision: 4175 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/default.py branches/numpy.scons/numpy/distutils/scons/extension_scons.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Some code cleaning in distutils/scons Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-11 12:32:41.559999943 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-11 16:12:51.690999985 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:file-ids - numpy/scons_fake/checklib checklib-20071011033204-1grjkgi22nafyjk7-1 numpy/scons_fake/checklib/SConstruct sconstruct-20071011033204-1grjkgi22nafyjk7-2 numpy/scons_fake/checklib/setup.py setup.py-20071011033204-1grjkgi22nafyjk7-4 numpy/scons_fake/checklib/__init__.py __init__.py-20071011033204-1grjkgi22nafyjk7-3 + Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-11 03:42:34 UTC (rev 4174) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-11 09:29:06 UTC (rev 4175) @@ -1,17 +1,2 @@ from numpyenv import GetNumpyEnvironment, GetNumpyOptions from libinfo_scons import NumpyCheckLib - -# XXX: all this should be put in another files eventually once it is getting in -# shape - -def _get_empty(dict, key): - print "++++++ Deprecated, do not use _get_empty +++++++++" - try: - return dict[key] - except KeyError, e: - return [] - -def cfgentry2list(entry): - """This convert one entry in a section of .cfg file to something usable in - scons.""" - pass Modified: branches/numpy.scons/numpy/distutils/scons/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/default.py 2007-10-11 03:42:34 UTC (rev 4174) +++ branches/numpy.scons/numpy/distutils/scons/default.py 2007-10-11 09:29:06 UTC (rev 4175) @@ -1,3 +1,8 @@ +#! /usr/bin/env python +# Last Change: Thu Oct 11 04:00 PM 2007 J + +# This is a copy of scons/Tools/__init__.py, because scons does not offer any +# public api for this def tool_list(platform): """platform should be the value returned by enbv['PLATFORM'], not sys.platform !!!!.""" Modified: branches/numpy.scons/numpy/distutils/scons/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-11 03:42:34 UTC (rev 4174) +++ branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-11 09:29:06 UTC (rev 4175) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Thu Oct 11 12:00 PM 2007 J +# Last Change: Thu Oct 11 03:00 PM 2007 J # Module for support to build python extension. scons specific code goes here. import sys @@ -27,9 +27,6 @@ CPPPATH.append(get_python_inc()) if sys.platform == 'win32': if built_with_mstools(env): - # # XXX is the export necessary ? (this seems to work wo) - # LINKFLAGS += " /EXPORT:init%s " % target[0] - # XXX: We add the path where to find python2.5.lib (or any other # version, of course). This seems to be necessary for MS compilers. env.AppendUnique(LIBPATH = get_pythonlib_dir()) @@ -39,6 +36,6 @@ # Use LoadableModule because of Mac OS X wrap = env.LoadableModule(target, source, SHLIBPREFIX = '', - LDMODULESUFFIX = "$PYEXTSUFFIX", LINKFLAGS = LINKFLAGS, + LDMODULESUFFIX = '$PYEXTSUFFIX', LINKFLAGS = LINKFLAGS, CPPPATH = CPPPATH, *args, **kw) return wrap Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-11 03:42:34 UTC (rev 4174) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-11 09:29:06 UTC (rev 4175) @@ -69,6 +69,9 @@ opts = GetNumpyOptions(args) # Get the python extension suffix + # XXX this should be defined somewhere else. Is there a way to reliably get + # all the necessary informations specific to python extensions (linkflags, + # etc...) dynamically ? pyextsuffix = get_config_vars('SO') # We set tools to an empty list, to be sure that the custom options are From numpy-svn at scipy.org Fri Oct 12 02:53:08 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 12 Oct 2007 01:53:08 -0500 (CDT) Subject: [Numpy-svn] r4176 - in branches/numpy.scons: . numpy/distutils/command Message-ID: <20071012065308.E565739C071@new.scipy.org> Author: cdavid Date: 2007-10-12 01:51:56 -0500 (Fri, 12 Oct 2007) New Revision: 4176 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/command/scons.py Log: Minor cleanup of scons command Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-11 16:12:51.690999985 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-12 13:03:23.233999968 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-11 09:29:06 UTC (rev 4175) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-12 06:51:56 UTC (rev 4176) @@ -22,12 +22,7 @@ # take into accound os.environ. This actually also works for my way of # using "local python", using the alias facility of bash. import sys - #print dir(sys) return sys.executable - #try: - # pypath = os.environ['PYTHONPATH'] - #except KeyError: - # pypath = None def dist2sconscc(compiler): """This converts the name passed to distutils to scons name convention (C @@ -74,7 +69,7 @@ """Convert path (given as a string) to something the shell will have no problem to understand (space, etc... problems).""" # XXX: to this correctly, this is totally bogus for now (does not check for - # already quoted path, for example. + # already quoted path, for example). return '"' + path + '"' class scons(old_build_ext): @@ -93,7 +88,7 @@ def finalize_options(self): old_build_ext.finalize_options(self) if self.distribution.has_scons_scripts(): - print "Got it: scons scripts are %s" % self.distribution.scons_scripts + #print "Got it: scons scripts are %s" % self.distribution.scons_scripts self.scons_scripts = self.distribution.scons_scripts else: self.scons_scripts = [] @@ -106,7 +101,6 @@ # full path, and add the path to the env['PATH'] variable in env # instance (this is done in numpy.distutils.scons module). compiler_type = self.compiler - print compiler_type from distutils.ccompiler import new_compiler self.compiler = new_compiler(compiler=compiler_type, verbose=self.verbose, @@ -114,23 +108,10 @@ force=self.force) self.compiler.customize(self.distribution) - # This initialization seems necessary, sometimes, for find_executable to work... + # This initialization seems necessary, sometimes, for find_executable to work... if hasattr(self.compiler, 'initialize'): self.compiler.initialize() - # XXX: debug, remove - if self.scons_scripts: - #print "++++++++++++++++++++++++++++++++++++++++" - #print "self.compiler is %s, this gives us scons tool %s" % (compiler_type, - # dist2sconscc(self.compiler)) - #print get_tool_path(self.compiler) - #print "++++++++++++++++++++++++++++++++++++++++" - - print "++++++++++++++++++++++++++++++++++++++++" - print get_scons_local_path() - print get_python_exec_invoc() - print "++++++++++++++++++++++++++++++++++++++++" - def run(self): # XXX: when a scons script is missing, scons only prints warnings, and # does not return a failure (status is 0). We have to detect this from @@ -143,7 +124,7 @@ scons_exec = get_python_exec_invoc() scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py')) for i in self.scons_scripts: - cmd = scons_exec + " -f " + i + ' -I. ' + cmd = scons_exec + " -Q -f " + i + ' -I. ' cmd += ' src_dir="%s" ' % pdirname(i) cmd += ' distutils_libdir=%s ' % protect_path(pjoin(self.build_lib, pdirname(i))) cmd += ' cc_opt=%s ' % dist2sconscc(self.compiler) From numpy-svn at scipy.org Fri Oct 12 06:20:13 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 12 Oct 2007 05:20:13 -0500 (CDT) Subject: [Numpy-svn] r4177 - in branches/numpy.scons: . numpy/distutils/command numpy/distutils/scons Message-ID: <20071012102013.6606739C133@new.scipy.org> Author: cdavid Date: 2007-10-12 05:19:37 -0500 (Fri, 12 Oct 2007) New Revision: 4177 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Set build dir correctly for scons: each subpackage has its own directory Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-12 13:03:23.233999968 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-12 13:28:01.773999929 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-12 06:51:56 UTC (rev 4176) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-12 10:19:37 UTC (rev 4177) @@ -76,6 +76,7 @@ # XXX: I really do not like the way distutils add attributes "on the fly". # We should eally avoid that and remove all the code which does it before # release. + # XXX: add an option to the scons command for configuration (auto/force/cache). description = "Scons builder" #user_options = [] user_options = [('fcompiler=', None, "specify the Fortran compiler type"), @@ -124,12 +125,16 @@ scons_exec = get_python_exec_invoc() scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py')) for i in self.scons_scripts: + # XXX: This is inefficient... (use join instead) cmd = scons_exec + " -Q -f " + i + ' -I. ' cmd += ' src_dir="%s" ' % pdirname(i) - cmd += ' distutils_libdir=%s ' % protect_path(pjoin(self.build_lib, pdirname(i))) + #cmd += ' pkg_name="%s" ' % pdirname(i) + cmd += ' distutils_libdir=%s ' % protect_path(pjoin(self.build_lib, + pdirname(i))) cmd += ' cc_opt=%s ' % dist2sconscc(self.compiler) cmd += ' cc_opt_path=%s ' % protect_path(get_tool_path(self.compiler)) st = os.system(cmd) if st: print "status is %d" % st - raise DistutilsExecError("Error while executing scons command %s (see above)" % cmd) + raise DistutilsExecError("Error while executing scons command "\ + "%s (see above)" % cmd) Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-12 06:51:56 UTC (rev 4176) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-12 10:19:37 UTC (rev 4177) @@ -79,7 +79,7 @@ env = Environment(options = opts, tools = [], PYEXTSUFFIX = pyextsuffix) # Setting dirs according to command line options - env.AppendUnique(build_dir = pjoin(env['build_prefix'])) + env.AppendUnique(build_dir = pjoin(env['build_prefix'], env['src_dir'])) env.AppendUnique(distutils_installdir = pjoin(env['distutils_libdir'], env['pkg_name'])) From numpy-svn at scipy.org Fri Oct 12 06:21:06 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 12 Oct 2007 05:21:06 -0500 (CDT) Subject: [Numpy-svn] r4178 - in branches/numpy.scons: . numpy/distutils/command numpy/distutils/scons numpy/scons_fake/checklib Message-ID: <20071012102106.7797A39C0EA@new.scipy.org> Author: cdavid Date: 2007-10-12 05:20:22 -0500 (Fri, 12 Oct 2007) New Revision: 4178 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py branches/numpy.scons/numpy/distutils/scons/utils.py branches/numpy.scons/numpy/scons_fake/checklib/SConstruct Log: put signature files in separate dir for subpackage Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-12 13:28:01.773999929 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-12 15:35:27.987999916 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012063527-x9tlkbs04vw0iyxg Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-12 10:19:37 UTC (rev 4177) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-12 10:20:22 UTC (rev 4178) @@ -128,7 +128,6 @@ # XXX: This is inefficient... (use join instead) cmd = scons_exec + " -Q -f " + i + ' -I. ' cmd += ' src_dir="%s" ' % pdirname(i) - #cmd += ' pkg_name="%s" ' % pdirname(i) cmd += ' distutils_libdir=%s ' % protect_path(pjoin(self.build_lib, pdirname(i))) cmd += ' cc_opt=%s ' % dist2sconscc(self.compiler) Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-12 10:19:37 UTC (rev 4177) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-12 10:20:22 UTC (rev 4178) @@ -1,6 +1,6 @@ # Last Changed: . import os.path -from os.path import join as pjoin +from os.path import join as pjoin, dirname as pdirname import sys from distutils.sysconfig import get_config_vars @@ -118,6 +118,24 @@ t = Tool(FindTool(DEF_C_COMPILERS)) t(env) + # XXX: Really, we should use our own subclass of Environment, instead of + # adding Numpy* functions ! + + # Put config code in separate dir for each subpackage + from utils import curry + NumpyConfigure = curry(env.Configure, conf_dir = pjoin(env['build_dir'], '.sconf')) + env.NumpyConfigure = NumpyConfigure + # XXX: Huge, ungly hack ! SConsign needs an absolute path or a path + # relative to where the SConstruct file is. We have to find the path of + # the build dir relative to the src_dir: we add n .., where n is the number + # of occureant of the path separator in the src dir. + def get_build_relative_src(srcdir, builddir): + n = srcdir.count(os.sep) + 1 + return pjoin(os.sep.join([r'..' for i in range(n)]), builddir) + env.SConsignFile(pjoin(get_build_relative_src(env['src_dir'], + env['build_dir']), + '.sconsign.dblite')) + # ======================================================================== # Adding default tools for the one we do not customize: mingw is special # according to scons, don't ask me why, but this does not work as expected Modified: branches/numpy.scons/numpy/distutils/scons/utils.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-12 10:19:37 UTC (rev 4177) +++ branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-12 10:20:22 UTC (rev 4178) @@ -42,3 +42,17 @@ except KeyError, e: return [] +class curry: + def __init__(self, fun, *args, **kwargs): + self.fun = fun + self.pending = args[:] + self.kwargs = kwargs.copy() + + def __call__(self, *args, **kwargs): + if kwargs and self.kwargs: + kw = self.kwargs.copy() + kw.update(kwargs) + else: + kw = kwargs or self.kwargs + + return self.fun(*(self.pending + args), **kw) Modified: branches/numpy.scons/numpy/scons_fake/checklib/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checklib/SConstruct 2007-10-12 10:19:37 UTC (rev 4177) +++ branches/numpy.scons/numpy/scons_fake/checklib/SConstruct 2007-10-12 10:20:22 UTC (rev 4178) @@ -3,7 +3,7 @@ env = GetNumpyEnvironment(ARGUMENTS) -config = env.Configure(custom_tests = {'NumpyCheckLib' : NumpyCheckLib}) +config = env.NumpyConfigure(custom_tests = {'NumpyCheckLib' : NumpyCheckLib}) if not config.NumpyCheckLib('sndfile', 'sf_open', section = 'sndfile'): print "sndfile not found, this package cannot work without sndfile !" config.Finish() From numpy-svn at scipy.org Fri Oct 12 06:40:55 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 12 Oct 2007 05:40:55 -0500 (CDT) Subject: [Numpy-svn] r4179 - in branches: . numpy.scons numpy.scons/numpy/distutils Message-ID: <20071012104055.96CF939C0BA@new.scipy.org> Author: cdavid Date: 2007-10-12 05:40:32 -0500 (Fri, 12 Oct 2007) New Revision: 4179 Added: branches/numpy.scons/ Removed: branches/numpy.scons/ Modified: branches/numpy.scons/numpy/distutils/misc_util.py Log: Add an optional setup file name in Configuration object Copied: branches/numpy.scons (from rev 4177, branches/numpy.scons) Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info + timestamp: 2007-10-12 16:12:07.611999989 +0900 committer: David Cournapeau properties: branch-nick: numpy.sconsified Name: bzr:ancestry:v3-trunk0 + svn-v3-trunk0:94b884b6-d6fd-0310-90d3-974f1d3f35e1:branches%2Fnumpy.scons:4112 Name: bzr:file-ids + Name: bzr:revision-id:v3-trunk0 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf Name: svn:ignore + dist build numpy.egg-info Name: svnmerge-integrated + /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-2871 Name: svk:merge + 0cecc865-f901-0410-ba8f-b2c75a717db0:/local/scipy_core:1600 0cecc865-f901-0410-ba8f-b2c75a717db0:/local/scipy_core/branches/newcore:723 ad311012-0000-0410-80c7-f29fd8fc08ef:/local/newcore:353994b884b6-d6fd-0310-90d3-974f1d3f35e1:/branches/numpy.scons:4112 Modified: branches/numpy.scons/numpy/distutils/misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-12 10:19:37 UTC (rev 4177) +++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-12 10:40:32 UTC (rev 4179) @@ -587,6 +587,7 @@ top_path=None, package_path=None, caller_level=1, + setup_name='setup.py', **attrs): """Construct configuration instance of a package. @@ -675,6 +676,8 @@ if caller_instance.options['delegate_options_to_subpackages']: self.set_options(**caller_instance.options) + self.setup_name = setup_name + def todict(self): """Return configuration distionary suitable for passing to distutils.core.setup() function. @@ -796,7 +799,7 @@ else: subpackage_path = njoin([subpackage_path] + l[:-1]) subpackage_path = self.paths([subpackage_path])[0] - setup_py = njoin(subpackage_path, 'setup.py') + setup_py = njoin(subpackage_path, self.setup_name) if not self.options['ignore_setup_xxx_py']: if not os.path.isfile(setup_py): setup_py = njoin(subpackage_path, From numpy-svn at scipy.org Fri Oct 12 06:42:09 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 12 Oct 2007 05:42:09 -0500 (CDT) Subject: [Numpy-svn] r4180 - in branches/numpy.scons: . numpy numpy/core numpy/distutils numpy/f2py numpy/fft numpy/lib numpy/linalg numpy/numarray numpy/oldnumeric numpy/random numpy/scons_fake numpy/testing Message-ID: <20071012104209.BADA739C01A@new.scipy.org> Author: cdavid Date: 2007-10-12 05:41:08 -0500 (Fri, 12 Oct 2007) New Revision: 4180 Added: branches/numpy.scons/numpy/core/setupscons.py branches/numpy.scons/numpy/distutils/setupscons.py branches/numpy.scons/numpy/f2py/setupscons.py branches/numpy.scons/numpy/fft/setupscons.py branches/numpy.scons/numpy/lib/setupscons.py branches/numpy.scons/numpy/linalg/setupscons.py branches/numpy.scons/numpy/numarray/setupscons.py branches/numpy.scons/numpy/oldnumeric/setupscons.py branches/numpy.scons/numpy/random/setupscons.py branches/numpy.scons/numpy/scons_fake/setupscons.py branches/numpy.scons/numpy/setupscons.py branches/numpy.scons/numpy/testing/setupscons.py branches/numpy.scons/setupscons.py Modified: branches/numpy.scons/ Log: Set up setupscons.py files where it matters for future sconsification of numpy Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-12 16:12:07.611999989 +0900 committer: David Cournapeau properties: branch-nick: numpy.sconsified + timestamp: 2007-10-12 16:34:26.244999886 +0900 committer: David Cournapeau properties: branch-nick: numpy.sconsified Name: bzr:file-ids - + setupscons.py setupscons.py-20071012073152-5cjw0f21wjrronpp-1 numpy/setupscons.py setupscons.py-20071012073156-2q41hv4160unzvgu-1 numpy/distutils/setupscons.py setupscons.py-20071012073225-2siuy69nudxygxhf-1 numpy/random/setupscons.py setupscons.py-20071012073345-rdz48sxmx4l5z104-1 numpy/scons_fake/setupscons.py setupscons.py-20071012073348-qsdmbjgvmo8v4vfa-1 numpy/lib/setupscons.py setupscons.py-20071012073400-jj4s0c8bf3tdyk8u-1 numpy/numarray/setupscons.py setupscons.py-20071012073332-ozzndtqjcck51weo-1 numpy/f2py/setupscons.py setupscons.py-20071012073214-nfy7furt0j408jxj-1 numpy/core/setupscons.py setupscons.py-20071012073209-yf3ikofbaleurqt0-1 numpy/fft/setupscons.py setupscons.py-20071012073214-nfy7furt0j408jxj-2 numpy/linalg/setupscons.py setupscons.py-20071012073400-jj4s0c8bf3tdyk8u-2 numpy/oldnumeric/setupscons.py setupscons.py-20071012073341-cyophs8ex8ot7u1c-1 numpy/testing/setupscons.py setupscons.py-20071012073353-ti1uodrc1u4hzipy-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 Added: branches/numpy.scons/numpy/core/setupscons.py =================================================================== --- branches/numpy.scons/numpy/core/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,348 @@ +import imp +import os +import sys +from os.path import join +from numpy.distutils import log +from distutils.dep_util import newer + +FUNCTIONS_TO_CHECK = [ + ('expl', 'HAVE_LONGDOUBLE_FUNCS'), + ('expf', 'HAVE_FLOAT_FUNCS'), + ('log1p', 'HAVE_LOG1P'), + ('expm1', 'HAVE_EXPM1'), + ('asinh', 'HAVE_INVERSE_HYPERBOLIC'), + ('atanhf', 'HAVE_INVERSE_HYPERBOLIC_FLOAT'), + ('atanhl', 'HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE'), + ('isnan', 'HAVE_ISNAN'), + ('isinf', 'HAVE_ISINF'), + ('rint', 'HAVE_RINT'), + ] + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration,dot_join + from numpy.distutils.system_info import get_info, default_lib_dirs + + config = Configuration('core',parent_package,top_path) + local_dir = config.local_path + codegen_dir = join(local_dir,'code_generators') + + generate_umath_py = join(codegen_dir,'generate_umath.py') + n = dot_join(config.name,'generate_umath') + generate_umath = imp.load_module('_'.join(n.split('.')), + open(generate_umath_py,'U'),generate_umath_py, + ('.py','U',1)) + + header_dir = 'include/numpy' # this is relative to config.path_in_package + + def generate_config_h(ext, build_dir): + target = join(build_dir,'config.h') + if newer(__file__,target): + config_cmd = config.get_config_cmd() + log.info('Generating %s',target) + tc = generate_testcode(target) + from distutils import sysconfig + python_include = sysconfig.get_python_inc() + python_h = join(python_include, 'Python.h') + if not os.path.isfile(python_h): + raise SystemError,\ + "Non-existing %s. Perhaps you need to install"\ + " python-dev|python-devel." % (python_h) + result = config_cmd.try_run(tc,include_dirs=[python_include], + library_dirs = default_lib_dirs) + if not result: + raise SystemError,"Failed to test configuration. "\ + "See previous error messages for more information." + + # Python 2.3 causes a segfault when + # trying to re-acquire the thread-state + # which is done in error-handling + # ufunc code. NPY_ALLOW_C_API and friends + # cause the segfault. So, we disable threading + # for now. + if sys.version[:5] < '2.4.2': + nosmp = 1 + else: + # Perhaps a fancier check is in order here. + # so that threads are only enabled if there + # are actually multiple CPUS? -- but + # threaded code can be nice even on a single + # CPU so that long-calculating code doesn't + # block. + try: + nosmp = os.environ['NPY_NOSMP'] + nosmp = 1 + except KeyError: + nosmp = 0 + if nosmp: moredefs = [('NPY_ALLOW_THREADS', '0')] + else: moredefs = [] + # + mathlibs = [] + tc = testcode_mathlib() + mathlibs_choices = [[],['m'],['cpml']] + mathlib = os.environ.get('MATHLIB') + if mathlib: + mathlibs_choices.insert(0,mathlib.split(',')) + for libs in mathlibs_choices: + if config_cmd.try_run(tc,libraries=libs): + mathlibs = libs + break + else: + raise EnvironmentError("math library missing; rerun " + "setup.py after setting the " + "MATHLIB env variable") + ext.libraries.extend(mathlibs) + moredefs.append(('MATHLIB',','.join(mathlibs))) + + def check_func(func_name): + return config_cmd.check_func(func_name, + libraries=mathlibs, decl=False, + headers=['math.h']) + + for func_name, defsymbol in FUNCTIONS_TO_CHECK: + if check_func(func_name): + moredefs.append(defsymbol) + + if sys.platform == 'win32': + moredefs.append('NPY_NO_SIGNAL') + + if sys.platform=='win32' or os.name=='nt': + from distutils.msvccompiler import get_build_architecture + a = get_build_architecture() + print 'BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % (a, os.name, sys.platform) + if a == 'AMD64': + moredefs.append('DISTUTILS_USE_SDK') + + if sys.version[:3] < '2.4': + if config_cmd.check_func('strtod', decl=False, + headers=['stdlib.h']): + moredefs.append(('PyOS_ascii_strtod', 'strtod')) + + target_f = open(target,'a') + for d in moredefs: + if isinstance(d,str): + target_f.write('#define %s\n' % (d)) + else: + target_f.write('#define %s %s\n' % (d[0],d[1])) + if not nosmp: # default is to use WITH_THREAD + target_f.write('#ifdef WITH_THREAD\n#define NPY_ALLOW_THREADS 1\n#else\n#define NPY_ALLOW_THREADS 0\n#endif\n') + target_f.close() + print 'File:',target + target_f = open(target) + print target_f.read() + target_f.close() + print 'EOF' + else: + mathlibs = [] + target_f = open(target) + for line in target_f.readlines(): + s = '#define MATHLIB' + if line.startswith(s): + value = line[len(s):].strip() + if value: + mathlibs.extend(value.split(',')) + target_f.close() + + ext.libraries.extend(mathlibs) + + incl_dir = os.path.dirname(target) + if incl_dir not in config.numpy_include_dirs: + config.numpy_include_dirs.append(incl_dir) + + config.add_data_files((header_dir,target)) + return target + + def generate_api_func(module_name): + def generate_api(ext, build_dir): + script = join(codegen_dir, module_name + '.py') + sys.path.insert(0, codegen_dir) + try: + m = __import__(module_name) + log.info('executing %s', script) + h_file, c_file, doc_file = m.generate_api(build_dir) + finally: + del sys.path[0] + config.add_data_files((header_dir, h_file), + (header_dir, doc_file)) + return (h_file,) + return generate_api + + generate_array_api = generate_api_func('generate_array_api') + generate_ufunc_api = generate_api_func('generate_ufunc_api') + + def generate_umath_c(ext,build_dir): + target = join(build_dir,'__umath_generated.c') + script = generate_umath_py + if newer(script,target): + f = open(target,'w') + f.write(generate_umath.make_code(generate_umath.defdict, + generate_umath.__file__)) + f.close() + return [] + + config.add_data_files('include/numpy/*.h') + config.add_include_dirs('src') + + config.numpy_include_dirs.extend(config.paths('include')) + + deps = [join('src','arrayobject.c'), + join('src','arraymethods.c'), + join('src','scalartypes.inc.src'), + join('src','arraytypes.inc.src'), + join('src','_signbit.c'), + join('src','_isnan.c'), + join('src','ucsnarrow.c'), + join('include','numpy','*object.h'), + 'include/numpy/fenv/fenv.c', + 'include/numpy/fenv/fenv.h', + join(codegen_dir,'genapi.py'), + join(codegen_dir,'*.txt') + ] + + # Don't install fenv unless we need them. + if sys.platform == 'cygwin': + config.add_data_dir('include/numpy/fenv') + + config.add_extension('multiarray', + sources = [join('src','multiarraymodule.c'), + generate_config_h, + generate_array_api, + join('src','scalartypes.inc.src'), + join('src','arraytypes.inc.src'), + join(codegen_dir,'generate_array_api.py'), + join('*.py') + ], + depends = deps, + ) + + config.add_extension('umath', + sources = [generate_config_h, + join('src','umathmodule.c.src'), + generate_umath_c, + generate_ufunc_api, + join('src','scalartypes.inc.src'), + join('src','arraytypes.inc.src'), + ], + depends = [join('src','ufuncobject.c'), + generate_umath_py, + join(codegen_dir,'generate_ufunc_api.py'), + ]+deps, + ) + + config.add_extension('_sort', + sources=[join('src','_sortmodule.c.src'), + generate_config_h, + generate_array_api, + ], + ) + + config.add_extension('scalarmath', + sources=[join('src','scalarmathmodule.c.src'), + generate_config_h, + generate_array_api, + generate_ufunc_api], + ) + + # Configure blasdot + blas_info = get_info('blas_opt',0) + #blas_info = {} + def get_dotblas_sources(ext, build_dir): + if blas_info: + if ('NO_ATLAS_INFO',1) in blas_info.get('define_macros',[]): + return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient. + return ext.depends[:1] + return None # no extension module will be built + + config.add_extension('_dotblas', + sources = [get_dotblas_sources], + depends=[join('blasdot','_dotblas.c'), + join('blasdot','cblas.h'), + ], + include_dirs = ['blasdot'], + extra_info = blas_info + ) + + + config.add_data_dir('tests') + config.make_svn_version_py() + + return config + +def testcode_mathlib(): + return """\ +/* check whether libm is broken */ +#include +int main(int argc, char *argv[]) +{ + return exp(-720.) > 1.0; /* typically an IEEE denormal */ +} +""" + +import sys +def generate_testcode(target): + if sys.platform == 'win32': + target = target.replace('\\','\\\\') + testcode = [r''' +#include +#include +#include + +int main(int argc, char **argv) +{ + + FILE *fp; + + fp = fopen("'''+target+'''","w"); + '''] + + c_size_test = r''' +#ifndef %(sz)s + fprintf(fp,"#define %(sz)s %%d\n", sizeof(%(type)s)); +#else + fprintf(fp,"/* #define %(sz)s %%d */\n", %(sz)s); +#endif +''' + for sz, t in [('SIZEOF_SHORT', 'short'), + ('SIZEOF_INT', 'int'), + ('SIZEOF_LONG', 'long'), + ('SIZEOF_FLOAT', 'float'), + ('SIZEOF_DOUBLE', 'double'), + ('SIZEOF_LONG_DOUBLE', 'long double'), + ('SIZEOF_PY_INTPTR_T', 'Py_intptr_t'), + ]: + testcode.append(c_size_test % {'sz' : sz, 'type' : t}) + + testcode.append('#ifdef PY_LONG_LONG') + testcode.append(c_size_test % {'sz' : 'SIZEOF_LONG_LONG', + 'type' : 'PY_LONG_LONG'}) + testcode.append(c_size_test % {'sz' : 'SIZEOF_PY_LONG_LONG', + 'type' : 'PY_LONG_LONG'}) + + + testcode.append(r''' +#else + fprintf(fp, "/* PY_LONG_LONG not defined */\n"); +#endif +#ifndef CHAR_BIT + { + unsigned char var = 2; + int i=0; + while (var >= 2) { + var = var << 1; + i++; + } + fprintf(fp,"#define CHAR_BIT %d\n", i+1); + } +#else + fprintf(fp, "/* #define CHAR_BIT %d */\n", CHAR_BIT); +#endif + fclose(fp); + return 0; +} +''') + testcode = '\n'.join(testcode) + return testcode + +if __name__=='__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) + Added: branches/numpy.scons/numpy/distutils/setupscons.py =================================================================== --- branches/numpy.scons/numpy/distutils/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/distutils/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('distutils',parent_package,top_path) + config.add_subpackage('command') + config.add_subpackage('scons') + config.add_subpackage('fcompiler') + config.add_data_dir('tests') + config.add_data_files('site.cfg') + config.make_config_py() + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Added: branches/numpy.scons/numpy/f2py/setupscons.py =================================================================== --- branches/numpy.scons/numpy/f2py/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/f2py/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,130 @@ +#!/usr/bin/env python +""" +setup.py for installing F2PY + +Usage: + python setup.py install + +Copyright 2001-2005 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Revision: 1.32 $ +$Date: 2005/01/30 17:22:14 $ +Pearu Peterson +""" + +__version__ = "$Id: setup.py,v 1.32 2005/01/30 17:22:14 pearu Exp $" + +import os +import sys +from distutils.dep_util import newer +from numpy.distutils import log +from numpy.distutils.core import setup +from numpy.distutils.misc_util import Configuration + +from __version__ import version + +def configuration(parent_package='',top_path=None): + config = Configuration('f2py', parent_package, top_path) + + config.add_subpackage('lib') + + config.add_data_dir('docs') + + config.add_data_files('src/fortranobject.c', + 'src/fortranobject.h', + 'f2py.1' + ) + + config.make_svn_version_py() + + def generate_f2py_py(build_dir): + f2py_exe = 'f2py'+os.path.basename(sys.executable)[6:] + if f2py_exe[-4:]=='.exe': + f2py_exe = f2py_exe[:-4] + '.py' + if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py': + f2py_exe = f2py_exe + '.py' + target = os.path.join(build_dir,f2py_exe) + if newer(__file__,target): + log.info('Creating %s', target) + f = open(target,'w') + f.write('''\ +#!/usr/bin/env %s +# See http://cens.ioc.ee/projects/f2py2e/ +import os, sys +for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]: + try: + i=sys.argv.index("--"+mode) + del sys.argv[i] + break + except ValueError: pass +os.environ["NO_SCIPY_IMPORT"]="f2py" +if mode=="g3-numpy": + try: + from main import main + except ImportError: + from numpy.f2py.lib.api import main +elif mode=="2e-numeric": + from f2py2e import main +elif mode=="2e-numarray": + sys.argv.append("-DNUMARRAY") + from f2py2e import main +elif mode=="2e-numpy": + from numpy.f2py import main +else: + print >> sys.stderr, "Unknown mode:",`mode` + sys.exit(1) +main() +'''%(os.path.basename(sys.executable))) + f.close() + return target + + config.add_scripts(generate_f2py_py) + + log.info('F2PY Version %s', config.get_version()) + + return config + +if __name__ == "__main__": + + config = configuration(top_path='') + version = config.get_version() + print 'F2PY Version',version + config = config.todict() + + if sys.version[:3]>='2.3': + config['download_url'] = "http://cens.ioc.ee/projects/f2py2e/2.x"\ + "/F2PY-2-latest.tar.gz" + config['classifiers'] = [ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: NumPy License', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Programming Language :: C', + 'Programming Language :: Fortran', + 'Programming Language :: Python', + 'Topic :: Scientific/Engineering', + 'Topic :: Software Development :: Code Generators', + ] + setup(version=version, + description = "F2PY - Fortran to Python Interface Generaton", + author = "Pearu Peterson", + author_email = "pearu at cens.ioc.ee", + maintainer = "Pearu Peterson", + maintainer_email = "pearu at cens.ioc.ee", + license = "BSD", + platforms = "Unix, Windows (mingw|cygwin), Mac OSX", + long_description = """\ +The Fortran to Python Interface Generator, or F2PY for short, is a +command line tool (f2py) for generating Python C/API modules for +wrapping Fortran 77/90/95 subroutines, accessing common blocks from +Python, and calling Python functions from Fortran (call-backs). +Interfacing subroutines/data from Fortran 90/95 modules is supported.""", + url = "http://cens.ioc.ee/projects/f2py2e/", + keywords = ['Fortran','f2py'], + **config) Property changes on: branches/numpy.scons/numpy/f2py/setupscons.py ___________________________________________________________________ Name: svn:executable + * Added: branches/numpy.scons/numpy/fft/setupscons.py =================================================================== --- branches/numpy.scons/numpy/fft/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/fft/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,19 @@ + + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('fft',parent_package,top_path) + + config.add_data_dir('tests') + + # Configure fftpack_lite + config.add_extension('fftpack_lite', + sources=['fftpack_litemodule.c', 'fftpack.c'] + ) + + + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Added: branches/numpy.scons/numpy/lib/setupscons.py =================================================================== --- branches/numpy.scons/numpy/lib/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/lib/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,21 @@ +from os.path import join + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + + config = Configuration('lib',parent_package,top_path) + + config.add_include_dirs(join('..','core','include')) + + + config.add_extension('_compiled_base', + sources=[join('src','_compiled_base.c')] + ) + + config.add_data_dir('tests') + + return config + +if __name__=='__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Added: branches/numpy.scons/numpy/linalg/setupscons.py =================================================================== --- branches/numpy.scons/numpy/linalg/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/linalg/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,31 @@ + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + from numpy.distutils.system_info import get_info + config = Configuration('linalg',parent_package,top_path) + + config.add_data_dir('tests') + + # Configure lapack_lite + lapack_info = get_info('lapack_opt',0) + def get_lapack_lite_sources(ext, build_dir): + if not lapack_info: + print "### Warning: Using unoptimized lapack ###" + return ext.depends[:-1] + else: + return ext.depends[:1] + + config.add_extension('lapack_lite', + sources = [get_lapack_lite_sources], + depends= ['lapack_litemodule.c', + 'zlapack_lite.c', 'dlapack_lite.c', + 'blas_lite.c', 'dlamch.c', + 'f2c_lite.c','f2c.h'], + extra_info = lapack_info + ) + + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Added: branches/numpy.scons/numpy/numarray/setupscons.py =================================================================== --- branches/numpy.scons/numpy/numarray/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/numarray/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,17 @@ +from os.path import join + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('numarray',parent_package,top_path) + + config.add_data_files('numpy/') + + config.add_extension('_capi', + sources=['_capi.c'], + ) + + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Added: branches/numpy.scons/numpy/oldnumeric/setupscons.py =================================================================== --- branches/numpy.scons/numpy/oldnumeric/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/oldnumeric/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,8 @@ + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + return Configuration('oldnumeric',parent_package,top_path) + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Added: branches/numpy.scons/numpy/random/setupscons.py =================================================================== --- branches/numpy.scons/numpy/random/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/random/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,53 @@ +from os.path import join, split + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration, get_mathlibs + config = Configuration('random',parent_package,top_path) + + def generate_libraries(ext, build_dir): + config_cmd = config.get_config_cmd() + if top_path is None: + libs = get_mathlibs() + else: + path = join(split(build_dir)[0],'core') + libs = get_mathlibs(path) + tc = testcode_wincrypt() + if config_cmd.try_run(tc): + libs.append('Advapi32') + ext.libraries.extend(libs) + return None + + libs = [] + # Configure mtrand + config.add_extension('mtrand', + sources=[join('mtrand', x) for x in + ['mtrand.c', 'randomkit.c', 'initarray.c', + 'distributions.c']]+[generate_libraries], + libraries=libs, + depends = [join('mtrand','*.h'), + join('mtrand','*.pyx'), + join('mtrand','*.pxi'), + ] + ) + + config.add_data_files(('.', join('mtrand', 'randomkit.h'))) + config.add_data_dir('tests') + + return config + +def testcode_wincrypt(): + return """\ +/* check to see if _WIN32 is defined */ +int main(int argc, char *argv[]) +{ +#ifdef _WIN32 + return 0; +#else + return 1; +#endif +} +""" + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Added: branches/numpy.scons/numpy/scons_fake/setupscons.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/scons_fake/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,15 @@ +import os +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('scons_fake',parent_package,top_path) + + config.add_subpackage('pyext') + config.add_subpackage('ctypesext') + config.add_subpackage('checklib') + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Added: branches/numpy.scons/numpy/setupscons.py =================================================================== --- branches/numpy.scons/numpy/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('numpy',parent_package,top_path, setup_name = 'setupscons.py') + config.add_subpackage('distutils') + config.add_subpackage('scons_fake') + config.add_subpackage('testing') + config.add_subpackage('f2py') + config.add_subpackage('core') + config.add_subpackage('lib') + config.add_subpackage('oldnumeric') + config.add_subpackage('numarray') + config.add_subpackage('fft') + config.add_subpackage('linalg') + config.add_subpackage('random') + config.add_data_dir('doc') + config.add_data_dir('tests') + config.make_config_py() # installs __config__.py + return config + +if __name__ == '__main__': + print 'This is the wrong setup.py file to run' Added: branches/numpy.scons/numpy/testing/setupscons.py =================================================================== --- branches/numpy.scons/numpy/testing/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/numpy/testing/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('testing',parent_package,top_path) + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(maintainer = "NumPy Developers", + maintainer_email = "numpy-dev at numpy.org", + description = "NumPy test module", + url = "http://www.numpy.org", + license = "NumPy License (BSD Style)", + configuration = configuration, + ) Property changes on: branches/numpy.scons/numpy/testing/setupscons.py ___________________________________________________________________ Name: svn:executable + * Added: branches/numpy.scons/setupscons.py =================================================================== --- branches/numpy.scons/setupscons.py 2007-10-12 10:40:32 UTC (rev 4179) +++ branches/numpy.scons/setupscons.py 2007-10-12 10:41:08 UTC (rev 4180) @@ -0,0 +1,90 @@ +#!/usr/bin/env python +"""NumPy: array processing for numbers, strings, records, and objects. + +NumPy is a general-purpose array-processing package designed to +efficiently manipulate large multi-dimensional arrays of arbitrary +records without sacrificing too much speed for small multi-dimensional +arrays. NumPy is built on the Numeric code base and adds features +introduced by numarray as well as an extended C-API and the ability to +create arrays of arbitrary type which also makes NumPy suitable for +interfacing with general-purpose data-base applications. + +There are also basic facilities for discrete fourier transform, +basic linear algebra and random number generation. +""" + +DOCLINES = __doc__.split("\n") + +import os +import sys + +CLASSIFIERS = """\ +Development Status :: 4 - Beta +Intended Audience :: Science/Research +Intended Audience :: Developers +License :: OSI Approved +Programming Language :: C +Programming Language :: Python +Topic :: Software Development +Topic :: Scientific/Engineering +Operating System :: Microsoft :: Windows +Operating System :: POSIX +Operating System :: Unix +Operating System :: MacOS +""" + +# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly +# update it when the contents of directories change. +if os.path.exists('MANIFEST'): os.remove('MANIFEST') + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + + config = Configuration(None, parent_package, top_path, setup_name = 'setupscons.py') + config.set_options(ignore_setup_xxx_py=True, + assume_default_configuration=True, + delegate_options_to_subpackages=True, + quiet=True) + + config.add_subpackage('numpy') + + config.add_data_files(('numpy','*.txt'), + ('numpy','COMPATIBILITY'), + ('numpy','scipy_compatibility'), + ('numpy','site.cfg.example')) + + config.get_version('numpy/version.py') # sets config.version + + return config + +def setup_package(): + + from numpy.distutils.core import setup + + old_path = os.getcwd() + local_path = os.path.dirname(os.path.abspath(sys.argv[0])) + os.chdir(local_path) + sys.path.insert(0,local_path) + + try: + setup( + name = 'numpy', + maintainer = "NumPy Developers", + maintainer_email = "numpy-discussion at lists.sourceforge.net", + description = DOCLINES[0], + long_description = "\n".join(DOCLINES[2:]), + url = "http://numeric.scipy.org", + download_url = "http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103", + license = 'BSD', + classifiers=filter(None, CLASSIFIERS.split('\n')), + author = "Travis E. Oliphant, et.al.", + author_email = "oliphant at ee.byu.edu", + platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], + configuration=configuration ) + finally: + del sys.path[0] + os.chdir(old_path) + return + +if __name__ == '__main__': + setup_package() Property changes on: branches/numpy.scons/setupscons.py ___________________________________________________________________ Name: svn:executable + * From numpy-svn at scipy.org Fri Oct 12 06:42:50 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 12 Oct 2007 05:42:50 -0500 (CDT) Subject: [Numpy-svn] r4181 - in branches/numpy.scons: . numpy/distutils/command numpy/distutils/scons numpy/scons_fake/checklib Message-ID: <20071012104250.8C0BA39C01A@new.scipy.org> Author: cdavid Date: 2007-10-12 05:42:27 -0500 (Fri, 12 Oct 2007) New Revision: 4181 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py branches/numpy.scons/numpy/distutils/scons/utils.py branches/numpy.scons/numpy/scons_fake/checklib/SConstruct Log: Merge back from main numpy.scons branch Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-12 16:34:26.244999886 +0900 committer: David Cournapeau properties: branch-nick: numpy.sconsified + timestamp: 2007-10-12 16:41:03.905999899 +0900 committer: David Cournapeau properties: branch-nick: numpy.sconsified Name: bzr:ancestry:v3-trunk0 - svn-v3-trunk0:94b884b6-d6fd-0310-90d3-974f1d3f35e1:branches%2Fnumpy.scons:4112 + svn-v3-trunk0:94b884b6-d6fd-0310-90d3-974f1d3f35e1:branches%2Fnumpy.scons:4112 david at ar.media.kyoto-u.ac.jp-20071012063527-x9tlkbs04vw0iyxg Name: bzr:file-ids - setupscons.py setupscons.py-20071012073152-5cjw0f21wjrronpp-1 numpy/setupscons.py setupscons.py-20071012073156-2q41hv4160unzvgu-1 numpy/distutils/setupscons.py setupscons.py-20071012073225-2siuy69nudxygxhf-1 numpy/random/setupscons.py setupscons.py-20071012073345-rdz48sxmx4l5z104-1 numpy/scons_fake/setupscons.py setupscons.py-20071012073348-qsdmbjgvmo8v4vfa-1 numpy/lib/setupscons.py setupscons.py-20071012073400-jj4s0c8bf3tdyk8u-1 numpy/numarray/setupscons.py setupscons.py-20071012073332-ozzndtqjcck51weo-1 numpy/f2py/setupscons.py setupscons.py-20071012073214-nfy7furt0j408jxj-1 numpy/core/setupscons.py setupscons.py-20071012073209-yf3ikofbaleurqt0-1 numpy/fft/setupscons.py setupscons.py-20071012073214-nfy7furt0j408jxj-2 numpy/linalg/setupscons.py setupscons.py-20071012073400-jj4s0c8bf3tdyk8u-2 numpy/oldnumeric/setupscons.py setupscons.py-20071012073341-cyophs8ex8ot7u1c-1 numpy/testing/setupscons.py setupscons.py-20071012073353-ti1uodrc1u4hzipy-1 + Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-12 10:41:08 UTC (rev 4180) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-12 10:42:27 UTC (rev 4181) @@ -128,7 +128,6 @@ # XXX: This is inefficient... (use join instead) cmd = scons_exec + " -Q -f " + i + ' -I. ' cmd += ' src_dir="%s" ' % pdirname(i) - #cmd += ' pkg_name="%s" ' % pdirname(i) cmd += ' distutils_libdir=%s ' % protect_path(pjoin(self.build_lib, pdirname(i))) cmd += ' cc_opt=%s ' % dist2sconscc(self.compiler) Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-12 10:41:08 UTC (rev 4180) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-12 10:42:27 UTC (rev 4181) @@ -1,6 +1,6 @@ # Last Changed: . import os.path -from os.path import join as pjoin +from os.path import join as pjoin, dirname as pdirname import sys from distutils.sysconfig import get_config_vars @@ -118,6 +118,24 @@ t = Tool(FindTool(DEF_C_COMPILERS)) t(env) + # XXX: Really, we should use our own subclass of Environment, instead of + # adding Numpy* functions ! + + # Put config code in separate dir for each subpackage + from utils import curry + NumpyConfigure = curry(env.Configure, conf_dir = pjoin(env['build_dir'], '.sconf')) + env.NumpyConfigure = NumpyConfigure + # XXX: Huge, ungly hack ! SConsign needs an absolute path or a path + # relative to where the SConstruct file is. We have to find the path of + # the build dir relative to the src_dir: we add n .., where n is the number + # of occureant of the path separator in the src dir. + def get_build_relative_src(srcdir, builddir): + n = srcdir.count(os.sep) + 1 + return pjoin(os.sep.join([r'..' for i in range(n)]), builddir) + env.SConsignFile(pjoin(get_build_relative_src(env['src_dir'], + env['build_dir']), + '.sconsign.dblite')) + # ======================================================================== # Adding default tools for the one we do not customize: mingw is special # according to scons, don't ask me why, but this does not work as expected Modified: branches/numpy.scons/numpy/distutils/scons/utils.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-12 10:41:08 UTC (rev 4180) +++ branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-12 10:42:27 UTC (rev 4181) @@ -42,3 +42,17 @@ except KeyError, e: return [] +class curry: + def __init__(self, fun, *args, **kwargs): + self.fun = fun + self.pending = args[:] + self.kwargs = kwargs.copy() + + def __call__(self, *args, **kwargs): + if kwargs and self.kwargs: + kw = self.kwargs.copy() + kw.update(kwargs) + else: + kw = kwargs or self.kwargs + + return self.fun(*(self.pending + args), **kw) Modified: branches/numpy.scons/numpy/scons_fake/checklib/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checklib/SConstruct 2007-10-12 10:41:08 UTC (rev 4180) +++ branches/numpy.scons/numpy/scons_fake/checklib/SConstruct 2007-10-12 10:42:27 UTC (rev 4181) @@ -3,7 +3,7 @@ env = GetNumpyEnvironment(ARGUMENTS) -config = env.Configure(custom_tests = {'NumpyCheckLib' : NumpyCheckLib}) +config = env.NumpyConfigure(custom_tests = {'NumpyCheckLib' : NumpyCheckLib}) if not config.NumpyCheckLib('sndfile', 'sf_open', section = 'sndfile'): print "sndfile not found, this package cannot work without sndfile !" config.Finish() From numpy-svn at scipy.org Fri Oct 12 06:43:16 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 12 Oct 2007 05:43:16 -0500 (CDT) Subject: [Numpy-svn] r4182 - in branches/numpy.scons: . numpy/core Message-ID: <20071012104316.AFC4639C01A@new.scipy.org> Author: cdavid Date: 2007-10-12 05:42:58 -0500 (Fri, 12 Oct 2007) New Revision: 4182 Added: branches/numpy.scons/numpy/core/SConstruct Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/setupscons.py Log: Start sconsification of numpy.core Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-12 16:41:03.905999899 +0900 committer: David Cournapeau properties: branch-nick: numpy.sconsified + timestamp: 2007-10-12 16:41:29.038000107 +0900 committer: David Cournapeau properties: branch-nick: numpy.sconsified Name: bzr:file-ids - + numpy/core/SConstruct sconstruct-20071012074119-tfws44wpr0tjlltp-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y Added: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-12 10:42:27 UTC (rev 4181) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-12 10:42:58 UTC (rev 4182) @@ -0,0 +1,11 @@ +# vim:syntax=python +from numpy.distutils.scons import GetNumpyEnvironment + +# Function to check: +mfuncs = ['expl', 'expf', 'log1p', 'expm1', 'asinh', 'atanhf', 'atanhl', + 'isnan', 'isinf', 'rint'] +env = GetNumpyEnvironment(ARGUMENTS) +config = env.NumpyConfigure(config_h = 'sconfig.h') +for i in mfuncs: + config.CheckFunc(i) +config.Finish() Modified: branches/numpy.scons/numpy/core/setupscons.py =================================================================== --- branches/numpy.scons/numpy/core/setupscons.py 2007-10-12 10:42:27 UTC (rev 4181) +++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-12 10:42:58 UTC (rev 4182) @@ -33,6 +33,7 @@ ('.py','U',1)) header_dir = 'include/numpy' # this is relative to config.path_in_package + config.add_sconscript('SConstruct') def generate_config_h(ext, build_dir): target = join(build_dir,'config.h') From numpy-svn at scipy.org Fri Oct 12 06:44:17 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 12 Oct 2007 05:44:17 -0500 (CDT) Subject: [Numpy-svn] r4183 - in branches/numpy.scons: . numpy/core numpy/distutils/command Message-ID: <20071012104417.771FE39C01A@new.scipy.org> Author: cdavid Date: 2007-10-12 05:43:38 -0500 (Fri, 12 Oct 2007) New Revision: 4183 Modified: branches/numpy.scons/ branches/numpy.scons/.bzrignore branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/command/scons.py Log: Starting testing configuration for numpy.core Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-12 16:41:29.038000107 +0900 committer: David Cournapeau properties: branch-nick: numpy.sconsified + timestamp: 2007-10-12 19:07:15.543999910 +0900 committer: David Cournapeau properties: branch-nick: numpy.sconsified Name: bzr:file-ids - numpy/core/SConstruct sconstruct-20071012074119-tfws44wpr0tjlltp-1 + Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m Modified: branches/numpy.scons/.bzrignore =================================================================== --- branches/numpy.scons/.bzrignore 2007-10-12 10:42:58 UTC (rev 4182) +++ branches/numpy.scons/.bzrignore 2007-10-12 10:43:38 UTC (rev 4183) @@ -1,5 +1,2 @@ -.sconf_temp -.sconsign.dblite build -config.log numpy/distutils/scons-local/scons-local-0.97.0d20070918.tar.gz Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-12 10:42:58 UTC (rev 4182) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-12 10:43:38 UTC (rev 4183) @@ -1,11 +1,54 @@ +# Last Change: Fri Oct 12 07:00 PM 2007 J # vim:syntax=python +import os from numpy.distutils.scons import GetNumpyEnvironment +env = GetNumpyEnvironment(ARGUMENTS) +config = env.NumpyConfigure() + +#-------------------------------- +# Checking SMP and thread options +#-------------------------------- +# TODO + +#---------------------- +# Checking signal stuff +#---------------------- +# TODO + +#------------------------------------------ +# Checking the mathlib and its capabilities +#------------------------------------------ # Function to check: -mfuncs = ['expl', 'expf', 'log1p', 'expm1', 'asinh', 'atanhf', 'atanhl', - 'isnan', 'isinf', 'rint'] -env = GetNumpyEnvironment(ARGUMENTS) -config = env.NumpyConfigure(config_h = 'sconfig.h') -for i in mfuncs: - config.CheckFunc(i) +mfuncs = [('expl', 'HAVE_LONGDOUBLE_FUNCS'), + ('expf', 'HAVE_FLOAT_FUNCS'), + ('log1p', 'HAVE_LOG1P'), + ('expm1', 'HAVE_EXPM1'), + ('asinh', 'HAVE_INVERSE_HYPERBOLIC'), + ('atanhf', 'HAVE_INVERSE_HYPERBOLIC_FLOAT'), + ('atanhl', 'HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE'), + ('isnan', 'HAVE_ISNAN'), + ('isinf', 'HAVE_ISINF'), + ('rint', 'HAVE_RINT'), + ] + +# TODO: getting the math lib automatically ? Having a list ? +mathlib = os.environ.get('MATHLIB') +if mathlib: + # XXX: prepend it ? + mlib = mathlib +else: + mlib = 'm' +for f in mfuncs: + st = config.CheckLib(mlib, f[0]) + if st: + env.Append(CPPDEFINES = {f[1]: 1}) + +#-------------- +# Checking Blas +#-------------- +# TODO + config.Finish() + +#print env.Dump('CPPDEFINES') Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-12 10:42:58 UTC (rev 4182) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-12 10:43:38 UTC (rev 4183) @@ -126,7 +126,7 @@ scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py')) for i in self.scons_scripts: # XXX: This is inefficient... (use join instead) - cmd = scons_exec + " -Q -f " + i + ' -I. ' + cmd = scons_exec + " -f " + i + ' -I. ' cmd += ' src_dir="%s" ' % pdirname(i) cmd += ' distutils_libdir=%s ' % protect_path(pjoin(self.build_lib, pdirname(i))) From numpy-svn at scipy.org Sat Oct 13 00:41:48 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 12 Oct 2007 23:41:48 -0500 (CDT) Subject: [Numpy-svn] r4184 - in branches/numpy.scons: . numpy/distutils/scons Message-ID: <20071013044148.42DF639C02E@new.scipy.org> Author: cdavid Date: 2007-10-12 23:41:10 -0500 (Fri, 12 Oct 2007) New Revision: 4184 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/scons/extension_scons.py Log: Typo in CPPPATH Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-12 19:07:15.543999910 +0900 committer: David Cournapeau properties: branch-nick: numpy.sconsified + timestamp: 2007-10-13 13:38:39.881999969 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe Modified: branches/numpy.scons/numpy/distutils/scons/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-12 10:43:38 UTC (rev 4183) +++ branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-13 04:41:10 UTC (rev 4184) @@ -19,7 +19,7 @@ else: LINKFLAGS = [] - if env.has_key('CPPPPATH'): + if env.has_key('CPPPATH'): CPPPATH = deepcopy(env['CPPPATH']) else: CPPPATH = [] From numpy-svn at scipy.org Sun Oct 14 12:13:22 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 14 Oct 2007 11:13:22 -0500 (CDT) Subject: [Numpy-svn] r4185 - in branches/numpy.scons: . numpy/core Message-ID: <20071014161322.6E51A39C073@new.scipy.org> Author: cdavid Date: 2007-10-14 11:13:08 -0500 (Sun, 14 Oct 2007) New Revision: 4185 Added: branches/numpy.scons/numpy/core/scons_support.py Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct Log: more work on building numpy.core (but multiarray still does not build) Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-13 13:38:39.881999969 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-13 21:33:19.999000072 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:file-ids - + numpy/core/scons_support.py scons_support.py-20071013123248-qlvhssvnl3nuey6c-1 numpy/core/code_generators/__init__.py __init__.py-20071013094357-a11hri01e04cjkey-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-13 04:41:10 UTC (rev 4184) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:13:08 UTC (rev 4185) @@ -1,16 +1,45 @@ # Last Change: Fri Oct 12 07:00 PM 2007 J # vim:syntax=python import os +from os.path import join as pjoin +import sys + from numpy.distutils.scons import GetNumpyEnvironment env = GetNumpyEnvironment(ARGUMENTS) -config = env.NumpyConfigure() #-------------------------------- # Checking SMP and thread options #-------------------------------- -# TODO +# Python 2.3 causes a segfault when +# trying to re-acquire the thread-state +# which is done in error-handling +# ufunc code. NPY_ALLOW_C_API and friends +# cause the segfault. So, we disable threading +# for now. +if sys.version[:5] < '2.4.2': + nosmp = 1 +else: + # Perhaps a fancier check is in order here. + # so that threads are only enabled if there + # are actually multiple CPUS? -- but + # threaded code can be nice even on a single + # CPU so that long-calculating code doesn't + # block. + try: + nosmp = os.environ['NPY_NOSMP'] + nosmp = 1 + except KeyError: + nosmp = 0 +config = env.NumpyConfigure() + +# TODO: check python extension can be built (in root or here ?) + +#-------------------------------- +# Checking configuration +#-------------------------------- + #---------------------- # Checking signal stuff #---------------------- @@ -51,4 +80,26 @@ config.Finish() -#print env.Dump('CPPDEFINES') +#-------------------------- +# Generating multiarray API +#-------------------------- +# TODO: +from scons_support import do_generate_api, generate_api_emitter + +bld = Builder(action = do_generate_api, emitter = generate_api_emitter) +env.Append(BUILDERS = {'GenerateApi' : bld}) +from os.path import join as pjoin +multiarray_api = env.GenerateApi(pjoin(env['build_dir'], '__multiarray_api'), + [pjoin(env['src_dir'], 'code_generators', 'array_api_order.txt'), + pjoin(env['src_dir'], 'code_generators', 'multiarray_api_order.txt')]) + +config_header = env.Command(pjoin(env['build_dir'], 'config.h'), + pjoin(env['src_dir'], 'config.h.in'), 'cp $SOURCE $TARGET') +# Build multiarray +env.Append(CPPPATH = [pjoin(env['src_dir'], 'include'), env['build_dir']]) +multiarray_src = [ + pjoin('src','scalartypes.inc.src'), + pjoin('src','arraytypes.inc.src'), + pjoin('src', 'multiarraymodule.c'), +] +#multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src) Added: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-10-13 04:41:10 UTC (rev 4184) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-14 16:13:08 UTC (rev 4185) @@ -0,0 +1,97 @@ +from code_generators.generate_array_api import types, h_template, c_template +import code_generators.genapi as genapi + +import SCons.Errors + +def do_generate_api(target, source, env): + """source has to be a sequence of OBJECT, MULTIARRAY txt files.""" + h_file = str(target[0]) + c_file = str(target[1]) + t_file = str(target[2]) + + if not len(source) == 2: + # XXX + assert 0 == 1 + OBJECT_API_ORDER = str(source[0]) + MULTIARRAY_API_ORDER = str(source[1]) + objectapi_list = genapi.get_api_functions('OBJECT_API', + OBJECT_API_ORDER) + multiapi_list = genapi.get_api_functions('MULTIARRAY_API', + MULTIARRAY_API_ORDER) + # API fixes for __arrayobject_api.h + + fixed = 10 + numtypes = len(types) + fixed + numobject = len(objectapi_list) + numtypes + nummulti = len(multiapi_list) + numtotal = numobject + nummulti + + module_list = [] + extension_list = [] + init_list = [] + + # setup types + for k, atype in enumerate(types): + num = fixed + k + astr = " (void *) &Py%sArrType_Type," % types[k] + init_list.append(astr) + astr = "static PyTypeObject Py%sArrType_Type;" % types[k] + module_list.append(astr) + astr = "#define Py%sArrType_Type (*(PyTypeObject *)PyArray_API[%d])" % \ + (types[k], num) + extension_list.append(astr) + + # set up object API + genapi.add_api_list(numtypes, 'PyArray_API', objectapi_list, + module_list, extension_list, init_list) + + # set up multiarray module API + genapi.add_api_list(numobject, 'PyArray_API', multiapi_list, + module_list, extension_list, init_list) + + + # Write to header + fid = open(h_file, 'w') + s = h_template % ('\n'.join(module_list), '\n'.join(extension_list)) + fid.write(s) + fid.close() + + # Write to c-code + fid = open(c_file, 'w') + s = c_template % '\n'.join(init_list) + fid.write(s) + fid.close() + + # write to documentation + fid = open(t_file, 'w') + fid.write(''' +=========== +Numpy C-API +=========== + +Object API +========== +''') + for func in objectapi_list: + fid.write(func.to_ReST()) + fid.write('\n\n') + fid.write(''' + +Multiarray API +============== +''') + for func in multiapi_list: + fid.write(func.to_ReST()) + fid.write('\n\n') + fid.close() + + return 0 + +def generate_api_emitter(target, source, env): + """Returns the list of targets generated by the code generator for array api.""" + base, ext = SCons.Util.splitext(str(target[0])) + h = base + '.h' + c = base + '.c' + txt = base + '.txt' + t = [h, c, txt] + return (t, source) From numpy-svn at scipy.org Sun Oct 14 12:13:41 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 14 Oct 2007 11:13:41 -0500 (CDT) Subject: [Numpy-svn] r4186 - in branches/numpy.scons: . numpy/core Message-ID: <20071014161341.9D88B39C073@new.scipy.org> Author: cdavid Date: 2007-10-14 11:13:31 -0500 (Sun, 14 Oct 2007) New Revision: 4186 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct Log: More work to generate config header from scons Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-13 21:33:19.999000072 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-14 15:31:48.167000055 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:file-ids - numpy/core/scons_support.py scons_support.py-20071013123248-qlvhssvnl3nuey6c-1 numpy/core/code_generators/__init__.py __init__.py-20071013094357-a11hri01e04cjkey-1 + Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:13:08 UTC (rev 4185) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:13:31 UTC (rev 4186) @@ -6,6 +6,33 @@ from numpy.distutils.scons import GetNumpyEnvironment +import SCons.Util + +def generate_config_header(target, source, env): + t = open(str(target[0]), 'w') + if not env.has_key('config_h_gen'): + # XXX + assert 0 == 1 + sym = env['config_h_gen'] + def write_symbol(define, value): + if value == 1: + return "#define %s\n\n" % define + elif value == 0: + return "#under %s\n\n" % define + elif SCons.Util.is_String(value): + return "#define %s %s\n\n" % (define, value) + t.writelines([write_symbol(i[0], i[1]) for i in sym]) + t.write('\n') + t.close() + + return 0 + +# Convention: list of tuples (definition, value). value: +# - 0: #undef definition +# - 1: #define definition +# - string: #define definition value +config_sym = [] + env = GetNumpyEnvironment(ARGUMENTS) #-------------------------------- @@ -31,14 +58,24 @@ nosmp = 1 except KeyError: nosmp = 0 +if nosmp: + config_sym.append(('NPY_ALLOW_THREADS', '0')) +else: + config_sym.append(('NPY_ALLOW_THREADS', '1')) config = env.NumpyConfigure() # TODO: check python extension can be built (in root or here ?) -#-------------------------------- +#--------------- +# Checking Types +#--------------- +st = config.CheckType('short') +print st + +#----------------------- # Checking configuration -#-------------------------------- +#----------------------- #---------------------- # Checking signal stuff @@ -68,10 +105,13 @@ mlib = mathlib else: mlib = 'm' +config_sym.append(('MATHLIB', str(mlib))) for f in mfuncs: st = config.CheckLib(mlib, f[0]) if st: - env.Append(CPPDEFINES = {f[1]: 1}) + config_sym.append((f[1], 1)) + else: + config_sym.append((f[1], 0)) #-------------- # Checking Blas @@ -83,9 +123,9 @@ #-------------------------- # Generating multiarray API #-------------------------- -# TODO: from scons_support import do_generate_api, generate_api_emitter +# XXX: put the builder in scons support lib. bld = Builder(action = do_generate_api, emitter = generate_api_emitter) env.Append(BUILDERS = {'GenerateApi' : bld}) from os.path import join as pjoin @@ -93,13 +133,41 @@ [pjoin(env['src_dir'], 'code_generators', 'array_api_order.txt'), pjoin(env['src_dir'], 'code_generators', 'multiarray_api_order.txt')]) -config_header = env.Command(pjoin(env['build_dir'], 'config.h'), - pjoin(env['src_dir'], 'config.h.in'), 'cp $SOURCE $TARGET') +# Take into account the change in config_sym (using emitter, see SubstDic +# example in scons wiki) ? +env['config_h_gen'] = config_sym +bld = Builder(action = generate_config_header) +env.Append(BUILDERS = {'GenerateConfigHeader' : bld}) +config_header = env.GenerateConfigHeader(pjoin(env['build_dir'], 'config.h'), []) + +# Builder to generate .inc from .inc.src +from numpy.distutils.from_template import process_file +def do_generate_from_template(targetfile, sourcefile, env): + t = open(targetfile, 'w') + string = process_file(sourcefile) + t.close() + return 0 + +def generate_from_template(target, source, env): + for t, s in zip(target, source): + do_generate_from_template(str(t), str(s), env) + +def generate_from_template_emitter(target, source, env): + base, ext = SCons.Util.splitext(str(target[0])) + t = base + '.inc' + return ([t], source) + +bld = Builder(action = generate_from_template, emitter = generate_from_template_emitter) +env.Append(BUILDERS = {'FromTemplate' : bld}) + +scalartypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'scalartypes'), + pjoin(env['src_dir'], 'src', 'scalartypes.inc.src')) +arraytypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'arraytypes'), + pjoin(env['src_dir'], 'src', 'arraytypes.inc.src')) + # Build multiarray env.Append(CPPPATH = [pjoin(env['src_dir'], 'include'), env['build_dir']]) multiarray_src = [ - pjoin('src','scalartypes.inc.src'), - pjoin('src','arraytypes.inc.src'), pjoin('src', 'multiarraymodule.c'), ] #multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src) From numpy-svn at scipy.org Sun Oct 14 12:14:02 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 14 Oct 2007 11:14:02 -0500 (CDT) Subject: [Numpy-svn] r4187 - in branches/numpy.scons: . numpy/distutils/scons Message-ID: <20071014161402.0FB2D39C073@new.scipy.org> Author: cdavid Date: 2007-10-14 11:13:50 -0500 (Sun, 14 Oct 2007) New Revision: 4187 Added: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/scons/__init__.py Log: Implement a checker to get size of C types Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-14 15:31:48.167000055 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-14 15:48:41.150000095 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:file-ids - + numpy/distutils/scons/custom_checkers.py custom_checkers.py-20071014064812-5qdihherenglm7pv-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-14 16:13:31 UTC (rev 4186) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-14 16:13:50 UTC (rev 4187) @@ -1,2 +1,4 @@ from numpyenv import GetNumpyEnvironment, GetNumpyOptions from libinfo_scons import NumpyCheckLib +from custom_checkers import CheckSizeof +from extension import get_python_inc Added: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-14 16:13:31 UTC (rev 4186) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-14 16:13:50 UTC (rev 4187) @@ -0,0 +1,59 @@ +# size to try first for built-in types +_PREF_SIZE = { + 'short' : (2,), + 'int' : (4,), + 'long' : (4,8), + 'long long' : (8,4), + 'float' : (4,), + 'double' : (8,), + 'long double' : (12,), + 'size_t' : (4,), + 'Py_intptr_t' : (4,), +} + +def CheckSizeof(context, type, include = None, language = None): + """include should be a list of header.""" + if language: + raise NotImplementedError("language arg not supported yet!") + + msg = context.Message('Checking size of type %s ... ' % type) + if include: + strinc = ["#include <%s>" % s for s in include] + src = "\n".join(strinc) + else: + src = "" + src += """ +typedef %s check_sizeof; + +int main() +{ + static int test_array[1 - 2 * !( (long int) (sizeof(check_sizeof)) <= %d)]; + test_array[0] = 0; + + return 0; +} +""" + + st = 0 + # First try sensible default + if _PREF_SIZE.has_key(type): + fs = _PREF_SIZE[type] + for i in fs: + st = context.TryCompile(src % (type, i), '.c') + if st: + break + # General + maxsize = 16 + if not st: + for i in xrange(0, maxsize): + st = context.TryCompile(src % (type, i), '.c') + if st: + break + + if st: + context.Result('%d bytes' % i) + else: + context.Result('Failed !') + + return st + From numpy-svn at scipy.org Sun Oct 14 12:14:20 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 14 Oct 2007 11:14:20 -0500 (CDT) Subject: [Numpy-svn] r4188 - in branches/numpy.scons: . numpy/core Message-ID: <20071014161420.714B539C073@new.scipy.org> Author: cdavid Date: 2007-10-14 11:14:10 -0500 (Sun, 14 Oct 2007) New Revision: 4188 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct Log: Check sizeof types in scons for multiarray extension Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-14 15:48:41.150000095 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-14 15:49:00.111000061 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:file-ids - numpy/distutils/scons/custom_checkers.py custom_checkers.py-20071014064812-5qdihherenglm7pv-1 + Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:13:50 UTC (rev 4187) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:14:10 UTC (rev 4188) @@ -4,7 +4,8 @@ from os.path import join as pjoin import sys -from numpy.distutils.scons import GetNumpyEnvironment +from numpy.distutils.scons import get_python_inc +from numpy.distutils.scons import GetNumpyEnvironment, CheckSizeof import SCons.Util @@ -63,15 +64,28 @@ else: config_sym.append(('NPY_ALLOW_THREADS', '1')) -config = env.NumpyConfigure() +env.Append(CPPPATH = [get_python_inc()]) +config = env.NumpyConfigure(custom_tests = {'CheckSizeof' : CheckSizeof}) # TODO: check python extension can be built (in root or here ?) #--------------- # Checking Types #--------------- -st = config.CheckType('short') -print st +def check_type(type, include = None): + # XXX: handle space in type string + # Implement type size info in CheckSizeof + if config.CheckSizeof(type, include = include): + config_sym.append(('SIZEOF_%s' % type.upper(), 1)) + else: + config_sym.append(('SIZEOF_%s' % type.upper(), 0)) +check_type('short') +check_type('int') +check_type('long') +check_type('float') +check_type('double') +check_type('long double') +check_type('Py_intptr_t', include = ["Python.h"]) #----------------------- # Checking configuration From numpy-svn at scipy.org Sun Oct 14 12:14:47 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 14 Oct 2007 11:14:47 -0500 (CDT) Subject: [Numpy-svn] r4189 - in branches/numpy.scons: . numpy/core numpy/distutils/scons Message-ID: <20071014161447.C46BF39C073@new.scipy.org> Author: cdavid Date: 2007-10-14 11:14:28 -0500 (Sun, 14 Oct 2007) New Revision: 4189 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: * (scons) Better checker to get size of types Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-14 15:49:00.111000061 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-14 21:44:01.213000059 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:file-ids - + numpy/core/config.h.in config.h.in-20071014064907-muiokkgfs5im6243-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:14:10 UTC (rev 4188) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:14:28 UTC (rev 4189) @@ -5,7 +5,7 @@ import sys from numpy.distutils.scons import get_python_inc -from numpy.distutils.scons import GetNumpyEnvironment, CheckSizeof +from numpy.distutils.scons import GetNumpyEnvironment, CheckTypeSize import SCons.Util @@ -19,7 +19,7 @@ if value == 1: return "#define %s\n\n" % define elif value == 0: - return "#under %s\n\n" % define + return "#undef %s\n\n" % define elif SCons.Util.is_String(value): return "#define %s %s\n\n" % (define, value) t.writelines([write_symbol(i[0], i[1]) for i in sym]) @@ -65,7 +65,7 @@ config_sym.append(('NPY_ALLOW_THREADS', '1')) env.Append(CPPPATH = [get_python_inc()]) -config = env.NumpyConfigure(custom_tests = {'CheckSizeof' : CheckSizeof}) +config = env.NumpyConfigure(custom_tests = {'CheckTypeSize' : CheckTypeSize}) # TODO: check python extension can be built (in root or here ?) @@ -75,7 +75,7 @@ def check_type(type, include = None): # XXX: handle space in type string # Implement type size info in CheckSizeof - if config.CheckSizeof(type, include = include): + if config.CheckTypeSize(type, includes = include): config_sym.append(('SIZEOF_%s' % type.upper(), 1)) else: config_sym.append(('SIZEOF_%s' % type.upper(), 0)) Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-14 16:14:10 UTC (rev 4188) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-14 16:14:28 UTC (rev 4189) @@ -1,4 +1,4 @@ from numpyenv import GetNumpyEnvironment, GetNumpyOptions from libinfo_scons import NumpyCheckLib -from custom_checkers import CheckSizeof +from custom_checkers import CheckTypeSize from extension import get_python_inc Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-14 16:14:10 UTC (rev 4188) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-14 16:14:28 UTC (rev 4189) @@ -1,59 +1,102 @@ -# size to try first for built-in types -_PREF_SIZE = { - 'short' : (2,), - 'int' : (4,), - 'long' : (4,8), - 'long long' : (8,4), - 'float' : (4,), - 'double' : (8,), - 'long double' : (12,), - 'size_t' : (4,), - 'Py_intptr_t' : (4,), +# Sensible default for common types on common platforms. +_DEFAULTS = { + 'short' : [2,], + 'int' : [4, 2], + 'long' : [4, 8], + 'long long' : [8, 4], + # Normally, there is no need to check unsigned types, because they are + # guaranteed to be of the same size than their signed counterpart. + 'unsigned short' : [2,], + 'unsigned int' : [4, 2], + 'unsigned long' : [4, 8], + 'unsigned long long' : [8, 4], + 'float' : [4,], + 'double' : [8,], + 'long double' : [12,], + 'size_t' : [4,], } -def CheckSizeof(context, type, include = None, language = None): - """include should be a list of header.""" - if language: - raise NotImplementedError("language arg not supported yet!") +def CheckTypeSize(context, type, includes = None, language = 'C', size = None): + """This check can be used to get the size of a given type, or to check whether + the type is of expected size. - msg = context.Message('Checking size of type %s ... ' % type) - if include: - strinc = ["#include <%s>" % s for s in include] - src = "\n".join(strinc) - else: - src = "" - src += """ -typedef %s check_sizeof; + Arguments: + - type : str + the type to check + - includes : sequence + list of headers to include in the test code before testing the type + - language : str + 'C' or 'C++' + - size : int + if given, will test wether the type has the given number of bytes. + If not given, will test against a list of sizes (all sizes between + 0 and 16 bytes are tested). + Returns: + status : int + 0 if the check failed, or the found size of the type if + the check succeeded.""" + minsz = 0 + maxsz = 16 + + if includes: + src = "\n".join([r"#include <%s>\n" % i for i in includes]) + else: + src = "" + + if language == 'C': + ext = '.c' + elif language == 'C++': + ext = '.cpp' + else: + raise NotImplementedError("%s is not a recognized language" % language) + + # test code taken from autoconf: this is a pretty clever hack to find that + # a type is of a given size using only compilation. This speeds things up + # quite a bit compared to straightforward code using TryRun + src += r""" +typedef %s scons_check_type; + int main() { - static int test_array[1 - 2 * !( (long int) (sizeof(check_sizeof)) <= %d)]; - test_array[0] = 0; + static int test_array[1 - 2 * !(((long int) (sizeof(scons_check_type))) <= %d)]; + test_array[0] = 0; - return 0; + return 0; } """ - st = 0 - # First try sensible default - if _PREF_SIZE.has_key(type): - fs = _PREF_SIZE[type] - for i in fs: - st = context.TryCompile(src % (type, i), '.c') - if st: - break - # General - maxsize = 16 - if not st: - for i in xrange(0, maxsize): - st = context.TryCompile(src % (type, i), '.c') - if st: - break + if size: + # Only check if the given size is the right one + context.Message('Checking %s is %d bytes... ' % (type, size)) + st = context.TryCompile(src % (type, size), ext) + context.Result(st) - if st: - context.Result('%d bytes' % i) - else: - context.Result('Failed !') + if st: + return size + else: + return 0 + else: + # Check against a list of sizes. + context.Message('Checking size of %s ... ' % type) - return st + # Try sensible defaults first + try: + szrange = _DEFAULTS[type] + except KeyError: + szrange = [] + szrange.extend(xrange(minsz, maxsz)) + st = 0 + # Actual test + for sz in szrange: + st = context.TryCompile(src % (type, sz), ext) + if st: + break + + if st: + context.Result('%d' % sz) + return sz + else: + context.Result('Failed !') + return 0 From numpy-svn at scipy.org Sun Oct 14 12:15:15 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 14 Oct 2007 11:15:15 -0500 (CDT) Subject: [Numpy-svn] r4190 - in branches/numpy.scons: . numpy/core numpy/distutils/scons Message-ID: <20071014161515.7E41B39C073@new.scipy.org> Author: cdavid Date: 2007-10-14 11:14:56 -0500 (Sun, 14 Oct 2007) New Revision: 4190 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/setupscons.py branches/numpy.scons/numpy/distutils/scons/custom_builders.py branches/numpy.scons/test.sh Log: Building multiarray finally works Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-14 21:44:01.213000059 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-15 01:12:01.368000031 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:file-ids - numpy/core/config.h.in config.h.in-20071014064907-muiokkgfs5im6243-1 + Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:14:28 UTC (rev 4189) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:14:56 UTC (rev 4190) @@ -1,7 +1,7 @@ # Last Change: Fri Oct 12 07:00 PM 2007 J # vim:syntax=python import os -from os.path import join as pjoin +from os.path import join as pjoin, basename as pbasename, dirname as pdirname import sys from numpy.distutils.scons import get_python_inc @@ -73,15 +73,15 @@ # Checking Types #--------------- def check_type(type, include = None): - # XXX: handle space in type string - # Implement type size info in CheckSizeof - if config.CheckTypeSize(type, includes = include): - config_sym.append(('SIZEOF_%s' % type.upper(), 1)) + st = config.CheckTypeSize(type, includes = include) + type = type.replace(' ', '_') + if st: + config_sym.append(('SIZEOF_%s' % type.upper(), '%d' % st)) else: config_sym.append(('SIZEOF_%s' % type.upper(), 0)) check_type('short') check_type('int') -check_type('long') +#check_type('long') check_type('float') check_type('double') check_type('long double') @@ -155,10 +155,14 @@ config_header = env.GenerateConfigHeader(pjoin(env['build_dir'], 'config.h'), []) # Builder to generate .inc from .inc.src -from numpy.distutils.from_template import process_file +from numpy.distutils.conv_template import process_str def do_generate_from_template(targetfile, sourcefile, env): t = open(targetfile, 'w') - string = process_file(sourcefile) + s = open(sourcefile, 'r') + allstr = s.read() + s.close() + writestr = process_str(allstr) + t.write(writestr) t.close() return 0 @@ -167,8 +171,8 @@ do_generate_from_template(str(t), str(s), env) def generate_from_template_emitter(target, source, env): - base, ext = SCons.Util.splitext(str(target[0])) - t = base + '.inc' + base, ext = SCons.Util.splitext(pbasename(str(source[0]))) + t = pjoin(pdirname(str(target[0])), base) return ([t], source) bld = Builder(action = generate_from_template, emitter = generate_from_template_emitter) @@ -184,4 +188,15 @@ multiarray_src = [ pjoin('src', 'multiarraymodule.c'), ] -#multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src) +multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src) + +# Build sort module +sortmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', '_sortmodule'), + pjoin(env['src_dir'], 'src', '_sortmodule.c.src')) +sort = env.NumpyPythonExtension('_sort', source = sortmodule_src) + +# Build umath module +umathmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'umathmodule'), + pjoin(env['src_dir'], 'src', 'umathmodule.c.src')) +sort = env.NumpyPythonExtension('_sort', source = sortmodule_src) + Modified: branches/numpy.scons/numpy/core/setupscons.py =================================================================== --- branches/numpy.scons/numpy/core/setupscons.py 2007-10-14 16:14:28 UTC (rev 4189) +++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-14 16:14:56 UTC (rev 4190) @@ -203,17 +203,17 @@ if sys.platform == 'cygwin': config.add_data_dir('include/numpy/fenv') - config.add_extension('multiarray', - sources = [join('src','multiarraymodule.c'), - generate_config_h, - generate_array_api, - join('src','scalartypes.inc.src'), - join('src','arraytypes.inc.src'), - join(codegen_dir,'generate_array_api.py'), - join('*.py') - ], - depends = deps, - ) + #config.add_extension('multiarray', + # sources = [join('src','multiarraymodule.c'), + # generate_config_h, + # generate_array_api, + # join('src','scalartypes.inc.src'), + # join('src','arraytypes.inc.src'), + # join(codegen_dir,'generate_array_api.py'), + # join('*.py') + # ], + # depends = deps, + # ) config.add_extension('umath', sources = [generate_config_h, @@ -229,12 +229,12 @@ ]+deps, ) - config.add_extension('_sort', - sources=[join('src','_sortmodule.c.src'), - generate_config_h, - generate_array_api, - ], - ) + #config.add_extension('_sort', + # sources=[join('src','_sortmodule.c.src'), + # generate_config_h, + # generate_array_api, + # ], + # ) config.add_extension('scalarmath', sources=[join('src','scalarmathmodule.c.src'), Modified: branches/numpy.scons/numpy/distutils/scons/custom_builders.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_builders.py 2007-10-14 16:14:28 UTC (rev 4189) +++ branches/numpy.scons/numpy/distutils/scons/custom_builders.py 2007-10-14 16:14:56 UTC (rev 4190) @@ -1,6 +1,7 @@ from os.path import join as pjoin from SCons.Environment import Environment +import SCons.Util def NumpySharedLibrary(env, target, source, *args, **kw): """This builder is the same than SharedLibrary, except for the fact that it @@ -17,9 +18,14 @@ """This builder is the same than PythonExtension, except for the fact that it takes into account build dir info passed by distutils, and put the target at the right location in distutils build directory for correct installation.""" - source = [pjoin(env['build_dir'], i) for i in source] + newsource = [] + for i in source: + if SCons.Util.is_String(i): + newsource.append(pjoin(env['build_dir'], i)) + else: + newsource.append(i) # XXX: why target is a list ? It is always true ? - lib = env.PythonExtension("$build_dir/%s" % target[0], source, *args, **kw) + lib = env.PythonExtension("$build_dir/%s" % target[0], newsource, *args, **kw) inst_lib = env.Install("$distutils_installdir", lib) return lib, inst_lib Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-10-14 16:14:28 UTC (rev 4189) +++ branches/numpy.scons/test.sh 2007-10-14 16:14:56 UTC (rev 4190) @@ -1,5 +1,5 @@ -PREFIX=/usr/media/src/src/dsp/bzrversion/numpy.scons/tmp +PREFIX=/usr/src/dsp/bzrversion/numpy.scons/tmp #rm -rf build rm -rf $PREFIX -python setup.py install --prefix=$PREFIX +python setupscons.py install --prefix=$PREFIX (cd $PREFIX && PYTHONPATH=$PREFIX/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") From numpy-svn at scipy.org Sun Oct 14 12:46:21 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 14 Oct 2007 11:46:21 -0500 (CDT) Subject: [Numpy-svn] r4191 - in branches/numpy.scons: . numpy/core Message-ID: <20071014164621.7816239C1E2@new.scipy.org> Author: cdavid Date: 2007-10-14 11:46:06 -0500 (Sun, 14 Oct 2007) New Revision: 4191 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct Log: Trivial changes Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 01:12:01.368000031 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-15 01:45:21.803999901 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:14:56 UTC (rev 4190) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:46:06 UTC (rev 4191) @@ -113,6 +113,7 @@ ] # TODO: getting the math lib automatically ? Having a list ? +# TODO: test for broken m lib mathlib = os.environ.get('MATHLIB') if mathlib: # XXX: prepend it ? @@ -183,6 +184,8 @@ arraytypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'arraytypes'), pjoin(env['src_dir'], 'src', 'arraytypes.inc.src')) +# XXX +env.Append(CCFLAGS = "-W -Wall -Wextra -O2") # Build multiarray env.Append(CPPPATH = [pjoin(env['src_dir'], 'include'), env['build_dir']]) multiarray_src = [ @@ -198,5 +201,5 @@ # Build umath module umathmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'umathmodule'), pjoin(env['src_dir'], 'src', 'umathmodule.c.src')) -sort = env.NumpyPythonExtension('_sort', source = sortmodule_src) +#sort = env.NumpyPythonExtension('_sort', source = sortmodule_src) From numpy-svn at scipy.org Sun Oct 14 23:24:20 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 14 Oct 2007 22:24:20 -0500 (CDT) Subject: [Numpy-svn] r4192 - in branches/numpy.scons: . numpy/core Message-ID: <20071015032420.AF14E39C060@new.scipy.org> Author: cdavid Date: 2007-10-14 22:24:03 -0500 (Sun, 14 Oct 2007) New Revision: 4192 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/scons_support.py branches/numpy.scons/numpy/core/setupscons.py branches/numpy.scons/test.sh Log: _sort module compiled, but problems with umath Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 01:45:21.803999901 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-15 12:23:15.546999931 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:46:06 UTC (rev 4191) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-15 03:24:03 UTC (rev 4192) @@ -138,7 +138,7 @@ #-------------------------- # Generating multiarray API #-------------------------- -from scons_support import do_generate_api, generate_api_emitter +from scons_support import do_generate_api, generate_api_emitter, do_generate_ufunc_api # XXX: put the builder in scons support lib. bld = Builder(action = do_generate_api, emitter = generate_api_emitter) @@ -185,21 +185,46 @@ pjoin(env['src_dir'], 'src', 'arraytypes.inc.src')) # XXX -env.Append(CCFLAGS = "-W -Wall -Wextra -O2") +#env.Append(CCFLAGS = "-W -Wall") # Build multiarray env.Append(CPPPATH = [pjoin(env['src_dir'], 'include'), env['build_dir']]) multiarray_src = [ pjoin('src', 'multiarraymodule.c'), ] -multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src) +#multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src) # Build sort module sortmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', '_sortmodule'), pjoin(env['src_dir'], 'src', '_sortmodule.c.src')) -sort = env.NumpyPythonExtension('_sort', source = sortmodule_src) +#sort = env.NumpyPythonExtension('_sort', source = sortmodule_src) # Build umath module +def do_generate_umath(targetfile, sourcefile, env): + t = open(targetfile, 'w') + from code_generators import generate_umath + code = generate_umath.make_code(generate_umath.defdict, generate_umath.__file__) + t.write(code) + t.close() + +def generate_umath(target, source, env): + for t, s in zip(target, source): + do_generate_umath(str(t), str(s), env) + +def generate_umath_emitter(target, source, env): + t = str(target[0]) + '.c' + return ([t], source) + +bld = Builder(action = generate_umath, emitter = generate_umath_emitter) +env.Append(BUILDERS = {'GenerateUmath' : bld}) + +bld = Builder(action = do_generate_ufunc_api, emitter = generate_api_emitter) +env.Append(BUILDERS = {'GenerateUfuncApi' : bld}) + +ufunc_api = env.GenerateUfuncApi(pjoin(env['build_dir'], '__ufunc_api'), + pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt')) + umathmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'umathmodule'), pjoin(env['src_dir'], 'src', 'umathmodule.c.src')) -#sort = env.NumpyPythonExtension('_sort', source = sortmodule_src) - +umath = env.GenerateUmath(pjoin(env['build_dir'], '__umath_generated'), + pjoin(env['src_dir'], 'code_generators', 'generate_umath.py')) +umathmodule = env.NumpyPythonExtension('umathmodule', source = umathmodule_src) Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-10-14 16:46:06 UTC (rev 4191) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-15 03:24:03 UTC (rev 4192) @@ -1,8 +1,11 @@ from code_generators.generate_array_api import types, h_template, c_template +from code_generators.generate_ufunc_api import h_template, c_template import code_generators.genapi as genapi import SCons.Errors +# XXX: better refactor code_generators.generate* functions, and use them +# directly def do_generate_api(target, source, env): """source has to be a sequence of OBJECT, MULTIARRAY txt files.""" h_file = str(target[0]) @@ -95,3 +98,54 @@ txt = base + '.txt' t = [h, c, txt] return (t, source) + +def do_generate_ufunc_api(target, source, env): + """source has to be a txt file.""" + h_file = str(target[0]) + c_file = str(target[1]) + d_file = str(target[2]) + + targets = (h_file, c_file, d_file) + + UFUNC_API_ORDER = str(source[0]) + ufunc_api_list = genapi.get_api_functions('UFUNC_API', UFUNC_API_ORDER) + + # API fixes for __arrayobject_api.h + + fixed = 1 + nummulti = len(ufunc_api_list) + numtotal = fixed + nummulti + + module_list = [] + extension_list = [] + init_list = [] + + # set up object API + genapi.add_api_list(fixed, 'PyUFunc_API', ufunc_api_list, + module_list, extension_list, init_list) + + # Write to header + fid = open(h_file, 'w') + s = h_template % ('\n'.join(module_list), '\n'.join(extension_list)) + fid.write(s) + fid.close() + + # Write to c-code + fid = open(c_file, 'w') + s = c_template % '\n'.join(init_list) + fid.write(s) + fid.close() + + # Write to documentation + fid = open(d_file, 'w') + fid.write(''' +================= +Numpy Ufunc C-API +================= +''') + for func in ufunc_api_list: + fid.write(func.to_ReST()) + fid.write('\n\n') + fid.close() + + return 0 Modified: branches/numpy.scons/numpy/core/setupscons.py =================================================================== --- branches/numpy.scons/numpy/core/setupscons.py 2007-10-14 16:46:06 UTC (rev 4191) +++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-15 03:24:03 UTC (rev 4192) @@ -203,18 +203,6 @@ if sys.platform == 'cygwin': config.add_data_dir('include/numpy/fenv') - #config.add_extension('multiarray', - # sources = [join('src','multiarraymodule.c'), - # generate_config_h, - # generate_array_api, - # join('src','scalartypes.inc.src'), - # join('src','arraytypes.inc.src'), - # join(codegen_dir,'generate_array_api.py'), - # join('*.py') - # ], - # depends = deps, - # ) - config.add_extension('umath', sources = [generate_config_h, join('src','umathmodule.c.src'), @@ -229,13 +217,6 @@ ]+deps, ) - #config.add_extension('_sort', - # sources=[join('src','_sortmodule.c.src'), - # generate_config_h, - # generate_array_api, - # ], - # ) - config.add_extension('scalarmath', sources=[join('src','scalarmathmodule.c.src'), generate_config_h, Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-10-14 16:46:06 UTC (rev 4191) +++ branches/numpy.scons/test.sh 2007-10-15 03:24:03 UTC (rev 4192) @@ -1,5 +1,6 @@ PREFIX=/usr/src/dsp/bzrversion/numpy.scons/tmp -#rm -rf build +rm -rf build rm -rf $PREFIX python setupscons.py install --prefix=$PREFIX +#python setup.py install --prefix=$PREFIX (cd $PREFIX && PYTHONPATH=$PREFIX/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") From numpy-svn at scipy.org Mon Oct 15 02:46:13 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 01:46:13 -0500 (CDT) Subject: [Numpy-svn] r4193 - branches/numpy.scons Message-ID: <20071015064613.5060D39C0E4@new.scipy.org> Author: cdavid Date: 2007-10-15 01:45:52 -0500 (Mon, 15 Oct 2007) New Revision: 4193 Modified: branches/numpy.scons/ Log: Make code_generators a proper python package to use it in scons scripts Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 12:23:15.546999931 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-15 13:33:52.779999971 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:file-ids - + numpy/core/code_generators/__init__.py __init__.py-20071015043250-76z2lcbwxnxy1x8k-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 From numpy-svn at scipy.org Mon Oct 15 02:46:47 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 01:46:47 -0500 (CDT) Subject: [Numpy-svn] r4194 - in branches/numpy.scons: . numpy/core Message-ID: <20071015064647.E12DB39C06D@new.scipy.org> Author: cdavid Date: 2007-10-15 01:46:27 -0500 (Mon, 15 Oct 2007) New Revision: 4194 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/scons_support.py Log: Fix overwrite of template strings (multiarray and ufunc) in code generators Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 13:33:52.779999971 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 14:46:24.947000027 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:file-ids - numpy/core/code_generators/__init__.py __init__.py-20071015043250-76z2lcbwxnxy1x8k-1 + Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-10-15 06:45:52 UTC (rev 4193) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-15 06:46:27 UTC (rev 4194) @@ -1,5 +1,9 @@ -from code_generators.generate_array_api import types, h_template, c_template -from code_generators.generate_ufunc_api import h_template, c_template +from code_generators.generate_array_api import \ + types, h_template as multiarray_h_template, \ + c_template as multiarray_c_template +from code_generators.generate_ufunc_api import \ + h_template as ufunc_h_template, \ + c_template as ufunc_c_template import code_generators.genapi as genapi import SCons.Errors @@ -55,13 +59,13 @@ # Write to header fid = open(h_file, 'w') - s = h_template % ('\n'.join(module_list), '\n'.join(extension_list)) + s = multiarray_h_template % ('\n'.join(module_list), '\n'.join(extension_list)) fid.write(s) fid.close() # Write to c-code fid = open(c_file, 'w') - s = c_template % '\n'.join(init_list) + s = multiarray_c_template % '\n'.join(init_list) fid.write(s) fid.close() @@ -126,13 +130,13 @@ # Write to header fid = open(h_file, 'w') - s = h_template % ('\n'.join(module_list), '\n'.join(extension_list)) + s = ufunc_h_template % ('\n'.join(module_list), '\n'.join(extension_list)) fid.write(s) fid.close() # Write to c-code fid = open(c_file, 'w') - s = c_template % '\n'.join(init_list) + s = ufunc_c_template % '\n'.join(init_list) fid.write(s) fid.close() From numpy-svn at scipy.org Mon Oct 15 02:47:26 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 01:47:26 -0500 (CDT) Subject: [Numpy-svn] r4195 - in branches/numpy.scons: . numpy/core Message-ID: <20071015064726.9655A39C06D@new.scipy.org> Author: cdavid Date: 2007-10-15 01:46:57 -0500 (Mon, 15 Oct 2007) New Revision: 4195 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct Log: Minor fixes to configuration checking in numpy core Scons Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 14:46:24.947000027 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 14:46:50.624000072 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-15 06:46:27 UTC (rev 4194) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-15 06:46:57 UTC (rev 4195) @@ -1,4 +1,4 @@ -# Last Change: Fri Oct 12 07:00 PM 2007 J +# Last Change: Mon Oct 15 02:00 PM 2007 J # vim:syntax=python import os from os.path import join as pjoin, basename as pbasename, dirname as pdirname @@ -23,6 +23,15 @@ elif SCons.Util.is_String(value): return "#define %s %s\n\n" % (define, value) t.writelines([write_symbol(i[0], i[1]) for i in sym]) + # XXX: do something about this: a config.h really should not have #ifdef, + # only #define. + t.writelines(""" +#ifdef WITH_THREAD +#define NPY_ALLOW_THREADS 1 +#else +#define NPY_ALLOW_THREADS 0 +#endif +""") t.write('\n') t.close() @@ -59,10 +68,10 @@ nosmp = 1 except KeyError: nosmp = 0 -if nosmp: - config_sym.append(('NPY_ALLOW_THREADS', '0')) -else: - config_sym.append(('NPY_ALLOW_THREADS', '1')) +#if nosmp: +# config_sym.append(('NPY_ALLOW_THREADS', '0')) +#else: +# config_sym.append(('NPY_ALLOW_THREADS', '1')) env.Append(CPPPATH = [get_python_inc()]) config = env.NumpyConfigure(custom_tests = {'CheckTypeSize' : CheckTypeSize}) @@ -86,6 +95,7 @@ check_type('double') check_type('long double') check_type('Py_intptr_t', include = ["Python.h"]) +check_type('PY_LONG_LONG', include = ["Python.h"]) #----------------------- # Checking configuration @@ -114,6 +124,8 @@ # TODO: getting the math lib automatically ? Having a list ? # TODO: test for broken m lib +# TODO: do not add the lib everytime... (autoadd option) +# TODO: checklib vs checkfunc ? mathlib = os.environ.get('MATHLIB') if mathlib: # XXX: prepend it ? @@ -121,12 +133,14 @@ else: mlib = 'm' config_sym.append(('MATHLIB', str(mlib))) -for f in mfuncs: +def check_lib(f): st = config.CheckLib(mlib, f[0]) if st: config_sym.append((f[1], 1)) else: config_sym.append((f[1], 0)) +for f in mfuncs: + check_lib(f) #-------------- # Checking Blas @@ -191,12 +205,12 @@ multiarray_src = [ pjoin('src', 'multiarraymodule.c'), ] -#multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src) +multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src) # Build sort module sortmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', '_sortmodule'), pjoin(env['src_dir'], 'src', '_sortmodule.c.src')) -#sort = env.NumpyPythonExtension('_sort', source = sortmodule_src) +sort = env.NumpyPythonExtension('_sort', source = sortmodule_src) # Build umath module def do_generate_umath(targetfile, sourcefile, env): From numpy-svn at scipy.org Mon Oct 15 02:47:57 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 01:47:57 -0500 (CDT) Subject: [Numpy-svn] r4196 - in branches/numpy.scons: . numpy/core Message-ID: <20071015064757.92E4839C06D@new.scipy.org> Author: cdavid Date: 2007-10-15 01:47:36 -0500 (Mon, 15 Oct 2007) New Revision: 4196 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct Log: Avoid adding the math lib link option for each tested function Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 14:46:50.624000072 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 14:51:14.923000097 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-15 06:46:57 UTC (rev 4195) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-15 06:47:36 UTC (rev 4196) @@ -133,13 +133,18 @@ else: mlib = 'm' config_sym.append(('MATHLIB', str(mlib))) -def check_lib(f): - st = config.CheckLib(mlib, f[0]) +def check_lib(f, autoadd = 0): + """Check that f is available in mlib, and add the symbol appropriately. + + f is expected to be a tuble (symbol, cpp define).""" + st = config.CheckLib(mlib, f[0], autoadd = autoadd) if st: config_sym.append((f[1], 1)) else: config_sym.append((f[1], 0)) -for f in mfuncs: + +check_lib(mfuncs[0], autoadd = 1) +for f in mfuncs[1:]: check_lib(f) #-------------- From numpy-svn at scipy.org Mon Oct 15 02:48:28 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 01:48:28 -0500 (CDT) Subject: [Numpy-svn] r4197 - in branches/numpy.scons: . numpy/core Message-ID: <20071015064828.C475139C06D@new.scipy.org> Author: cdavid Date: 2007-10-15 01:48:05 -0500 (Mon, 15 Oct 2007) New Revision: 4197 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/setupscons.py branches/numpy.scons/test.sh Log: Start working on the problem of adding scons generated files to the distutils disttribution Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 14:51:14.923000097 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 15:35:42.381000042 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-15 06:47:36 UTC (rev 4196) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-15 06:48:05 UTC (rev 4197) @@ -1,4 +1,4 @@ -# Last Change: Mon Oct 15 02:00 PM 2007 J +# Last Change: Mon Oct 15 03:00 PM 2007 J # vim:syntax=python import os from os.path import join as pjoin, basename as pbasename, dirname as pdirname @@ -154,25 +154,21 @@ config.Finish() -#-------------------------- -# Generating multiarray API -#-------------------------- +#--------------------------- +# Builder for generated code +#--------------------------- from scons_support import do_generate_api, generate_api_emitter, do_generate_ufunc_api # XXX: put the builder in scons support lib. bld = Builder(action = do_generate_api, emitter = generate_api_emitter) env.Append(BUILDERS = {'GenerateApi' : bld}) from os.path import join as pjoin -multiarray_api = env.GenerateApi(pjoin(env['build_dir'], '__multiarray_api'), - [pjoin(env['src_dir'], 'code_generators', 'array_api_order.txt'), - pjoin(env['src_dir'], 'code_generators', 'multiarray_api_order.txt')]) # Take into account the change in config_sym (using emitter, see SubstDic # example in scons wiki) ? env['config_h_gen'] = config_sym bld = Builder(action = generate_config_header) env.Append(BUILDERS = {'GenerateConfigHeader' : bld}) -config_header = env.GenerateConfigHeader(pjoin(env['build_dir'], 'config.h'), []) # Builder to generate .inc from .inc.src from numpy.distutils.conv_template import process_str @@ -195,29 +191,6 @@ t = pjoin(pdirname(str(target[0])), base) return ([t], source) -bld = Builder(action = generate_from_template, emitter = generate_from_template_emitter) -env.Append(BUILDERS = {'FromTemplate' : bld}) - -scalartypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'scalartypes'), - pjoin(env['src_dir'], 'src', 'scalartypes.inc.src')) -arraytypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'arraytypes'), - pjoin(env['src_dir'], 'src', 'arraytypes.inc.src')) - -# XXX -#env.Append(CCFLAGS = "-W -Wall") -# Build multiarray -env.Append(CPPPATH = [pjoin(env['src_dir'], 'include'), env['build_dir']]) -multiarray_src = [ - pjoin('src', 'multiarraymodule.c'), -] -multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src) - -# Build sort module -sortmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', '_sortmodule'), - pjoin(env['src_dir'], 'src', '_sortmodule.c.src')) -sort = env.NumpyPythonExtension('_sort', source = sortmodule_src) - -# Build umath module def do_generate_umath(targetfile, sourcefile, env): t = open(targetfile, 'w') from code_generators import generate_umath @@ -239,11 +212,66 @@ bld = Builder(action = do_generate_ufunc_api, emitter = generate_api_emitter) env.Append(BUILDERS = {'GenerateUfuncApi' : bld}) -ufunc_api = env.GenerateUfuncApi(pjoin(env['build_dir'], '__ufunc_api'), - pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt')) +bld = Builder(action = generate_from_template, emitter = generate_from_template_emitter) +env.Append(BUILDERS = {'FromTemplate' : bld}) +#------------------------ +# Generate generated code +#------------------------ +config_header = env.GenerateConfigHeader(pjoin(env['build_dir'], 'config.h'), []) + +scalartypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'scalartypes'), + pjoin(env['src_dir'], 'src', 'scalartypes.inc.src')) +arraytypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'arraytypes'), + pjoin(env['src_dir'], 'src', 'arraytypes.inc.src')) +sortmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', '_sortmodule'), + pjoin(env['src_dir'], 'src', '_sortmodule.c.src')) umathmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'umathmodule'), pjoin(env['src_dir'], 'src', 'umathmodule.c.src')) +scalarmathmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', + 'scalarmathmodule'), + pjoin(env['src_dir'], 'src', + 'scalarmathmodule.c.src')) + umath = env.GenerateUmath(pjoin(env['build_dir'], '__umath_generated'), pjoin(env['src_dir'], 'code_generators', 'generate_umath.py')) + +multiarray_api = env.GenerateApi(pjoin(env['build_dir'], '__multiarray_api'), + [pjoin(env['src_dir'], 'code_generators', 'array_api_order.txt'), + pjoin(env['src_dir'], 'code_generators', 'multiarray_api_order.txt')]) +ufunc_api = env.GenerateUfuncApi(pjoin(env['build_dir'], '__ufunc_api'), + pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt')) + +# XXX +#env.Append(CCFLAGS = "-W -Wall") + +#----------------- +# Build multiarray +#----------------- +env.Append(CPPPATH = [pjoin(env['src_dir'], 'include'), env['build_dir']]) +multiarray_src = [ + pjoin('src', 'multiarraymodule.c'), +] +multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src) + +#------------------ +# Build sort module +#------------------ +sort = env.NumpyPythonExtension('_sort', source = sortmodule_src) + +#------------------- +# Build umath module +#------------------- umathmodule = env.NumpyPythonExtension('umathmodule', source = umathmodule_src) + +#------------------------ +# Build scalarmath module +#------------------------ +scalarmathmodule = env.NumpyPythonExtension('scalarmathmodule', + source = scalarmathmodule_src) + +#---------------------- +# Build _dotblas module +#---------------------- +dotblas_src = [pjoin('blasdot', i) for i in ['_dotblas.c']] +dotblas = env.NumpyPythonExtension('_dotblas', source = dotblas_src) Modified: branches/numpy.scons/numpy/core/setupscons.py =================================================================== --- branches/numpy.scons/numpy/core/setupscons.py 2007-10-15 06:47:36 UTC (rev 4196) +++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-15 06:48:05 UTC (rev 4197) @@ -24,206 +24,180 @@ config = Configuration('core',parent_package,top_path) local_dir = config.local_path - codegen_dir = join(local_dir,'code_generators') + #codegen_dir = join(local_dir,'code_generators') - generate_umath_py = join(codegen_dir,'generate_umath.py') - n = dot_join(config.name,'generate_umath') - generate_umath = imp.load_module('_'.join(n.split('.')), - open(generate_umath_py,'U'),generate_umath_py, - ('.py','U',1)) + #generate_umath_py = join(codegen_dir,'generate_umath.py') + #n = dot_join(config.name,'generate_umath') + #generate_umath = imp.load_module('_'.join(n.split('.')), + # open(generate_umath_py,'U'),generate_umath_py, + # ('.py','U',1)) header_dir = 'include/numpy' # this is relative to config.path_in_package config.add_sconscript('SConstruct') - def generate_config_h(ext, build_dir): - target = join(build_dir,'config.h') - if newer(__file__,target): - config_cmd = config.get_config_cmd() - log.info('Generating %s',target) - tc = generate_testcode(target) - from distutils import sysconfig - python_include = sysconfig.get_python_inc() - python_h = join(python_include, 'Python.h') - if not os.path.isfile(python_h): - raise SystemError,\ - "Non-existing %s. Perhaps you need to install"\ - " python-dev|python-devel." % (python_h) - result = config_cmd.try_run(tc,include_dirs=[python_include], - library_dirs = default_lib_dirs) - if not result: - raise SystemError,"Failed to test configuration. "\ - "See previous error messages for more information." + #def generate_config_h(ext, build_dir): + # target = join(build_dir,'config.h') + # if newer(__file__,target): + # config_cmd = config.get_config_cmd() + # log.info('Generating %s',target) + # tc = generate_testcode(target) + # from distutils import sysconfig + # python_include = sysconfig.get_python_inc() + # python_h = join(python_include, 'Python.h') + # if not os.path.isfile(python_h): + # raise SystemError,\ + # "Non-existing %s. Perhaps you need to install"\ + # " python-dev|python-devel." % (python_h) + # result = config_cmd.try_run(tc,include_dirs=[python_include], + # library_dirs = default_lib_dirs) + # if not result: + # raise SystemError,"Failed to test configuration. "\ + # "See previous error messages for more information." - # Python 2.3 causes a segfault when - # trying to re-acquire the thread-state - # which is done in error-handling - # ufunc code. NPY_ALLOW_C_API and friends - # cause the segfault. So, we disable threading - # for now. - if sys.version[:5] < '2.4.2': - nosmp = 1 - else: - # Perhaps a fancier check is in order here. - # so that threads are only enabled if there - # are actually multiple CPUS? -- but - # threaded code can be nice even on a single - # CPU so that long-calculating code doesn't - # block. - try: - nosmp = os.environ['NPY_NOSMP'] - nosmp = 1 - except KeyError: - nosmp = 0 - if nosmp: moredefs = [('NPY_ALLOW_THREADS', '0')] - else: moredefs = [] - # - mathlibs = [] - tc = testcode_mathlib() - mathlibs_choices = [[],['m'],['cpml']] - mathlib = os.environ.get('MATHLIB') - if mathlib: - mathlibs_choices.insert(0,mathlib.split(',')) - for libs in mathlibs_choices: - if config_cmd.try_run(tc,libraries=libs): - mathlibs = libs - break - else: - raise EnvironmentError("math library missing; rerun " - "setup.py after setting the " - "MATHLIB env variable") - ext.libraries.extend(mathlibs) - moredefs.append(('MATHLIB',','.join(mathlibs))) + # # Python 2.3 causes a segfault when + # # trying to re-acquire the thread-state + # # which is done in error-handling + # # ufunc code. NPY_ALLOW_C_API and friends + # # cause the segfault. So, we disable threading + # # for now. + # if sys.version[:5] < '2.4.2': + # nosmp = 1 + # else: + # # Perhaps a fancier check is in order here. + # # so that threads are only enabled if there + # # are actually multiple CPUS? -- but + # # threaded code can be nice even on a single + # # CPU so that long-calculating code doesn't + # # block. + # try: + # nosmp = os.environ['NPY_NOSMP'] + # nosmp = 1 + # except KeyError: + # nosmp = 0 + # if nosmp: moredefs = [('NPY_ALLOW_THREADS', '0')] + # else: moredefs = [] + # # + # mathlibs = [] + # tc = testcode_mathlib() + # mathlibs_choices = [[],['m'],['cpml']] + # mathlib = os.environ.get('MATHLIB') + # if mathlib: + # mathlibs_choices.insert(0,mathlib.split(',')) + # for libs in mathlibs_choices: + # if config_cmd.try_run(tc,libraries=libs): + # mathlibs = libs + # break + # else: + # raise EnvironmentError("math library missing; rerun " + # "setup.py after setting the " + # "MATHLIB env variable") + # ext.libraries.extend(mathlibs) + # moredefs.append(('MATHLIB',','.join(mathlibs))) - def check_func(func_name): - return config_cmd.check_func(func_name, - libraries=mathlibs, decl=False, - headers=['math.h']) + # def check_func(func_name): + # return config_cmd.check_func(func_name, + # libraries=mathlibs, decl=False, + # headers=['math.h']) - for func_name, defsymbol in FUNCTIONS_TO_CHECK: - if check_func(func_name): - moredefs.append(defsymbol) + # for func_name, defsymbol in FUNCTIONS_TO_CHECK: + # if check_func(func_name): + # moredefs.append(defsymbol) - if sys.platform == 'win32': - moredefs.append('NPY_NO_SIGNAL') + # if sys.platform == 'win32': + # moredefs.append('NPY_NO_SIGNAL') - if sys.platform=='win32' or os.name=='nt': - from distutils.msvccompiler import get_build_architecture - a = get_build_architecture() - print 'BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % (a, os.name, sys.platform) - if a == 'AMD64': - moredefs.append('DISTUTILS_USE_SDK') + # if sys.platform=='win32' or os.name=='nt': + # from distutils.msvccompiler import get_build_architecture + # a = get_build_architecture() + # print 'BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % (a, os.name, sys.platform) + # if a == 'AMD64': + # moredefs.append('DISTUTILS_USE_SDK') - if sys.version[:3] < '2.4': - if config_cmd.check_func('strtod', decl=False, - headers=['stdlib.h']): - moredefs.append(('PyOS_ascii_strtod', 'strtod')) + # if sys.version[:3] < '2.4': + # if config_cmd.check_func('strtod', decl=False, + # headers=['stdlib.h']): + # moredefs.append(('PyOS_ascii_strtod', 'strtod')) - target_f = open(target,'a') - for d in moredefs: - if isinstance(d,str): - target_f.write('#define %s\n' % (d)) - else: - target_f.write('#define %s %s\n' % (d[0],d[1])) - if not nosmp: # default is to use WITH_THREAD - target_f.write('#ifdef WITH_THREAD\n#define NPY_ALLOW_THREADS 1\n#else\n#define NPY_ALLOW_THREADS 0\n#endif\n') - target_f.close() - print 'File:',target - target_f = open(target) - print target_f.read() - target_f.close() - print 'EOF' - else: - mathlibs = [] - target_f = open(target) - for line in target_f.readlines(): - s = '#define MATHLIB' - if line.startswith(s): - value = line[len(s):].strip() - if value: - mathlibs.extend(value.split(',')) - target_f.close() + # target_f = open(target,'a') + # for d in moredefs: + # if isinstance(d,str): + # target_f.write('#define %s\n' % (d)) + # else: + # target_f.write('#define %s %s\n' % (d[0],d[1])) + # if not nosmp: # default is to use WITH_THREAD + # target_f.write('#ifdef WITH_THREAD\n#define NPY_ALLOW_THREADS 1\n#else\n#define NPY_ALLOW_THREADS 0\n#endif\n') + # target_f.close() + # print 'File:',target + # target_f = open(target) + # print target_f.read() + # target_f.close() + # print 'EOF' + # else: + # mathlibs = [] + # target_f = open(target) + # for line in target_f.readlines(): + # s = '#define MATHLIB' + # if line.startswith(s): + # value = line[len(s):].strip() + # if value: + # mathlibs.extend(value.split(',')) + # target_f.close() - ext.libraries.extend(mathlibs) + # ext.libraries.extend(mathlibs) - incl_dir = os.path.dirname(target) - if incl_dir not in config.numpy_include_dirs: - config.numpy_include_dirs.append(incl_dir) + # incl_dir = os.path.dirname(target) + # if incl_dir not in config.numpy_include_dirs: + # config.numpy_include_dirs.append(incl_dir) - config.add_data_files((header_dir,target)) - return target + # config.add_data_files((header_dir,target)) + # return target - def generate_api_func(module_name): - def generate_api(ext, build_dir): - script = join(codegen_dir, module_name + '.py') - sys.path.insert(0, codegen_dir) - try: - m = __import__(module_name) - log.info('executing %s', script) - h_file, c_file, doc_file = m.generate_api(build_dir) - finally: - del sys.path[0] - config.add_data_files((header_dir, h_file), - (header_dir, doc_file)) - return (h_file,) - return generate_api + #def generate_api_func(module_name): + # def generate_api(ext, build_dir): + # script = join(codegen_dir, module_name + '.py') + # sys.path.insert(0, codegen_dir) + # try: + # m = __import__(module_name) + # log.info('executing %s', script) + # h_file, c_file, doc_file = m.generate_api(build_dir) + # finally: + # del sys.path[0] + # config.add_data_files((header_dir, h_file), + # (header_dir, doc_file)) + # return (h_file,) + # return generate_api - generate_array_api = generate_api_func('generate_array_api') - generate_ufunc_api = generate_api_func('generate_ufunc_api') + #generate_array_api = generate_api_func('generate_array_api') + #generate_ufunc_api = generate_api_func('generate_ufunc_api') - def generate_umath_c(ext,build_dir): - target = join(build_dir,'__umath_generated.c') - script = generate_umath_py - if newer(script,target): - f = open(target,'w') - f.write(generate_umath.make_code(generate_umath.defdict, - generate_umath.__file__)) - f.close() - return [] + #def generate_umath_c(ext,build_dir): + # target = join(build_dir,'__umath_generated.c') + # script = generate_umath_py + # if newer(script,target): + # f = open(target,'w') + # f.write(generate_umath.make_code(generate_umath.defdict, + # generate_umath.__file__)) + # f.close() + # return [] + # Add generated files to distutils... + #print dir(config) + #print config.get_build_temp_dir() + #config_header = os.path.dirname( + # incl_dir = os.path.dirname(target) + # if incl_dir not in config.numpy_include_dirs: + # config.numpy_include_dirs.append(incl_dir) + + # config.add_data_files((header_dir,target)) config.add_data_files('include/numpy/*.h') config.add_include_dirs('src') config.numpy_include_dirs.extend(config.paths('include')) - deps = [join('src','arrayobject.c'), - join('src','arraymethods.c'), - join('src','scalartypes.inc.src'), - join('src','arraytypes.inc.src'), - join('src','_signbit.c'), - join('src','_isnan.c'), - join('src','ucsnarrow.c'), - join('include','numpy','*object.h'), - 'include/numpy/fenv/fenv.c', - 'include/numpy/fenv/fenv.h', - join(codegen_dir,'genapi.py'), - join(codegen_dir,'*.txt') - ] - # Don't install fenv unless we need them. if sys.platform == 'cygwin': config.add_data_dir('include/numpy/fenv') - config.add_extension('umath', - sources = [generate_config_h, - join('src','umathmodule.c.src'), - generate_umath_c, - generate_ufunc_api, - join('src','scalartypes.inc.src'), - join('src','arraytypes.inc.src'), - ], - depends = [join('src','ufuncobject.c'), - generate_umath_py, - join(codegen_dir,'generate_ufunc_api.py'), - ]+deps, - ) - - config.add_extension('scalarmath', - sources=[join('src','scalarmathmodule.c.src'), - generate_config_h, - generate_array_api, - generate_ufunc_api], - ) - # Configure blasdot blas_info = get_info('blas_opt',0) #blas_info = {} @@ -234,16 +208,6 @@ return ext.depends[:1] return None # no extension module will be built - config.add_extension('_dotblas', - sources = [get_dotblas_sources], - depends=[join('blasdot','_dotblas.c'), - join('blasdot','cblas.h'), - ], - include_dirs = ['blasdot'], - extra_info = blas_info - ) - - config.add_data_dir('tests') config.make_svn_version_py() @@ -259,71 +223,71 @@ } """ -import sys -def generate_testcode(target): - if sys.platform == 'win32': - target = target.replace('\\','\\\\') - testcode = [r''' -#include -#include -#include +# import sys +# def generate_testcode(target): +# if sys.platform == 'win32': +# target = target.replace('\\','\\\\') +# testcode = [r''' +# #include +# #include +# #include +# +# int main(int argc, char **argv) +# { +# +# FILE *fp; +# +# fp = fopen("'''+target+'''","w"); +# '''] +# +# c_size_test = r''' +# #ifndef %(sz)s +# fprintf(fp,"#define %(sz)s %%d\n", sizeof(%(type)s)); +# #else +# fprintf(fp,"/* #define %(sz)s %%d */\n", %(sz)s); +# #endif +# ''' +# for sz, t in [('SIZEOF_SHORT', 'short'), +# ('SIZEOF_INT', 'int'), +# ('SIZEOF_LONG', 'long'), +# ('SIZEOF_FLOAT', 'float'), +# ('SIZEOF_DOUBLE', 'double'), +# ('SIZEOF_LONG_DOUBLE', 'long double'), +# ('SIZEOF_PY_INTPTR_T', 'Py_intptr_t'), +# ]: +# testcode.append(c_size_test % {'sz' : sz, 'type' : t}) +# +# testcode.append('#ifdef PY_LONG_LONG') +# testcode.append(c_size_test % {'sz' : 'SIZEOF_LONG_LONG', +# 'type' : 'PY_LONG_LONG'}) +# testcode.append(c_size_test % {'sz' : 'SIZEOF_PY_LONG_LONG', +# 'type' : 'PY_LONG_LONG'}) +# +# +# testcode.append(r''' +# #else +# fprintf(fp, "/* PY_LONG_LONG not defined */\n"); +# #endif +# #ifndef CHAR_BIT +# { +# unsigned char var = 2; +# int i=0; +# while (var >= 2) { +# var = var << 1; +# i++; +# } +# fprintf(fp,"#define CHAR_BIT %d\n", i+1); +# } +# #else +# fprintf(fp, "/* #define CHAR_BIT %d */\n", CHAR_BIT); +# #endif +# fclose(fp); +# return 0; +# } +# ''') +# testcode = '\n'.join(testcode) +# return testcode -int main(int argc, char **argv) -{ - - FILE *fp; - - fp = fopen("'''+target+'''","w"); - '''] - - c_size_test = r''' -#ifndef %(sz)s - fprintf(fp,"#define %(sz)s %%d\n", sizeof(%(type)s)); -#else - fprintf(fp,"/* #define %(sz)s %%d */\n", %(sz)s); -#endif -''' - for sz, t in [('SIZEOF_SHORT', 'short'), - ('SIZEOF_INT', 'int'), - ('SIZEOF_LONG', 'long'), - ('SIZEOF_FLOAT', 'float'), - ('SIZEOF_DOUBLE', 'double'), - ('SIZEOF_LONG_DOUBLE', 'long double'), - ('SIZEOF_PY_INTPTR_T', 'Py_intptr_t'), - ]: - testcode.append(c_size_test % {'sz' : sz, 'type' : t}) - - testcode.append('#ifdef PY_LONG_LONG') - testcode.append(c_size_test % {'sz' : 'SIZEOF_LONG_LONG', - 'type' : 'PY_LONG_LONG'}) - testcode.append(c_size_test % {'sz' : 'SIZEOF_PY_LONG_LONG', - 'type' : 'PY_LONG_LONG'}) - - - testcode.append(r''' -#else - fprintf(fp, "/* PY_LONG_LONG not defined */\n"); -#endif -#ifndef CHAR_BIT - { - unsigned char var = 2; - int i=0; - while (var >= 2) { - var = var << 1; - i++; - } - fprintf(fp,"#define CHAR_BIT %d\n", i+1); - } -#else - fprintf(fp, "/* #define CHAR_BIT %d */\n", CHAR_BIT); -#endif - fclose(fp); - return 0; -} -''') - testcode = '\n'.join(testcode) - return testcode - if __name__=='__main__': from numpy.distutils.core import setup setup(configuration=configuration) Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-10-15 06:47:36 UTC (rev 4196) +++ branches/numpy.scons/test.sh 2007-10-15 06:48:05 UTC (rev 4197) @@ -1,6 +1,8 @@ -PREFIX=/usr/src/dsp/bzrversion/numpy.scons/tmp +PREFIX=/usr/media/src/src/dsp/bzrversion/numpy.scons/tmp rm -rf build rm -rf $PREFIX -python setupscons.py install --prefix=$PREFIX -#python setup.py install --prefix=$PREFIX -(cd $PREFIX && PYTHONPATH=$PREFIX/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") +python setupscons.py scons +python setupscons.py build +#--prefix=$PREFIX +##python setup.py install --prefix=$PREFIX +#(cd $PREFIX && PYTHONPATH=$PREFIX/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") From numpy-svn at scipy.org Mon Oct 15 05:39:55 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 04:39:55 -0500 (CDT) Subject: [Numpy-svn] r4198 - in branches/numpy.scons: . numpy/distutils numpy/distutils/command numpy/distutils/scons numpy/scons_fake numpy/scons_fake/hook Message-ID: <20071015093955.3921739C19C@new.scipy.org> Author: cdavid Date: 2007-10-15 04:39:33 -0500 (Mon, 15 Oct 2007) New Revision: 4198 Added: branches/numpy.scons/numpy/scons_fake/hook/ branches/numpy.scons/numpy/scons_fake/hook/setup.py Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/misc_util.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py branches/numpy.scons/numpy/scons_fake/setup.py branches/numpy.scons/numpy/scons_fake/setupscons.py Log: Merging work on scons hook Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 15:35:42.381000042 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 17:03:15.628000021 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:ancestry:v3-trunk0 - svn-v3-trunk0:94b884b6-d6fd-0310-90d3-974f1d3f35e1:branches%2Fnumpy.scons:4112 david at ar.media.kyoto-u.ac.jp-20071012063527-x9tlkbs04vw0iyxg + svn-v3-trunk0:94b884b6-d6fd-0310-90d3-974f1d3f35e1:branches%2Fnumpy.scons:4112 david at ar.media.kyoto-u.ac.jp-20071012063527-x9tlkbs04vw0iyxg david at ar.media.kyoto-u.ac.jp-20071015075441-i7mszxi11r9w0rlg Name: bzr:file-ids - + numpy/scons_fake/hook hook-20071015073443-rtv8bjyd3wprxf89-1 numpy/scons_fake/hook/SConstruct sconstruct-20071015073443-rtv8bjyd3wprxf89-2 numpy/scons_fake/hook/setup.py setup.py-20071015073443-rtv8bjyd3wprxf89-3 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-15 06:48:05 UTC (rev 4197) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-15 09:39:33 UTC (rev 4198) @@ -8,6 +8,12 @@ from numpy.distutils.ccompiler import CCompiler from numpy.distutils.exec_command import find_executable +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 @@ -124,12 +130,14 @@ scons_exec = get_python_exec_invoc() scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py')) - for i in self.scons_scripts: + for sconscript, pre_hook, post_hook in self.scons_scripts: + if post_hook: + post_hook() # XXX: This is inefficient... (use join instead) - cmd = scons_exec + " -f " + i + ' -I. ' - cmd += ' src_dir="%s" ' % pdirname(i) + cmd = scons_exec + " -f " + sconscript + ' -I. ' + cmd += ' src_dir="%s" ' % pdirname(sconscript) cmd += ' distutils_libdir=%s ' % protect_path(pjoin(self.build_lib, - pdirname(i))) + pdirname(sconscript))) cmd += ' cc_opt=%s ' % dist2sconscc(self.compiler) cmd += ' cc_opt_path=%s ' % protect_path(get_tool_path(self.compiler)) st = os.system(cmd) Modified: branches/numpy.scons/numpy/distutils/misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-15 06:48:05 UTC (rev 4197) +++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-15 09:39:33 UTC (rev 4198) @@ -1171,9 +1171,13 @@ def add_sconscript(self, sconscript, subpackage_path=None, - standalone = False): - """Add a list of sconscript to configuration. - """ + standalone = False, + pre_hook = None, + post_hook = None): + """Add a sconscript to configuration. + + pre_hook and post hook should be sequences of callable, which will be + use before and after executing scons. """ #print "%s: adding %s" % (__file__, sconscript) if standalone: parent_name = None @@ -1183,14 +1187,14 @@ dist = self.get_distribution() # Convert the sconscript name to a relative filename (relative from top # setup.py's directory) - fullsconsname = self.paths(sconscript) + fullsconsname = self.paths(sconscript)[0] if dist is not None: - dist.scons_scripts.extend(fullsconsname) + dist.scons_scripts.extend((fullsconsname, pre_hook, post_hook)) self.warn('distutils distribution has been initialized,'\ ' it may be too late to add a subpackage '+ subpackage_name) else: - self.scons_scripts.extend(fullsconsname) + self.scons_scripts.append((fullsconsname, pre_hook, post_hook)) def add_scripts(self,*files): """Add scripts to configuration. @@ -1256,6 +1260,10 @@ cmd.ensure_finalized() return cmd.build_temp + def get_scons_build_dir(self): + from command.scons import get_scons_build_dir + return get_scons_build_dir() + def have_f77c(self): """Check for availability of Fortran 77 compiler. Use it inside source generating function to ensure that Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-15 06:48:05 UTC (rev 4197) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-15 09:39:33 UTC (rev 4198) @@ -10,6 +10,8 @@ from SCons.Tool import Tool, FindTool, FindAllTools from SCons.Script import BuildDir, Help +from numpy.distutils.command.scons import get_scons_build_dir + from default import tool_list from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension from libinfo import get_config @@ -52,7 +54,7 @@ opts.Add('pkg_name', 'name of the package (including parent package if any)', '') opts.Add('src_dir', 'src dir relative to top called', '.') opts.Add('build_prefix', 'build prefix (NOT including the package name)', - pjoin('build', 'scons')) + get_scons_build_dir()) opts.Add('distutils_libdir', 'build dir for libraries of distutils (NOT including the package name)', pjoin('build', 'lib')) Added: branches/numpy.scons/numpy/scons_fake/hook/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/hook/setup.py 2007-10-15 06:48:05 UTC (rev 4197) +++ branches/numpy.scons/numpy/scons_fake/hook/setup.py 2007-10-15 09:39:33 UTC (rev 4198) @@ -0,0 +1,15 @@ +import os +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('hook',parent_package,top_path) + + def foo(): + print "foo" + config.add_sconscript('SConstruct', post_hook = foo) + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Modified: branches/numpy.scons/numpy/scons_fake/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-15 06:48:05 UTC (rev 4197) +++ branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-15 09:39:33 UTC (rev 4198) @@ -8,6 +8,7 @@ config.add_subpackage('pyext') config.add_subpackage('ctypesext') config.add_subpackage('checklib') + config.add_subpackage('hook') return config if __name__ == '__main__': Modified: branches/numpy.scons/numpy/scons_fake/setupscons.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setupscons.py 2007-10-15 06:48:05 UTC (rev 4197) +++ branches/numpy.scons/numpy/scons_fake/setupscons.py 2007-10-15 09:39:33 UTC (rev 4198) @@ -8,6 +8,7 @@ config.add_subpackage('pyext') config.add_subpackage('ctypesext') config.add_subpackage('checklib') + config.add_subpackage('hook') return config if __name__ == '__main__': From numpy-svn at scipy.org Mon Oct 15 05:40:18 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 04:40:18 -0500 (CDT) Subject: [Numpy-svn] r4199 - in branches/numpy.scons: . numpy/core numpy/random Message-ID: <20071015094018.86FE639C0F9@new.scipy.org> Author: cdavid Date: 2007-10-15 04:40:03 -0500 (Mon, 15 Oct 2007) New Revision: 4199 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/setupscons.py branches/numpy.scons/numpy/random/setupscons.py branches/numpy.scons/test.sh Log: All numpy.core now built with scons, pass all tests on linux Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 17:03:15.628000021 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 18:00:09.984999895 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:file-ids - numpy/scons_fake/hook hook-20071015073443-rtv8bjyd3wprxf89-1 numpy/scons_fake/hook/SConstruct sconstruct-20071015073443-rtv8bjyd3wprxf89-2 numpy/scons_fake/hook/setup.py setup.py-20071015073443-rtv8bjyd3wprxf89-3 + Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-15 09:39:33 UTC (rev 4198) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-15 09:40:03 UTC (rev 4199) @@ -1,4 +1,4 @@ -# Last Change: Mon Oct 15 03:00 PM 2007 J +# Last Change: Mon Oct 15 05:00 PM 2007 J # vim:syntax=python import os from os.path import join as pjoin, basename as pbasename, dirname as pdirname @@ -243,7 +243,7 @@ pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt')) # XXX -#env.Append(CCFLAGS = "-W -Wall") +#env.Append(CCFLAGS = "-Wall -O2") #----------------- # Build multiarray Modified: branches/numpy.scons/numpy/core/setupscons.py =================================================================== --- branches/numpy.scons/numpy/core/setupscons.py 2007-10-15 09:39:33 UTC (rev 4198) +++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-15 09:40:03 UTC (rev 4199) @@ -5,190 +5,54 @@ from numpy.distutils import log from distutils.dep_util import newer -FUNCTIONS_TO_CHECK = [ - ('expl', 'HAVE_LONGDOUBLE_FUNCS'), - ('expf', 'HAVE_FLOAT_FUNCS'), - ('log1p', 'HAVE_LOG1P'), - ('expm1', 'HAVE_EXPM1'), - ('asinh', 'HAVE_INVERSE_HYPERBOLIC'), - ('atanhf', 'HAVE_INVERSE_HYPERBOLIC_FLOAT'), - ('atanhl', 'HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE'), - ('isnan', 'HAVE_ISNAN'), - ('isinf', 'HAVE_ISINF'), - ('rint', 'HAVE_RINT'), - ] - def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration,dot_join from numpy.distutils.system_info import get_info, default_lib_dirs config = Configuration('core',parent_package,top_path) local_dir = config.local_path - #codegen_dir = join(local_dir,'code_generators') - #generate_umath_py = join(codegen_dir,'generate_umath.py') - #n = dot_join(config.name,'generate_umath') - #generate_umath = imp.load_module('_'.join(n.split('.')), - # open(generate_umath_py,'U'),generate_umath_py, - # ('.py','U',1)) - header_dir = 'include/numpy' # this is relative to config.path_in_package - config.add_sconscript('SConstruct') - #def generate_config_h(ext, build_dir): - # target = join(build_dir,'config.h') - # if newer(__file__,target): - # config_cmd = config.get_config_cmd() - # log.info('Generating %s',target) - # tc = generate_testcode(target) - # from distutils import sysconfig - # python_include = sysconfig.get_python_inc() - # python_h = join(python_include, 'Python.h') - # if not os.path.isfile(python_h): - # raise SystemError,\ - # "Non-existing %s. Perhaps you need to install"\ - # " python-dev|python-devel." % (python_h) - # result = config_cmd.try_run(tc,include_dirs=[python_include], - # library_dirs = default_lib_dirs) - # if not result: - # raise SystemError,"Failed to test configuration. "\ - # "See previous error messages for more information." + # Add generated files to distutils... + def add_config_header(): + scons_build_dir = config.get_scons_build_dir() + # XXX: I really have to think about how to communicate path info + # between scons and distutils, and set the options at one single + # location. + target = join(scons_build_dir, local_dir, 'config.h') + incl_dir = os.path.dirname(target) + if incl_dir not in config.numpy_include_dirs: + config.numpy_include_dirs.append(incl_dir) + config.add_data_files((header_dir, target)) - # # Python 2.3 causes a segfault when - # # trying to re-acquire the thread-state - # # which is done in error-handling - # # ufunc code. NPY_ALLOW_C_API and friends - # # cause the segfault. So, we disable threading - # # for now. - # if sys.version[:5] < '2.4.2': - # nosmp = 1 - # else: - # # Perhaps a fancier check is in order here. - # # so that threads are only enabled if there - # # are actually multiple CPUS? -- but - # # threaded code can be nice even on a single - # # CPU so that long-calculating code doesn't - # # block. - # try: - # nosmp = os.environ['NPY_NOSMP'] - # nosmp = 1 - # except KeyError: - # nosmp = 0 - # if nosmp: moredefs = [('NPY_ALLOW_THREADS', '0')] - # else: moredefs = [] - # # - # mathlibs = [] - # tc = testcode_mathlib() - # mathlibs_choices = [[],['m'],['cpml']] - # mathlib = os.environ.get('MATHLIB') - # if mathlib: - # mathlibs_choices.insert(0,mathlib.split(',')) - # for libs in mathlibs_choices: - # if config_cmd.try_run(tc,libraries=libs): - # mathlibs = libs - # break - # else: - # raise EnvironmentError("math library missing; rerun " - # "setup.py after setting the " - # "MATHLIB env variable") - # ext.libraries.extend(mathlibs) - # moredefs.append(('MATHLIB',','.join(mathlibs))) + def add_array_api(): + scons_build_dir = config.get_scons_build_dir() + # XXX: I really have to think about how to communicate path info + # between scons and distutils, and set the options at one single + # location. + h_file = join(scons_build_dir, local_dir, '__multiarray_api.h') + t_file = join(scons_build_dir, local_dir, '__multiarray_api.txt') + config.add_data_files((header_dir, h_file), + (header_dir, t_file)) - # def check_func(func_name): - # return config_cmd.check_func(func_name, - # libraries=mathlibs, decl=False, - # headers=['math.h']) + def add_ufunc_api(): + scons_build_dir = config.get_scons_build_dir() + # XXX: I really have to think about how to communicate path info + # between scons and distutils, and set the options at one single + # location. + h_file = join(scons_build_dir, local_dir, '__ufunc_api.h') + t_file = join(scons_build_dir, local_dir, '__ufunc_api.txt') + config.add_data_files((header_dir, h_file), + (header_dir, t_file)) - # for func_name, defsymbol in FUNCTIONS_TO_CHECK: - # if check_func(func_name): - # moredefs.append(defsymbol) + def add_generated_files(): + add_config_header() + add_array_api() + add_ufunc_api() - # if sys.platform == 'win32': - # moredefs.append('NPY_NO_SIGNAL') + config.add_sconscript('SConstruct', post_hook = add_generated_files) - # if sys.platform=='win32' or os.name=='nt': - # from distutils.msvccompiler import get_build_architecture - # a = get_build_architecture() - # print 'BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % (a, os.name, sys.platform) - # if a == 'AMD64': - # moredefs.append('DISTUTILS_USE_SDK') - - # if sys.version[:3] < '2.4': - # if config_cmd.check_func('strtod', decl=False, - # headers=['stdlib.h']): - # moredefs.append(('PyOS_ascii_strtod', 'strtod')) - - # target_f = open(target,'a') - # for d in moredefs: - # if isinstance(d,str): - # target_f.write('#define %s\n' % (d)) - # else: - # target_f.write('#define %s %s\n' % (d[0],d[1])) - # if not nosmp: # default is to use WITH_THREAD - # target_f.write('#ifdef WITH_THREAD\n#define NPY_ALLOW_THREADS 1\n#else\n#define NPY_ALLOW_THREADS 0\n#endif\n') - # target_f.close() - # print 'File:',target - # target_f = open(target) - # print target_f.read() - # target_f.close() - # print 'EOF' - # else: - # mathlibs = [] - # target_f = open(target) - # for line in target_f.readlines(): - # s = '#define MATHLIB' - # if line.startswith(s): - # value = line[len(s):].strip() - # if value: - # mathlibs.extend(value.split(',')) - # target_f.close() - - # ext.libraries.extend(mathlibs) - - # incl_dir = os.path.dirname(target) - # if incl_dir not in config.numpy_include_dirs: - # config.numpy_include_dirs.append(incl_dir) - - # config.add_data_files((header_dir,target)) - # return target - - #def generate_api_func(module_name): - # def generate_api(ext, build_dir): - # script = join(codegen_dir, module_name + '.py') - # sys.path.insert(0, codegen_dir) - # try: - # m = __import__(module_name) - # log.info('executing %s', script) - # h_file, c_file, doc_file = m.generate_api(build_dir) - # finally: - # del sys.path[0] - # config.add_data_files((header_dir, h_file), - # (header_dir, doc_file)) - # return (h_file,) - # return generate_api - - #generate_array_api = generate_api_func('generate_array_api') - #generate_ufunc_api = generate_api_func('generate_ufunc_api') - - #def generate_umath_c(ext,build_dir): - # target = join(build_dir,'__umath_generated.c') - # script = generate_umath_py - # if newer(script,target): - # f = open(target,'w') - # f.write(generate_umath.make_code(generate_umath.defdict, - # generate_umath.__file__)) - # f.close() - # return [] - - # Add generated files to distutils... - #print dir(config) - #print config.get_build_temp_dir() - #config_header = os.path.dirname( - # incl_dir = os.path.dirname(target) - # if incl_dir not in config.numpy_include_dirs: - # config.numpy_include_dirs.append(incl_dir) - - # config.add_data_files((header_dir,target)) config.add_data_files('include/numpy/*.h') config.add_include_dirs('src') @@ -198,15 +62,15 @@ if sys.platform == 'cygwin': config.add_data_dir('include/numpy/fenv') - # Configure blasdot - blas_info = get_info('blas_opt',0) - #blas_info = {} - def get_dotblas_sources(ext, build_dir): - if blas_info: - if ('NO_ATLAS_INFO',1) in blas_info.get('define_macros',[]): - return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient. - return ext.depends[:1] - return None # no extension module will be built + # # Configure blasdot + # blas_info = get_info('blas_opt',0) + # #blas_info = {} + # def get_dotblas_sources(ext, build_dir): + # if blas_info: + # if ('NO_ATLAS_INFO',1) in blas_info.get('define_macros',[]): + # return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient. + # return ext.depends[:1] + # return None # no extension module will be built config.add_data_dir('tests') config.make_svn_version_py() @@ -223,72 +87,6 @@ } """ -# import sys -# def generate_testcode(target): -# if sys.platform == 'win32': -# target = target.replace('\\','\\\\') -# testcode = [r''' -# #include -# #include -# #include -# -# int main(int argc, char **argv) -# { -# -# FILE *fp; -# -# fp = fopen("'''+target+'''","w"); -# '''] -# -# c_size_test = r''' -# #ifndef %(sz)s -# fprintf(fp,"#define %(sz)s %%d\n", sizeof(%(type)s)); -# #else -# fprintf(fp,"/* #define %(sz)s %%d */\n", %(sz)s); -# #endif -# ''' -# for sz, t in [('SIZEOF_SHORT', 'short'), -# ('SIZEOF_INT', 'int'), -# ('SIZEOF_LONG', 'long'), -# ('SIZEOF_FLOAT', 'float'), -# ('SIZEOF_DOUBLE', 'double'), -# ('SIZEOF_LONG_DOUBLE', 'long double'), -# ('SIZEOF_PY_INTPTR_T', 'Py_intptr_t'), -# ]: -# testcode.append(c_size_test % {'sz' : sz, 'type' : t}) -# -# testcode.append('#ifdef PY_LONG_LONG') -# testcode.append(c_size_test % {'sz' : 'SIZEOF_LONG_LONG', -# 'type' : 'PY_LONG_LONG'}) -# testcode.append(c_size_test % {'sz' : 'SIZEOF_PY_LONG_LONG', -# 'type' : 'PY_LONG_LONG'}) -# -# -# testcode.append(r''' -# #else -# fprintf(fp, "/* PY_LONG_LONG not defined */\n"); -# #endif -# #ifndef CHAR_BIT -# { -# unsigned char var = 2; -# int i=0; -# while (var >= 2) { -# var = var << 1; -# i++; -# } -# fprintf(fp,"#define CHAR_BIT %d\n", i+1); -# } -# #else -# fprintf(fp, "/* #define CHAR_BIT %d */\n", CHAR_BIT); -# #endif -# fclose(fp); -# return 0; -# } -# ''') -# testcode = '\n'.join(testcode) -# return testcode - if __name__=='__main__': from numpy.distutils.core import setup setup(configuration=configuration) - Modified: branches/numpy.scons/numpy/random/setupscons.py =================================================================== --- branches/numpy.scons/numpy/random/setupscons.py 2007-10-15 09:39:33 UTC (rev 4198) +++ branches/numpy.scons/numpy/random/setupscons.py 2007-10-15 09:40:03 UTC (rev 4199) @@ -9,7 +9,9 @@ if top_path is None: libs = get_mathlibs() else: - path = join(split(build_dir)[0],'core') + #path = join(split(build_dir)[0],'core') + # XXX + path = join(config.get_scons_build_dir(), 'numpy','core') libs = get_mathlibs(path) tc = testcode_wincrypt() if config_cmd.try_run(tc): Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-10-15 09:39:33 UTC (rev 4198) +++ branches/numpy.scons/test.sh 2007-10-15 09:40:03 UTC (rev 4199) @@ -3,6 +3,5 @@ rm -rf $PREFIX python setupscons.py scons python setupscons.py build -#--prefix=$PREFIX -##python setup.py install --prefix=$PREFIX -#(cd $PREFIX && PYTHONPATH=$PREFIX/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") +python setupscons.py install --prefix=$PREFIX +(cd $PREFIX && PYTHONPATH=$PREFIX/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") From numpy-svn at scipy.org Mon Oct 15 05:40:38 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 04:40:38 -0500 (CDT) Subject: [Numpy-svn] r4200 - in branches/numpy.scons: . numpy/distutils/command Message-ID: <20071015094038.83E6F39C0F9@new.scipy.org> Author: cdavid Date: 2007-10-15 04:40:26 -0500 (Mon, 15 Oct 2007) New Revision: 4200 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/command/build.py branches/numpy.scons/numpy/distutils/command/build_ext.py Log: Make sure scons is called before build command Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 18:00:09.984999895 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 18:07:57.341000080 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb Modified: branches/numpy.scons/numpy/distutils/command/build.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/build.py 2007-10-15 09:40:03 UTC (rev 4199) +++ branches/numpy.scons/numpy/distutils/command/build.py 2007-10-15 09:40:26 UTC (rev 4200) @@ -32,3 +32,9 @@ if build_scripts is None: self.build_scripts = os.path.join(self.build_base, 'scripts' + plat_specifier) + + def run(self): + # Make sure that scons based extensions are complete. + self.run_command('scons') + + old_build.run() Modified: branches/numpy.scons/numpy/distutils/command/build_ext.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/build_ext.py 2007-10-15 09:40:03 UTC (rev 4199) +++ branches/numpy.scons/numpy/distutils/command/build_ext.py 2007-10-15 09:40:26 UTC (rev 4200) @@ -62,9 +62,6 @@ else: build_clib = None - # Make sure that scons based extensions are complete. - self.run_command('scons') - # Not including C libraries to the list of # extension libraries automatically to prevent # bogus linking commands. Extensions must From numpy-svn at scipy.org Mon Oct 15 05:40:58 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 04:40:58 -0500 (CDT) Subject: [Numpy-svn] r4201 - in branches/numpy.scons: . numpy/distutils/command Message-ID: <20071015094058.407F939C0F9@new.scipy.org> Author: cdavid Date: 2007-10-15 04:40:46 -0500 (Mon, 15 Oct 2007) New Revision: 4201 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/command/scons.py Log: Add a job options to scons command, for parallel builds Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 18:07:57.341000080 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 18:29:38.591000080 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-15 09:40:26 UTC (rev 4200) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-15 09:40:46 UTC (rev 4201) @@ -84,13 +84,13 @@ # release. # XXX: add an option to the scons command for configuration (auto/force/cache). description = "Scons builder" - #user_options = [] - user_options = [('fcompiler=', None, "specify the Fortran compiler type"), - ('compiler=', None, "specify the C compiler type")] + user_options = old_build_ext.user_options + [ + ('jobs=', None, + "specify number of worker threads when executing scons"),] def initialize_options(self): old_build_ext.initialize_options(self) - pass + self.jobs = None def finalize_options(self): old_build_ext.finalize_options(self) @@ -135,6 +135,8 @@ post_hook() # XXX: This is inefficient... (use join instead) cmd = scons_exec + " -f " + sconscript + ' -I. ' + if self.jobs: + cmd += " --jobs=%d " % int(self.jobs) cmd += ' src_dir="%s" ' % pdirname(sconscript) cmd += ' distutils_libdir=%s ' % protect_path(pjoin(self.build_lib, pdirname(sconscript))) From numpy-svn at scipy.org Mon Oct 15 05:54:22 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 04:54:22 -0500 (CDT) Subject: [Numpy-svn] r4202 - in branches/numpy.scons: . numpy/distutils/command Message-ID: <20071015095422.541A339C0EB@new.scipy.org> Author: cdavid Date: 2007-10-15 04:54:12 -0500 (Mon, 15 Oct 2007) New Revision: 4202 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/command/build.py Log: Fix the class function not called with self in build command Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 18:29:38.591000080 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 18:44:20.539999962 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj Modified: branches/numpy.scons/numpy/distutils/command/build.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/build.py 2007-10-15 09:40:46 UTC (rev 4201) +++ branches/numpy.scons/numpy/distutils/command/build.py 2007-10-15 09:54:12 UTC (rev 4202) @@ -37,4 +37,4 @@ # Make sure that scons based extensions are complete. self.run_command('scons') - old_build.run() + old_build.run(self) From numpy-svn at scipy.org Mon Oct 15 07:05:29 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 06:05:29 -0500 (CDT) Subject: [Numpy-svn] r4203 - in branches/numpy.scons: . numpy/distutils/command Message-ID: <20071015110529.EAB9339C1BD@new.scipy.org> Author: cdavid Date: 2007-10-15 06:05:12 -0500 (Mon, 15 Oct 2007) New Revision: 4203 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/distutils/command/scons.py Log: Actually execectute post_hook after executing scons Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 18:44:20.539999962 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 19:00:09.647000074 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj 3821 david at ar.media.kyoto-u.ac.jp-20071015100009-rd9c4p6pxk3ambj6 Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-15 09:54:12 UTC (rev 4202) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-15 11:05:12 UTC (rev 4203) @@ -131,8 +131,6 @@ scons_exec = get_python_exec_invoc() scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py')) for sconscript, pre_hook, post_hook in self.scons_scripts: - if post_hook: - post_hook() # XXX: This is inefficient... (use join instead) cmd = scons_exec + " -f " + sconscript + ' -I. ' if self.jobs: @@ -147,3 +145,5 @@ print "status is %d" % st raise DistutilsExecError("Error while executing scons command "\ "%s (see above)" % cmd) + if post_hook: + post_hook() From numpy-svn at scipy.org Mon Oct 15 07:05:56 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 06:05:56 -0500 (CDT) Subject: [Numpy-svn] r4204 - in branches/numpy.scons: . numpy/core Message-ID: <20071015110556.C874739C05E@new.scipy.org> Author: cdavid Date: 2007-10-15 06:05:38 -0500 (Mon, 15 Oct 2007) New Revision: 4204 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/scons_support.py branches/numpy.scons/numpy/core/setupscons.py Log: Add a scons checker for broken math libs Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 19:00:09.647000074 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 19:13:36.970000029 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj 3821 david at ar.media.kyoto-u.ac.jp-20071015100009-rd9c4p6pxk3ambj6 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj 3821 david at ar.media.kyoto-u.ac.jp-20071015100009-rd9c4p6pxk3ambj6 3822 david at ar.media.kyoto-u.ac.jp-20071015101336-2p0h5e17hcgrfs0e Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-15 11:05:12 UTC (rev 4203) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-15 11:05:38 UTC (rev 4204) @@ -1,8 +1,9 @@ -# Last Change: Mon Oct 15 05:00 PM 2007 J +# Last Change: Mon Oct 15 07:00 PM 2007 J # vim:syntax=python import os from os.path import join as pjoin, basename as pbasename, dirname as pdirname import sys +from copy import deepcopy from numpy.distutils.scons import get_python_inc from numpy.distutils.scons import GetNumpyEnvironment, CheckTypeSize @@ -73,8 +74,37 @@ #else: # config_sym.append(('NPY_ALLOW_THREADS', '1')) +def CheckBrokenMathlib(context, mathlib): + src = """ +/* check whether libm is broken */ +#include +int main(int argc, char *argv[]) +{ + return exp(-720.) > 1.0; /* typically an IEEE denormal */ +} +""" + + try: + oldLIBS = deepcopy(context.env['LIBS']) + except: + oldLIBS = [] + + try: + context.Message("Checking if math lib %s is broken ... " % mathlib) + context.env.AppendUnique(LIBS = mathlib) + st = context.TryRun(src, '.c') + finally: + env['LIBS'] = oldLIBS + + if st[0]: + context.Result(' not broken !') + else: + context.Result(' broken ! (output is %s)' % st[1]) + return st[0] + env.Append(CPPPATH = [get_python_inc()]) -config = env.NumpyConfigure(custom_tests = {'CheckTypeSize' : CheckTypeSize}) +config = env.NumpyConfigure(custom_tests = {'CheckTypeSize' : CheckTypeSize, + 'CheckBrokenMathlib' : CheckBrokenMathlib}) # TODO: check python extension can be built (in root or here ?) @@ -147,6 +177,9 @@ for f in mfuncs[1:]: check_lib(f) +# What are we supposed to do if the math lib is broken ? +config.CheckBrokenMathlib(mlib) + #-------------- # Checking Blas #-------------- @@ -236,14 +269,14 @@ umath = env.GenerateUmath(pjoin(env['build_dir'], '__umath_generated'), pjoin(env['src_dir'], 'code_generators', 'generate_umath.py')) -multiarray_api = env.GenerateApi(pjoin(env['build_dir'], '__multiarray_api'), +multiarray_api = env.GenerateApi(pjoin(env['build_dir'], 'multiarray_api'), [pjoin(env['src_dir'], 'code_generators', 'array_api_order.txt'), pjoin(env['src_dir'], 'code_generators', 'multiarray_api_order.txt')]) -ufunc_api = env.GenerateUfuncApi(pjoin(env['build_dir'], '__ufunc_api'), +ufunc_api = env.GenerateUfuncApi(pjoin(env['build_dir'], 'ufunc_api'), pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt')) # XXX -#env.Append(CCFLAGS = "-Wall -O2") +env.Append(CCFLAGS = "-Wall -O2") #----------------- # Build multiarray Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-10-15 11:05:12 UTC (rev 4203) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-15 11:05:38 UTC (rev 4204) @@ -1,3 +1,5 @@ +from os.path import join as pjoin, dirname as pdirname, basename as pbasename + from code_generators.generate_array_api import \ types, h_template as multiarray_h_template, \ c_template as multiarray_c_template @@ -97,9 +99,12 @@ def generate_api_emitter(target, source, env): """Returns the list of targets generated by the code generator for array api.""" base, ext = SCons.Util.splitext(str(target[0])) - h = base + '.h' - c = base + '.c' + dir = pdirname(base) + ba = pbasename(base) + h = pjoin(dir, '__' + ba + '.h') + c = pjoin(dir, '__' + ba + '.c') txt = base + '.txt' + print h, c, txt t = [h, c, txt] return (t, source) Modified: branches/numpy.scons/numpy/core/setupscons.py =================================================================== --- branches/numpy.scons/numpy/core/setupscons.py 2007-10-15 11:05:12 UTC (rev 4203) +++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-15 11:05:38 UTC (rev 4204) @@ -32,7 +32,7 @@ # between scons and distutils, and set the options at one single # location. h_file = join(scons_build_dir, local_dir, '__multiarray_api.h') - t_file = join(scons_build_dir, local_dir, '__multiarray_api.txt') + t_file = join(scons_build_dir, local_dir, 'multiarray_api.txt') config.add_data_files((header_dir, h_file), (header_dir, t_file)) @@ -42,7 +42,7 @@ # between scons and distutils, and set the options at one single # location. h_file = join(scons_build_dir, local_dir, '__ufunc_api.h') - t_file = join(scons_build_dir, local_dir, '__ufunc_api.txt') + t_file = join(scons_build_dir, local_dir, 'ufunc_api.txt') config.add_data_files((header_dir, h_file), (header_dir, t_file)) @@ -77,16 +77,6 @@ return config -def testcode_mathlib(): - return """\ -/* check whether libm is broken */ -#include -int main(int argc, char *argv[]) -{ - return exp(-720.) > 1.0; /* typically an IEEE denormal */ -} -""" - if __name__=='__main__': from numpy.distutils.core import setup setup(configuration=configuration) From numpy-svn at scipy.org Mon Oct 15 07:06:14 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 06:06:14 -0500 (CDT) Subject: [Numpy-svn] r4205 - in branches/numpy.scons: . numpy/core Message-ID: <20071015110614.8A9E839C05E@new.scipy.org> Author: cdavid Date: 2007-10-15 06:06:04 -0500 (Mon, 15 Oct 2007) New Revision: 4205 Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct Log: trivial fix Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 19:13:36.970000029 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-15 19:16:35.375999928 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj 3821 david at ar.media.kyoto-u.ac.jp-20071015100009-rd9c4p6pxk3ambj6 3822 david at ar.media.kyoto-u.ac.jp-20071015101336-2p0h5e17hcgrfs0e + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj 3821 david at ar.media.kyoto-u.ac.jp-20071015100009-rd9c4p6pxk3ambj6 3822 david at ar.media.kyoto-u.ac.jp-20071015101336-2p0h5e17hcgrfs0e 3823 david at ar.media.kyoto-u.ac.jp-20071015101635-yzf6n91w8da7hzj5 Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-15 11:05:38 UTC (rev 4204) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-15 11:06:04 UTC (rev 4205) @@ -99,7 +99,7 @@ if st[0]: context.Result(' not broken !') else: - context.Result(' broken ! (output is %s)' % st[1]) + context.Result(' broken !') return st[0] env.Append(CPPPATH = [get_python_inc()]) @@ -153,8 +153,6 @@ ] # TODO: getting the math lib automatically ? Having a list ? -# TODO: test for broken m lib -# TODO: do not add the lib everytime... (autoadd option) # TODO: checklib vs checkfunc ? mathlib = os.environ.get('MATHLIB') if mathlib: @@ -177,7 +175,7 @@ for f in mfuncs[1:]: check_lib(f) -# What are we supposed to do if the math lib is broken ? +# XXX: What are we supposed to do if the math lib is broken ? config.CheckBrokenMathlib(mlib) #-------------- From numpy-svn at scipy.org Mon Oct 15 11:51:41 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 15 Oct 2007 10:51:41 -0500 (CDT) Subject: [Numpy-svn] r4206 - in branches/numpy.scons: . numpy/distutils/scons Message-ID: <20071015155141.8C56439C1C9@new.scipy.org> Author: cdavid Date: 2007-10-15 10:51:30 -0500 (Mon, 15 Oct 2007) New Revision: 4206 Added: branches/numpy.scons/numpy/distutils/scons/TODO Modified: branches/numpy.scons/ Log: Add a TODO for sconsification Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-15 19:16:35.375999928 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-16 00:50:42.243999958 +0900 committer: david properties: branch-nick: numpy.scons Name: bzr:file-ids - + numpy/distutils/scons/TODO todo-20071015155023-uavr2182sewdg6lv-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj 3821 david at ar.media.kyoto-u.ac.jp-20071015100009-rd9c4p6pxk3ambj6 3822 david at ar.media.kyoto-u.ac.jp-20071015101336-2p0h5e17hcgrfs0e 3823 david at ar.media.kyoto-u.ac.jp-20071015101635-yzf6n91w8da7hzj5 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj 3821 david at ar.media.kyoto-u.ac.jp-20071015100009-rd9c4p6pxk3ambj6 3822 david at ar.media.kyoto-u.ac.jp-20071015101336-2p0h5e17hcgrfs0e 3823 david at ar.media.kyoto-u.ac.jp-20071015101635-yzf6n91w8da7hzj5 3824 david at david-laptop-20071015155042-qww4ma06z65dneda Added: branches/numpy.scons/numpy/distutils/scons/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-15 11:06:04 UTC (rev 4205) +++ branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-15 15:51:30 UTC (rev 4206) @@ -0,0 +1,26 @@ +Checker: + - improve CheckTypeSize for upstream integration + - improve Fortran runtime detection for upstream integration + - improve Fortran mangling and dummy main detection for upstream + integration + - Blas/Lapack check + - Atlas check + +Builder: + - Get a PythonExtension builder independant of distutils for upstream + integration + - Get a CtypesExtension builder independant of distutils for upstream + integration + - Generic Api builders (with dep tracking) + - Generic FromTemplate builder (with dep tracking) + +Implementation details: + - Default optim, warn and link flags for python extension on at least gcc, + g77, gfortran (1st priority), MS and Intel (2d priority), others (3rd: + sun, aix, etc...) + - Refactor code for API generation (numpy/core/code_generators) + +Documentation: + - scons / distutils integration + - global design (BuildDir, directories, etc...) + - package developers documentation From numpy-svn at scipy.org Tue Oct 16 01:16:52 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 16 Oct 2007 00:16:52 -0500 (CDT) Subject: [Numpy-svn] r4207 - branches/numpy.scons Message-ID: <20071016051652.7B47A39C016@new.scipy.org> Author: cdavid Date: 2007-10-16 00:16:41 -0500 (Tue, 16 Oct 2007) New Revision: 4207 Added: branches/numpy.scons/setup.old.py branches/numpy.scons/setup.py Removed: branches/numpy.scons/setup.py branches/numpy.scons/setupscons.py Modified: branches/numpy.scons/ Log: Move setupscons.py to setup.py so that buildbot can be used for testing Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-16 00:50:42.243999958 +0900 committer: david properties: branch-nick: numpy.scons + timestamp: 2007-10-16 14:05:31.012000084 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:file-ids - numpy/distutils/scons/TODO todo-20071015155023-uavr2182sewdg6lv-1 + setup.old.py 462 at 94b884b6-d6fd-0310-90d3-974f1d3f35e1:trunk:setup.py setup.py setupscons.py-20071012073152-5cjw0f21wjrronpp-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj 3821 david at ar.media.kyoto-u.ac.jp-20071015100009-rd9c4p6pxk3ambj6 3822 david at ar.media.kyoto-u.ac.jp-20071015101336-2p0h5e17hcgrfs0e 3823 david at ar.media.kyoto-u.ac.jp-20071015101635-yzf6n91w8da7hzj5 3824 david at david-laptop-20071015155042-qww4ma06z65dneda + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj 3821 david at ar.media.kyoto-u.ac.jp-20071015100009-rd9c4p6pxk3ambj6 3822 david at ar.media.kyoto-u.ac.jp-20071015101336-2p0h5e17hcgrfs0e 3823 david at ar.media.kyoto-u.ac.jp-20071015101635-yzf6n91w8da7hzj5 3824 david at david-laptop-20071015155042-qww4ma06z65dneda 3825 david at ar.media.kyoto-u.ac.jp-20071016050531-6xoms5d8ygwpp2m8 Copied: branches/numpy.scons/setup.old.py (from rev 4206, branches/numpy.scons/setup.py) =================================================================== --- branches/numpy.scons/setup.py 2007-10-15 15:51:30 UTC (rev 4206) +++ branches/numpy.scons/setup.old.py 2007-10-16 05:16:41 UTC (rev 4207) @@ -0,0 +1,90 @@ +#!/usr/bin/env python +"""NumPy: array processing for numbers, strings, records, and objects. + +NumPy is a general-purpose array-processing package designed to +efficiently manipulate large multi-dimensional arrays of arbitrary +records without sacrificing too much speed for small multi-dimensional +arrays. NumPy is built on the Numeric code base and adds features +introduced by numarray as well as an extended C-API and the ability to +create arrays of arbitrary type which also makes NumPy suitable for +interfacing with general-purpose data-base applications. + +There are also basic facilities for discrete fourier transform, +basic linear algebra and random number generation. +""" + +DOCLINES = __doc__.split("\n") + +import os +import sys + +CLASSIFIERS = """\ +Development Status :: 4 - Beta +Intended Audience :: Science/Research +Intended Audience :: Developers +License :: OSI Approved +Programming Language :: C +Programming Language :: Python +Topic :: Software Development +Topic :: Scientific/Engineering +Operating System :: Microsoft :: Windows +Operating System :: POSIX +Operating System :: Unix +Operating System :: MacOS +""" + +# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly +# update it when the contents of directories change. +if os.path.exists('MANIFEST'): os.remove('MANIFEST') + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + + config = Configuration(None, parent_package, top_path) + config.set_options(ignore_setup_xxx_py=True, + assume_default_configuration=True, + delegate_options_to_subpackages=True, + quiet=True) + + config.add_subpackage('numpy') + + config.add_data_files(('numpy','*.txt'), + ('numpy','COMPATIBILITY'), + ('numpy','scipy_compatibility'), + ('numpy','site.cfg.example')) + + config.get_version('numpy/version.py') # sets config.version + + return config + +def setup_package(): + + from numpy.distutils.core import setup + + old_path = os.getcwd() + local_path = os.path.dirname(os.path.abspath(sys.argv[0])) + os.chdir(local_path) + sys.path.insert(0,local_path) + + try: + setup( + name = 'numpy', + maintainer = "NumPy Developers", + maintainer_email = "numpy-discussion at lists.sourceforge.net", + description = DOCLINES[0], + long_description = "\n".join(DOCLINES[2:]), + url = "http://numeric.scipy.org", + download_url = "http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103", + license = 'BSD', + classifiers=filter(None, CLASSIFIERS.split('\n')), + author = "Travis E. Oliphant, et.al.", + author_email = "oliphant at ee.byu.edu", + platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], + configuration=configuration ) + finally: + del sys.path[0] + os.chdir(old_path) + return + +if __name__ == '__main__': + setup_package() Deleted: branches/numpy.scons/setup.py =================================================================== --- branches/numpy.scons/setup.py 2007-10-15 15:51:30 UTC (rev 4206) +++ branches/numpy.scons/setup.py 2007-10-16 05:16:41 UTC (rev 4207) @@ -1,90 +0,0 @@ -#!/usr/bin/env python -"""NumPy: array processing for numbers, strings, records, and objects. - -NumPy is a general-purpose array-processing package designed to -efficiently manipulate large multi-dimensional arrays of arbitrary -records without sacrificing too much speed for small multi-dimensional -arrays. NumPy is built on the Numeric code base and adds features -introduced by numarray as well as an extended C-API and the ability to -create arrays of arbitrary type which also makes NumPy suitable for -interfacing with general-purpose data-base applications. - -There are also basic facilities for discrete fourier transform, -basic linear algebra and random number generation. -""" - -DOCLINES = __doc__.split("\n") - -import os -import sys - -CLASSIFIERS = """\ -Development Status :: 4 - Beta -Intended Audience :: Science/Research -Intended Audience :: Developers -License :: OSI Approved -Programming Language :: C -Programming Language :: Python -Topic :: Software Development -Topic :: Scientific/Engineering -Operating System :: Microsoft :: Windows -Operating System :: POSIX -Operating System :: Unix -Operating System :: MacOS -""" - -# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly -# update it when the contents of directories change. -if os.path.exists('MANIFEST'): os.remove('MANIFEST') - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - - config = Configuration(None, parent_package, top_path) - config.set_options(ignore_setup_xxx_py=True, - assume_default_configuration=True, - delegate_options_to_subpackages=True, - quiet=True) - - config.add_subpackage('numpy') - - config.add_data_files(('numpy','*.txt'), - ('numpy','COMPATIBILITY'), - ('numpy','scipy_compatibility'), - ('numpy','site.cfg.example')) - - config.get_version('numpy/version.py') # sets config.version - - return config - -def setup_package(): - - from numpy.distutils.core import setup - - old_path = os.getcwd() - local_path = os.path.dirname(os.path.abspath(sys.argv[0])) - os.chdir(local_path) - sys.path.insert(0,local_path) - - try: - setup( - name = 'numpy', - maintainer = "NumPy Developers", - maintainer_email = "numpy-discussion at lists.sourceforge.net", - description = DOCLINES[0], - long_description = "\n".join(DOCLINES[2:]), - url = "http://numeric.scipy.org", - download_url = "http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103", - license = 'BSD', - classifiers=filter(None, CLASSIFIERS.split('\n')), - author = "Travis E. Oliphant, et.al.", - author_email = "oliphant at ee.byu.edu", - platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], - configuration=configuration ) - finally: - del sys.path[0] - os.chdir(old_path) - return - -if __name__ == '__main__': - setup_package() Copied: branches/numpy.scons/setup.py (from rev 4206, branches/numpy.scons/setupscons.py) =================================================================== --- branches/numpy.scons/setupscons.py 2007-10-15 15:51:30 UTC (rev 4206) +++ branches/numpy.scons/setup.py 2007-10-16 05:16:41 UTC (rev 4207) @@ -0,0 +1,90 @@ +#!/usr/bin/env python +"""NumPy: array processing for numbers, strings, records, and objects. + +NumPy is a general-purpose array-processing package designed to +efficiently manipulate large multi-dimensional arrays of arbitrary +records without sacrificing too much speed for small multi-dimensional +arrays. NumPy is built on the Numeric code base and adds features +introduced by numarray as well as an extended C-API and the ability to +create arrays of arbitrary type which also makes NumPy suitable for +interfacing with general-purpose data-base applications. + +There are also basic facilities for discrete fourier transform, +basic linear algebra and random number generation. +""" + +DOCLINES = __doc__.split("\n") + +import os +import sys + +CLASSIFIERS = """\ +Development Status :: 4 - Beta +Intended Audience :: Science/Research +Intended Audience :: Developers +License :: OSI Approved +Programming Language :: C +Programming Language :: Python +Topic :: Software Development +Topic :: Scientific/Engineering +Operating System :: Microsoft :: Windows +Operating System :: POSIX +Operating System :: Unix +Operating System :: MacOS +""" + +# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly +# update it when the contents of directories change. +if os.path.exists('MANIFEST'): os.remove('MANIFEST') + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + + config = Configuration(None, parent_package, top_path, setup_name = 'setupscons.py') + config.set_options(ignore_setup_xxx_py=True, + assume_default_configuration=True, + delegate_options_to_subpackages=True, + quiet=True) + + config.add_subpackage('numpy') + + config.add_data_files(('numpy','*.txt'), + ('numpy','COMPATIBILITY'), + ('numpy','scipy_compatibility'), + ('numpy','site.cfg.example')) + + config.get_version('numpy/version.py') # sets config.version + + return config + +def setup_package(): + + from numpy.distutils.core import setup + + old_path = os.getcwd() + local_path = os.path.dirname(os.path.abspath(sys.argv[0])) + os.chdir(local_path) + sys.path.insert(0,local_path) + + try: + setup( + name = 'numpy', + maintainer = "NumPy Developers", + maintainer_email = "numpy-discussion at lists.sourceforge.net", + description = DOCLINES[0], + long_description = "\n".join(DOCLINES[2:]), + url = "http://numeric.scipy.org", + download_url = "http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103", + license = 'BSD', + classifiers=filter(None, CLASSIFIERS.split('\n')), + author = "Travis E. Oliphant, et.al.", + author_email = "oliphant at ee.byu.edu", + platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], + configuration=configuration ) + finally: + del sys.path[0] + os.chdir(old_path) + return + +if __name__ == '__main__': + setup_package() Deleted: branches/numpy.scons/setupscons.py =================================================================== --- branches/numpy.scons/setupscons.py 2007-10-15 15:51:30 UTC (rev 4206) +++ branches/numpy.scons/setupscons.py 2007-10-16 05:16:41 UTC (rev 4207) @@ -1,90 +0,0 @@ -#!/usr/bin/env python -"""NumPy: array processing for numbers, strings, records, and objects. - -NumPy is a general-purpose array-processing package designed to -efficiently manipulate large multi-dimensional arrays of arbitrary -records without sacrificing too much speed for small multi-dimensional -arrays. NumPy is built on the Numeric code base and adds features -introduced by numarray as well as an extended C-API and the ability to -create arrays of arbitrary type which also makes NumPy suitable for -interfacing with general-purpose data-base applications. - -There are also basic facilities for discrete fourier transform, -basic linear algebra and random number generation. -""" - -DOCLINES = __doc__.split("\n") - -import os -import sys - -CLASSIFIERS = """\ -Development Status :: 4 - Beta -Intended Audience :: Science/Research -Intended Audience :: Developers -License :: OSI Approved -Programming Language :: C -Programming Language :: Python -Topic :: Software Development -Topic :: Scientific/Engineering -Operating System :: Microsoft :: Windows -Operating System :: POSIX -Operating System :: Unix -Operating System :: MacOS -""" - -# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly -# update it when the contents of directories change. -if os.path.exists('MANIFEST'): os.remove('MANIFEST') - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - - config = Configuration(None, parent_package, top_path, setup_name = 'setupscons.py') - config.set_options(ignore_setup_xxx_py=True, - assume_default_configuration=True, - delegate_options_to_subpackages=True, - quiet=True) - - config.add_subpackage('numpy') - - config.add_data_files(('numpy','*.txt'), - ('numpy','COMPATIBILITY'), - ('numpy','scipy_compatibility'), - ('numpy','site.cfg.example')) - - config.get_version('numpy/version.py') # sets config.version - - return config - -def setup_package(): - - from numpy.distutils.core import setup - - old_path = os.getcwd() - local_path = os.path.dirname(os.path.abspath(sys.argv[0])) - os.chdir(local_path) - sys.path.insert(0,local_path) - - try: - setup( - name = 'numpy', - maintainer = "NumPy Developers", - maintainer_email = "numpy-discussion at lists.sourceforge.net", - description = DOCLINES[0], - long_description = "\n".join(DOCLINES[2:]), - url = "http://numeric.scipy.org", - download_url = "http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103", - license = 'BSD', - classifiers=filter(None, CLASSIFIERS.split('\n')), - author = "Travis E. Oliphant, et.al.", - author_email = "oliphant at ee.byu.edu", - platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], - configuration=configuration ) - finally: - del sys.path[0] - os.chdir(old_path) - return - -if __name__ == '__main__': - setup_package() From numpy-svn at scipy.org Tue Oct 16 05:40:27 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 16 Oct 2007 04:40:27 -0500 (CDT) Subject: [Numpy-svn] r4208 - in branches/numpy.scons: . numpy/core Message-ID: <20071016094027.91F2539C105@new.scipy.org> Author: cdavid Date: 2007-10-16 04:40:17 -0500 (Tue, 16 Oct 2007) New Revision: 4208 Added: branches/numpy.scons/numpy/core/build_doc.txt Modified: branches/numpy.scons/ branches/numpy.scons/numpy/core/SConstruct Log: Add a build_doc to gather my current understanding on how the configuration and build of numpy.core is done. Property changes on: branches/numpy.scons ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2007-10-16 14:05:31.012000084 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons + timestamp: 2007-10-16 14:55:08.713000059 +0900 committer: David Cournapeau properties: branch-nick: numpy.scons Name: bzr:file-ids - setup.old.py 462 at 94b884b6-d6fd-0310-90d3-974f1d3f35e1:trunk:setup.py setup.py setupscons.py-20071012073152-5cjw0f21wjrronpp-1 + numpy/core/build_doc.txt build_doc.txt-20071016055442-x5ujdblb74i4ifyb-1 Name: bzr:revision-id:v3-trunk0 - 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj 3821 david at ar.media.kyoto-u.ac.jp-20071015100009-rd9c4p6pxk3ambj6 3822 david at ar.media.kyoto-u.ac.jp-20071015101336-2p0h5e17hcgrfs0e 3823 david at ar.media.kyoto-u.ac.jp-20071015101635-yzf6n91w8da7hzj5 3824 david at david-laptop-20071015155042-qww4ma06z65dneda 3825 david at ar.media.kyoto-u.ac.jp-20071016050531-6xoms5d8ygwpp2m8 + 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa 3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs 3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z 3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i 3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p 3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m 3744 david at david-laptop-20070922101656-61kfi2faucemr2rl 3745 david at david-laptop-20070922113708-ror18thshang1cpu 3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1 3749 david at david-laptop-20070922154007-usit009fr6vp377j 3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht 3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9 3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli 3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4 3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q 3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1 3756 david at david-laptop-20070924153247-yftud00bynilxv69 3757 david at david-laptop-20070924163545-pish34x9fq2h66aj 3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34 3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp 3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2 3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq 3769 david at david-laptop-20070925145952-4osi81tvch7v6luj 3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0 3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo 3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0 3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x 3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6 3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b 3779 david at david-laptop-20071009154954-v5se05gbq60opo1z 3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8 3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe 3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi 3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056 3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0 3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h 3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf 3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d 3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl 3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7 3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf 3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4 3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n 3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y 3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m 3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe 3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc 3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7 3805 david at david-laptop-20071014064841-liamaqiv3af71r3g 3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l 3807 david at david-laptop-20071014124401-n3a37y67u5imyo83 3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2 3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp 3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz 3811 david at ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80 3812 david at ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx 3813 david at ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi 3814 david at ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq 3815 david at ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x 3816 david at ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237 3817 david at ar.media.kyoto-u.ac.jp-20071015090009-545f5h9rwg4g8tyr 3818 david at ar.media.kyoto-u.ac.jp-20071015090757-nvuaubbge00snkbb 3819 david at ar.media.kyoto-u.ac.jp-20071015092938-job891na4f5fz0xn 3820 david at ar.media.kyoto-u.ac.jp-20071015094420-vb808flxq619lomj 3821 david at ar.media.kyoto-u.ac.jp-20071015100009-rd9c4p6pxk3ambj6 3822 david at ar.media.kyoto-u.ac.jp-20071015101336-2p0h5e17hcgrfs0e 3823 david at ar.media.kyoto-u.ac.jp-20071015101635-yzf6n91w8da7hzj5 3824 david at david-laptop-20071015155042-qww4ma06z65dneda 3825 david at ar.media.kyoto-u.ac.jp-20071016050531-6xoms5d8ygwpp2m8 3826 david at ar.media.kyoto-u.ac.jp-20071016055508-4of7r6y12hm62hor Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-16 05:16:41 UTC (rev 4207) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-16 09:40:17 UTC (rev 4208) @@ -1,4 +1,4 @@ -# Last Change: Mon Oct 15 07:00 PM 2007 J +# Last Change: Tue Oct 16 02:00 PM 2007 J # vim:syntax=python import os from os.path import join as pjoin, basename as pbasename, dirname as pdirname @@ -274,7 +274,7 @@ pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt')) # XXX -env.Append(CCFLAGS = "-Wall -O2") +#env.Append(CCFLAGS = "-Wall -O2") #----------------- # Build multiarray Added: branches/numpy.scons/numpy/core/build_doc.txt =================================================================== --- branches/numpy.scons/numpy/core/build_doc.txt 2007-10-16 05:16:41 UTC (rev 4207) +++ branches/numpy.scons/numpy/core/build_doc.txt 2007-10-16 09:40:17 UTC (rev 4208) @@ -0,0 +1,66 @@ +.. Last Change: Tue Oct 16 02:00 PM 2007 J +.. vim:syntax=rest + +This is some info I (David Cournapeau) have gathered so far on the +configuration and build of numpy.core + +Configuration header +==================== + +This is the most subtle issue: it is easy to mess things up here, and is +difficult to detect. The problem here is that a config.h should normaly only +contain #define, no #ifdef and so on. The ifdef should be handled somewhere +else, really. + +Thread config +------------- + +Python API defines a WITH_THREAD variable which says whether we should use +thread or not ourselves. Should implements a test, and defines NPY_ALLOW_THREAD +accordingly. Value depends on: + - WITH_THREAD (Python.h header) + - NPY_NOSMP (env variable) + +win32 specific +-------------- + +NPY_NO_SIGNAL: seems to depend only on platform (win32). +DISTUTILS_USE_SDK: for AMD64 arch on windows only ? + +Mathlib +------- + +List of libs sequence for math lib. + - is tested against denormal problems +If no working found: setup fails +If working: MATHLIB defines to the mathlib. + +PyOS_ascii_strtod +----------------- + +? + +Multiarray and ufunc api generators: +==================================== + +multiarray api -> in generate_array_api.py. The function should be redefined +such as it takes source files, and output a target. This can be done quite +easily. + +XXX: A better thing would be to merge the code for multiarray and ufunc +generators, but this looks difficult without breaking anything in non obvious +ways. + +umath generator: +================ + +XXX: How is this different than API generators above ? + +From template (*.src) builders +============================== + +The generator code resides in distutils. + +!!!! FROM_TEMPLATE AND CONV_TEMPLATE ARE DIFFERENT (C vs Fortran) !!!!! + +Those should be easy to wrap in a builder function. From numpy-svn at scipy.org Tue Oct 16 05:46:47 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 16 Oct 2007 04:46:47 -0500 (CDT) Subject: [Numpy-svn] r4209 - branches/numpy.scons/numpy/core/code_generators Message-ID: <20071016094647.A3CD439C105@new.scipy.org> Author: cdavid Date: 2007-10-16 04:46:43 -0500 (Tue, 16 Oct 2007) New Revision: 4209 Added: branches/numpy.scons/numpy/core/code_generators/__init__.py Log: Add __init__.py to make numpy.core.code_generators a proper python package Added: branches/numpy.scons/numpy/core/code_generators/__init__.py =================================================================== From numpy-svn at scipy.org Wed Oct 17 00:06:32 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 16 Oct 2007 23:06:32 -0500 (CDT) Subject: [Numpy-svn] r4210 - in trunk/numpy/core: src tests Message-ID: <20071017040632.274A539C0A9@new.scipy.org> Author: oliphant Date: 2007-10-16 23:06:29 -0500 (Tue, 16 Oct 2007) New Revision: 4210 Modified: trunk/numpy/core/src/ufuncobject.c trunk/numpy/core/tests/test_regression.py Log: Fix ticket #592: segfault with bitwise_or inplace Modified: trunk/numpy/core/src/ufuncobject.c =================================================================== --- trunk/numpy/core/src/ufuncobject.c 2007-10-16 09:46:43 UTC (rev 4209) +++ trunk/numpy/core/src/ufuncobject.c 2007-10-17 04:06:29 UTC (rev 4210) @@ -1344,7 +1344,8 @@ loop->meth = BUFFER_UFUNCLOOP; loop->needbuffer[i] = 1; } - if (!loop->obj && mps[i]->descr->type_num == PyArray_OBJECT) { + if (!loop->obj && ((mps[i]->descr->type_num == PyArray_OBJECT) || + (arg_types[i] == PyArray_OBJECT))) { loop->obj = 1; } } @@ -1486,7 +1487,7 @@ /* compute the element size */ for (i=0; inargs;i++) { - if (!loop->needbuffer) continue; + if (!loop->needbuffer[i]) continue; if (arg_types[i] != mps[i]->descr->type_num) { descr = PyArray_DescrFromType(arg_types[i]); if (loop->steps[i]) @@ -1913,6 +1914,7 @@ } /* cast to the other buffer if necessary */ if (loop->cast[i]) { + /* fprintf(stderr, "casting... %d, %p %p\n", i, buffer[i]); */ loop->cast[i](buffer[i], castbuf[i], (intp) datasize[i], @@ -1926,6 +1928,7 @@ for (i=self->nin; inargs; i++) { if (!needbuffer[i]) continue; if (loop->cast[i]) { + /* fprintf(stderr, "casting back... %d, %p", i, castbuf[i]); */ loop->cast[i](castbuf[i], buffer[i], (intp) datasize[i], Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2007-10-16 09:46:43 UTC (rev 4209) +++ trunk/numpy/core/tests/test_regression.py 2007-10-17 04:06:29 UTC (rev 4210) @@ -733,5 +733,12 @@ y2 = y[::-1] assert_equal(N.dot(x,z),N.dot(x,y2)) + def check_object_casting(self, level=rlevel): + def rs(): + x = N.ones([484,286]) + y = N.zeros([484,286]) + x |= y + self.failUnlessRaises(TypeError,rs) + if __name__ == "__main__": NumpyTest().run() From numpy-svn at scipy.org Wed Oct 17 22:47:03 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 17 Oct 2007 21:47:03 -0500 (CDT) Subject: [Numpy-svn] r4211 - branches Message-ID: <20071018024703.5C2BCC7C03D@new.scipy.org> Author: cdavid Date: 2007-10-17 21:46:56 -0500 (Wed, 17 Oct 2007) New Revision: 4211 Added: branches/cleanconfig/ Log: Create a branch cleanconfig to: * clean-up namespace to avoid clashes with standard autotools symbols * make separation between a private config header and public config header Copied: branches/cleanconfig (from rev 4210, trunk) From numpy-svn at scipy.org Wed Oct 17 22:57:33 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 17 Oct 2007 21:57:33 -0500 (CDT) Subject: [Numpy-svn] r4212 - in branches/cleanconfig/numpy/core: . include/numpy Message-ID: <20071018025733.33BEA39C15F@new.scipy.org> Author: cdavid Date: 2007-10-17 21:57:25 -0500 (Wed, 17 Oct 2007) New Revision: 4212 Modified: branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h branches/cleanconfig/numpy/core/setup.py Log: Refactor the NPY_ALLOW_THREAD logic outside config.h generation, and put it inside numpy headers Modified: branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h =================================================================== --- branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 02:46:56 UTC (rev 4211) +++ branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 02:57:25 UTC (rev 4212) @@ -15,6 +15,14 @@ /* This is auto-generated by the installer */ #include "config.h" +/* Only use thread if configured in config and python supports it */ +#if defined WITH_THREAD && !NPY_NOSMP + #define NPY_ALLOW_THREADS 1 +#else + #define NPY_ALLOW_THREADS 0 + #error FLOUPI +#endif + /* There are several places in the code where an array of dimensions is * allocated statically. This is the size of that static allocation. * Modified: branches/cleanconfig/numpy/core/setup.py =================================================================== --- branches/cleanconfig/numpy/core/setup.py 2007-10-18 02:46:56 UTC (rev 4211) +++ branches/cleanconfig/numpy/core/setup.py 2007-10-18 02:57:25 UTC (rev 4212) @@ -73,8 +73,7 @@ nosmp = 1 except KeyError: nosmp = 0 - if nosmp: moredefs = [('NPY_ALLOW_THREADS', '0')] - else: moredefs = [] + moredefs = [] # mathlibs = [] tc = testcode_mathlib() @@ -123,8 +122,12 @@ target_f.write('#define %s\n' % (d)) else: target_f.write('#define %s %s\n' % (d[0],d[1])) - if not nosmp: # default is to use WITH_THREAD - target_f.write('#ifdef WITH_THREAD\n#define NPY_ALLOW_THREADS 1\n#else\n#define NPY_ALLOW_THREADS 0\n#endif\n') + # Define NPY_NOSMP to 1 if explicitely requested, or if we cannot + # support thread support reliably + if nosmp: + target_f.write('#define NPY_NOSMP 1\n') + else: + target_f.write('#define NPY_NOSMP 0\n') target_f.close() print 'File:',target target_f = open(target) From numpy-svn at scipy.org Wed Oct 17 23:10:28 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 17 Oct 2007 22:10:28 -0500 (CDT) Subject: [Numpy-svn] r4213 - branches/cleanconfig/numpy/core/include/numpy Message-ID: <20071018031028.849F739C087@new.scipy.org> Author: cdavid Date: 2007-10-17 22:10:24 -0500 (Wed, 17 Oct 2007) New Revision: 4213 Modified: branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h Log: Prepend by NPY all SIZEOF_ symbols defined by config.h, to avoid namespace pollution from numpy public header Modified: branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h =================================================================== --- branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 02:57:25 UTC (rev 4212) +++ branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 03:10:24 UTC (rev 4213) @@ -88,7 +88,18 @@ #define NPY_FALSE 0 #define NPY_TRUE 1 -#if SIZEOF_LONG_DOUBLE==SIZEOF_DOUBLE +#define NPY_SIZEOF_LONG SIZEOF_LONG +#define NPY_SIZEOF_INT SIZEOF_INT +#define NPY_SIZEOF_SHORT SIZEOF_SHORT +#define NPY_SIZEOF_FLOAT SIZEOF_FLOAT +#define NPY_SIZEOF_DOUBLE SIZEOF_DOUBLE +#define NPY_SIZEOF_LONGDOUBLE SIZEOF_LONG_DOUBLE +#define NPY_SIZEOF_LONGLONG SIZEOF_LONG_LONG + +#define NPY_SIZEOF_PY_LONG_LONG SIZEOF_PY_LONG_LONG +#define NPY_SIZEOF_PY_INTPTR_T SIZEOF_PY_INTPTR_T + +#if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE typedef double npy_longdouble; #define NPY_LONGDOUBLE_FMT "g" #else @@ -287,22 +298,15 @@ #define NPY_MAX_ULONG ULONG_MAX -#define NPY_SIZEOF_LONG SIZEOF_LONG -#define NPY_SIZEOF_INT SIZEOF_INT -#define NPY_SIZEOF_SHORT SIZEOF_SHORT -#define NPY_SIZEOF_FLOAT SIZEOF_FLOAT -#define NPY_SIZEOF_DOUBLE SIZEOF_DOUBLE -#define NPY_SIZEOF_LONGDOUBLE SIZEOF_LONG_DOUBLE -#define NPY_SIZEOF_LONGLONG SIZEOF_LONG_LONG #define NPY_BITSOF_BOOL (sizeof(npy_bool)*CHAR_BIT) #define NPY_BITSOF_CHAR CHAR_BIT -#define NPY_BITSOF_SHORT (SIZEOF_SHORT*CHAR_BIT) -#define NPY_BITSOF_INT (SIZEOF_INT*CHAR_BIT) -#define NPY_BITSOF_LONG (SIZEOF_LONG*CHAR_BIT) -#define NPY_BITSOF_LONGLONG (NPY_SIZEOF_LONGLONG*CHAR_BIT) -#define NPY_BITSOF_FLOAT (SIZEOF_FLOAT*CHAR_BIT) -#define NPY_BITSOF_DOUBLE (SIZEOF_DOUBLE*CHAR_BIT) -#define NPY_BITSOF_LONGDOUBLE (NPY_SIZEOF_LONGDOUBLE*CHAR_BIT) +#define NPY_BITSOF_SHORT (NPY_SIZEOF_SHORT * CHAR_BIT) +#define NPY_BITSOF_INT (NPY_SIZEOF_INT * CHAR_BIT) +#define NPY_BITSOF_LONG (NPY_SIZEOF_LONG * CHAR_BIT) +#define NPY_BITSOF_LONGLONG (NPY_SIZEOF_LONGLONG * CHAR_BIT) +#define NPY_BITSOF_FLOAT (NPY_SIZEOF_FLOAT * CHAR_BIT) +#define NPY_BITSOF_DOUBLE (NPY_SIZEOF_DOUBLE * CHAR_BIT) +#define NPY_BITSOF_LONGDOUBLE (NPY_SIZEOF_LONGDOUBLE * CHAR_BIT) #if NPY_BITSOF_LONG == 8 #define NPY_INT8 NPY_LONG @@ -926,8 +930,8 @@ * platform. Py_intptr_t, Py_uintptr_t are defined in pyport.h. */ typedef Py_intptr_t npy_intp; typedef Py_uintptr_t npy_uintp; -#define NPY_SIZEOF_INTP SIZEOF_PY_INTPTR_T -#define NPY_SIZEOF_UINTP SIZEOF_PY_INTPTR_T +#define NPY_SIZEOF_INTP NPY_SIZEOF_PY_INTPTR_T +#define NPY_SIZEOF_UINTP NPY_NPY_SIZEOF_PY_INTPTR_T #ifdef constchar #undef constchar @@ -948,7 +952,7 @@ #define constchar char #endif -#if SIZEOF_PY_INTPTR_T == SIZEOF_INT +#if NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_INT #define NPY_INTP NPY_INT #define NPY_UINTP NPY_UINT #define PyIntpArrType_Type PyIntArrType_Type @@ -957,7 +961,7 @@ #define NPY_MIN_INTP NPY_MIN_INT #define NPY_MAX_UINTP NPY_MAX_UINT #define NPY_INTP_FMT "d" -#elif SIZEOF_PY_INTPTR_T == SIZEOF_LONG +#elif NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONGLONG #define NPY_INTP NPY_LONG #define NPY_UINTP NPY_ULONG #define PyIntpArrType_Type PyLongArrType_Type @@ -966,7 +970,7 @@ #define NPY_MIN_INTP MIN_LONG #define NPY_MAX_UINTP NPY_MAX_ULONG #define NPY_INTP_FMT "ld" -#elif defined(PY_LONG_LONG) && (SIZEOF_PY_INTPTR_T == SIZEOF_LONG_LONG) +#elif defined(PY_LONG_LONG) && (NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONGLONG) #define NPY_INTP NPY_LONGLONG #define NPY_UINTP NPY_ULONGLONG #define PyIntpArrType_Type PyLongLongArrType_Type @@ -1902,7 +1906,7 @@ #define PyArray_REFCOUNT(obj) (((PyObject *)(obj))->ob_refcnt) #define NPY_REFCOUNT PyArray_REFCOUNT -#define NPY_MAX_ELSIZE (2*SIZEOF_LONGDOUBLE) +#define NPY_MAX_ELSIZE (2 * NPY_SIZEOF_LONGDOUBLE) #define PyArray_ContiguousFromAny(op, type, min_depth, max_depth) \ PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \ From numpy-svn at scipy.org Wed Oct 17 23:15:49 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 17 Oct 2007 22:15:49 -0500 (CDT) Subject: [Numpy-svn] r4214 - branches/cleanconfig/numpy/core Message-ID: <20071018031549.3C08239C087@new.scipy.org> Author: cdavid Date: 2007-10-17 22:15:45 -0500 (Wed, 17 Oct 2007) New Revision: 4214 Modified: branches/cleanconfig/numpy/core/setup.py Log: Add a function to generate code for numpyconfig.h, meant to become the public configuration header. Modified: branches/cleanconfig/numpy/core/setup.py =================================================================== --- branches/cleanconfig/numpy/core/setup.py 2007-10-18 03:10:24 UTC (rev 4213) +++ branches/cleanconfig/numpy/core/setup.py 2007-10-18 03:15:45 UTC (rev 4214) @@ -18,6 +18,11 @@ ('rint', 'HAVE_RINT'), ] +def is_npy_no_signal(): + """Return True if the NPY_NO_SIGNAL symbol must be defined in configuration + header.""" + return sys.platform == 'win32' + def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration,dot_join from numpy.distutils.system_info import get_info, default_lib_dirs @@ -101,7 +106,7 @@ if check_func(func_name): moredefs.append(defsymbol) - if sys.platform == 'win32': + if is_npy_no_signal(): moredefs.append('NPY_NO_SIGNAL') if sys.platform=='win32' or os.name=='nt': @@ -345,6 +350,62 @@ testcode = '\n'.join(testcode) return testcode +def generate_numpyconfig_code(target): + """Return the source code as a string of the code to generate the + numpyconfig header file.""" + # Config symbols to prepend + prepends = [('NPY_SIZEOF_SHORT', 'SIZEOF_SHORT'), + ('NPY_SIZEOF_INT', 'SIZEOF_INT'), + ('NPY_SIZEOF_LONG', 'SIZEOF_LONG'), + ('NPY_SIZEOF_FLOAT', 'SIZEOF_FLOAT'), + ('NPY_SIZEOF_DOUBLE', 'SIZEOF_DOUBLE'), + ('NPY_SIZEOF_LONGDOUBLE', 'SIZEOF_LONG_DOUBLE'), + ('NPY_SIZEOF_PY_INTPTR_T', 'SIZEOF_PY_INTPTR_T'), + ('NPY_NOSMP', 'NPY_NOSMP'),] + + testcode = [""" +#include +#include "config.h" + +int main() +{ + FILE* f; + + f = fopen("%s", "w"); + if (f == NULL) { + return -1; + } +""" % target] + + testcode.append(r""" + fprintf(f, "/*\n * This file is generated by %s. DO NOT EDIT \n */\n"); +""" % __file__) + + # Prepend NPY_ to any SIZEOF defines + testcode.extend([r' fprintf(f, "#define ' + i + r' %%d \n", %s);' % j for i, j in prepends]) + + # Conditionally define NPY_NO_SIGNAL + if is_npy_no_signal(): + testcode.append(r' fprintf(f, "\n#define NPY_NO_SIGNAL\n");') + + tmpcode = r""" + #ifdef PY_LONG_LONG + fprintf(f, "\n#define %s %%d \n", %s); + fprintf(f, "#define %s %%d \n", %s); + #else + fprintf(f, "/* PY_LONG_LONG not defined */ \n"); + #endif""" + testcode.append(tmpcode % ('NPY_SIZEOF_LONGLONG', 'SIZEOF_LONG_LONG', + 'NPY_SIZEOF_PY_LONG_LONG', 'SIZEOF_PY_LONG_LONG')) + + testcode.append(""" + fclose(f); + + return 0; +} +""") + return "\n".join(testcode) + if __name__=='__main__': from numpy.distutils.core import setup setup(configuration=configuration) From numpy-svn at scipy.org Wed Oct 17 23:30:57 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 17 Oct 2007 22:30:57 -0500 (CDT) Subject: [Numpy-svn] r4215 - in branches/cleanconfig/numpy/core: . include/numpy src Message-ID: <20071018033057.1B8C839C087@new.scipy.org> Author: cdavid Date: 2007-10-17 22:30:47 -0500 (Wed, 17 Oct 2007) New Revision: 4215 Modified: branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h branches/cleanconfig/numpy/core/setup.py branches/cleanconfig/numpy/core/src/arraytypes.inc.src branches/cleanconfig/numpy/core/src/umathmodule.c.src Log: Split config.h into numpyconfig.h (public symbols) and config.h (private symbols) Modified: branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h =================================================================== --- branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 03:15:45 UTC (rev 4214) +++ branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 03:30:47 UTC (rev 4215) @@ -13,7 +13,7 @@ everything when you're typing */ #endif /* This is auto-generated by the installer */ -#include "config.h" +#include "numpyconfig.h" /* Only use thread if configured in config and python supports it */ #if defined WITH_THREAD && !NPY_NOSMP @@ -88,17 +88,7 @@ #define NPY_FALSE 0 #define NPY_TRUE 1 -#define NPY_SIZEOF_LONG SIZEOF_LONG -#define NPY_SIZEOF_INT SIZEOF_INT -#define NPY_SIZEOF_SHORT SIZEOF_SHORT -#define NPY_SIZEOF_FLOAT SIZEOF_FLOAT -#define NPY_SIZEOF_DOUBLE SIZEOF_DOUBLE -#define NPY_SIZEOF_LONGDOUBLE SIZEOF_LONG_DOUBLE -#define NPY_SIZEOF_LONGLONG SIZEOF_LONG_LONG -#define NPY_SIZEOF_PY_LONG_LONG SIZEOF_PY_LONG_LONG -#define NPY_SIZEOF_PY_INTPTR_T SIZEOF_PY_INTPTR_T - #if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE typedef double npy_longdouble; #define NPY_LONGDOUBLE_FMT "g" Modified: branches/cleanconfig/numpy/core/setup.py =================================================================== --- branches/cleanconfig/numpy/core/setup.py 2007-10-18 03:15:45 UTC (rev 4214) +++ branches/cleanconfig/numpy/core/setup.py 2007-10-18 03:30:47 UTC (rev 4215) @@ -159,6 +159,39 @@ config.add_data_files((header_dir,target)) return target + def generate_numpyconfig_h(ext, build_dir): + """Depends on config.h: generate_config_h has to be called before !""" + target = join(build_dir,'numpyconfig.h') + if newer(__file__,target): + config_cmd = config.get_config_cmd() + log.info('Generating %s',target) + testcode = generate_numpyconfig_code(target) + + from distutils import sysconfig + python_include = sysconfig.get_python_inc() + python_h = join(python_include, 'Python.h') + if not os.path.isfile(python_h): + raise SystemError,\ + "Non-existing %s. Perhaps you need to install"\ + " python-dev|python-devel." % (python_h) + + config.numpy_include_dirs + result = config_cmd.try_run(testcode, + include_dirs = [python_include] + \ + config.numpy_include_dirs, + library_dirs = default_lib_dirs) + + if not result: + raise SystemError,"Failed to generate numpy configuration. "\ + "See previous error messages for more information." + + print 'File: %s' % target + target_f = open(target) + print target_f.read() + target_f.close() + print 'EOF' + return target + def generate_api_func(module_name): def generate_api(ext, build_dir): script = join(codegen_dir, module_name + '.py') @@ -213,6 +246,7 @@ config.add_extension('multiarray', sources = [join('src','multiarraymodule.c'), generate_config_h, + generate_numpyconfig_h, generate_array_api, join('src','scalartypes.inc.src'), join('src','arraytypes.inc.src'), @@ -224,6 +258,7 @@ config.add_extension('umath', sources = [generate_config_h, + generate_numpyconfig_h, join('src','umathmodule.c.src'), generate_umath_c, generate_ufunc_api, @@ -239,6 +274,7 @@ config.add_extension('_sort', sources=[join('src','_sortmodule.c.src'), generate_config_h, + generate_numpyconfig_h, generate_array_api, ], ) @@ -246,6 +282,7 @@ config.add_extension('scalarmath', sources=[join('src','scalarmathmodule.c.src'), generate_config_h, + generate_numpyconfig_h, generate_array_api, generate_ufunc_api], ) Modified: branches/cleanconfig/numpy/core/src/arraytypes.inc.src =================================================================== --- branches/cleanconfig/numpy/core/src/arraytypes.inc.src 2007-10-18 03:15:45 UTC (rev 4214) +++ branches/cleanconfig/numpy/core/src/arraytypes.inc.src 2007-10-18 03:30:47 UTC (rev 4215) @@ -1,4 +1,5 @@ /* -*- c -*- */ +#include "config.h" static longlong MyPyLong_AsLongLong(PyObject *vv) Modified: branches/cleanconfig/numpy/core/src/umathmodule.c.src =================================================================== --- branches/cleanconfig/numpy/core/src/umathmodule.c.src 2007-10-18 03:15:45 UTC (rev 4214) +++ branches/cleanconfig/numpy/core/src/umathmodule.c.src 2007-10-18 03:30:47 UTC (rev 4215) @@ -5,6 +5,7 @@ #define _UMATHMODULE #include "numpy/ufuncobject.h" #include "abstract.h" +#include "config.h" #include /* A whole slew of basic math functions are provided originally From numpy-svn at scipy.org Wed Oct 17 23:32:27 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 17 Oct 2007 22:32:27 -0500 (CDT) Subject: [Numpy-svn] r4216 - branches/cleanconfig/numpy/core/include/numpy Message-ID: <20071018033227.D565039C087@new.scipy.org> Author: cdavid Date: 2007-10-17 22:32:23 -0500 (Wed, 17 Oct 2007) New Revision: 4216 Modified: branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h Log: Remove junk #error line Modified: branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h =================================================================== --- branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 03:30:47 UTC (rev 4215) +++ branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 03:32:23 UTC (rev 4216) @@ -20,7 +20,6 @@ #define NPY_ALLOW_THREADS 1 #else #define NPY_ALLOW_THREADS 0 - #error FLOUPI #endif /* There are several places in the code where an array of dimensions is From numpy-svn at scipy.org Wed Oct 17 23:37:45 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 17 Oct 2007 22:37:45 -0500 (CDT) Subject: [Numpy-svn] r4217 - branches/cleanconfig/numpy/core/include/numpy Message-ID: <20071018033745.528DA39C087@new.scipy.org> Author: cdavid Date: 2007-10-17 22:37:41 -0500 (Wed, 17 Oct 2007) New Revision: 4217 Modified: branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h Log: Fix more typos in NPY prepending Modified: branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h =================================================================== --- branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 03:32:23 UTC (rev 4216) +++ branches/cleanconfig/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 03:37:41 UTC (rev 4217) @@ -920,7 +920,7 @@ typedef Py_intptr_t npy_intp; typedef Py_uintptr_t npy_uintp; #define NPY_SIZEOF_INTP NPY_SIZEOF_PY_INTPTR_T -#define NPY_SIZEOF_UINTP NPY_NPY_SIZEOF_PY_INTPTR_T +#define NPY_SIZEOF_UINTP NPY_SIZEOF_PY_INTPTR_T #ifdef constchar #undef constchar @@ -950,7 +950,7 @@ #define NPY_MIN_INTP NPY_MIN_INT #define NPY_MAX_UINTP NPY_MAX_UINT #define NPY_INTP_FMT "d" -#elif NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONGLONG +#elif NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONG #define NPY_INTP NPY_LONG #define NPY_UINTP NPY_ULONG #define PyIntpArrType_Type PyLongArrType_Type From numpy-svn at scipy.org Thu Oct 18 00:02:28 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 17 Oct 2007 23:02:28 -0500 (CDT) Subject: [Numpy-svn] r4218 - branches/cleanconfig/numpy/core Message-ID: <20071018040228.AFB8C39C1A6@new.scipy.org> Author: cdavid Date: 2007-10-17 23:02:24 -0500 (Wed, 17 Oct 2007) New Revision: 4218 Modified: branches/cleanconfig/numpy/core/setup.py Log: Add CHAR_BITS as a public symbol in numpyconfig header Modified: branches/cleanconfig/numpy/core/setup.py =================================================================== --- branches/cleanconfig/numpy/core/setup.py 2007-10-18 03:37:41 UTC (rev 4217) +++ branches/cleanconfig/numpy/core/setup.py 2007-10-18 04:02:24 UTC (rev 4218) @@ -435,6 +435,21 @@ testcode.append(tmpcode % ('NPY_SIZEOF_LONGLONG', 'SIZEOF_LONG_LONG', 'NPY_SIZEOF_PY_LONG_LONG', 'SIZEOF_PY_LONG_LONG')) + testcode.append(r""" +#ifndef CHAR_BIT + { + unsigned char var = 2; + int i = 0; + while (var >= 2) { + var = var << 1; + i++; + } + fprintf(f,"#define CHAR_BIT %d\n", i+1); + } +#else + fprintf(f, "/* #define CHAR_BIT %d */\n", CHAR_BIT); +#endif""") + testcode.append(""" fclose(f); From numpy-svn at scipy.org Thu Oct 18 00:35:49 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 17 Oct 2007 23:35:49 -0500 (CDT) Subject: [Numpy-svn] r4219 - in branches/numpy.scons/numpy/core: . include/numpy src tests Message-ID: <20071018043549.77B5239C293@new.scipy.org> Author: cdavid Date: 2007-10-17 23:35:29 -0500 (Wed, 17 Oct 2007) New Revision: 4219 Modified: branches/numpy.scons/numpy/core/include/numpy/ndarrayobject.h branches/numpy.scons/numpy/core/setup.py branches/numpy.scons/numpy/core/src/arraytypes.inc.src branches/numpy.scons/numpy/core/src/ufuncobject.c branches/numpy.scons/numpy/core/src/umathmodule.c.src branches/numpy.scons/numpy/core/tests/test_regression.py Log: Merging from cleanconfig branch Modified: branches/numpy.scons/numpy/core/include/numpy/ndarrayobject.h =================================================================== --- branches/numpy.scons/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 04:02:24 UTC (rev 4218) +++ branches/numpy.scons/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 04:35:29 UTC (rev 4219) @@ -13,8 +13,15 @@ everything when you're typing */ #endif /* This is auto-generated by the installer */ -#include "config.h" +#include "numpyconfig.h" +/* Only use thread if configured in config and python supports it */ +#if defined WITH_THREAD && !NPY_NOSMP + #define NPY_ALLOW_THREADS 1 +#else + #define NPY_ALLOW_THREADS 0 +#endif + /* There are several places in the code where an array of dimensions is * allocated statically. This is the size of that static allocation. * @@ -80,7 +87,8 @@ #define NPY_FALSE 0 #define NPY_TRUE 1 -#if SIZEOF_LONG_DOUBLE==SIZEOF_DOUBLE + +#if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE typedef double npy_longdouble; #define NPY_LONGDOUBLE_FMT "g" #else @@ -279,22 +287,15 @@ #define NPY_MAX_ULONG ULONG_MAX -#define NPY_SIZEOF_LONG SIZEOF_LONG -#define NPY_SIZEOF_INT SIZEOF_INT -#define NPY_SIZEOF_SHORT SIZEOF_SHORT -#define NPY_SIZEOF_FLOAT SIZEOF_FLOAT -#define NPY_SIZEOF_DOUBLE SIZEOF_DOUBLE -#define NPY_SIZEOF_LONGDOUBLE SIZEOF_LONG_DOUBLE -#define NPY_SIZEOF_LONGLONG SIZEOF_LONG_LONG #define NPY_BITSOF_BOOL (sizeof(npy_bool)*CHAR_BIT) #define NPY_BITSOF_CHAR CHAR_BIT -#define NPY_BITSOF_SHORT (SIZEOF_SHORT*CHAR_BIT) -#define NPY_BITSOF_INT (SIZEOF_INT*CHAR_BIT) -#define NPY_BITSOF_LONG (SIZEOF_LONG*CHAR_BIT) -#define NPY_BITSOF_LONGLONG (NPY_SIZEOF_LONGLONG*CHAR_BIT) -#define NPY_BITSOF_FLOAT (SIZEOF_FLOAT*CHAR_BIT) -#define NPY_BITSOF_DOUBLE (SIZEOF_DOUBLE*CHAR_BIT) -#define NPY_BITSOF_LONGDOUBLE (NPY_SIZEOF_LONGDOUBLE*CHAR_BIT) +#define NPY_BITSOF_SHORT (NPY_SIZEOF_SHORT * CHAR_BIT) +#define NPY_BITSOF_INT (NPY_SIZEOF_INT * CHAR_BIT) +#define NPY_BITSOF_LONG (NPY_SIZEOF_LONG * CHAR_BIT) +#define NPY_BITSOF_LONGLONG (NPY_SIZEOF_LONGLONG * CHAR_BIT) +#define NPY_BITSOF_FLOAT (NPY_SIZEOF_FLOAT * CHAR_BIT) +#define NPY_BITSOF_DOUBLE (NPY_SIZEOF_DOUBLE * CHAR_BIT) +#define NPY_BITSOF_LONGDOUBLE (NPY_SIZEOF_LONGDOUBLE * CHAR_BIT) #if NPY_BITSOF_LONG == 8 #define NPY_INT8 NPY_LONG @@ -918,8 +919,8 @@ * platform. Py_intptr_t, Py_uintptr_t are defined in pyport.h. */ typedef Py_intptr_t npy_intp; typedef Py_uintptr_t npy_uintp; -#define NPY_SIZEOF_INTP SIZEOF_PY_INTPTR_T -#define NPY_SIZEOF_UINTP SIZEOF_PY_INTPTR_T +#define NPY_SIZEOF_INTP NPY_SIZEOF_PY_INTPTR_T +#define NPY_SIZEOF_UINTP NPY_SIZEOF_PY_INTPTR_T #ifdef constchar #undef constchar @@ -940,7 +941,7 @@ #define constchar char #endif -#if SIZEOF_PY_INTPTR_T == SIZEOF_INT +#if NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_INT #define NPY_INTP NPY_INT #define NPY_UINTP NPY_UINT #define PyIntpArrType_Type PyIntArrType_Type @@ -949,7 +950,7 @@ #define NPY_MIN_INTP NPY_MIN_INT #define NPY_MAX_UINTP NPY_MAX_UINT #define NPY_INTP_FMT "d" -#elif SIZEOF_PY_INTPTR_T == SIZEOF_LONG +#elif NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONG #define NPY_INTP NPY_LONG #define NPY_UINTP NPY_ULONG #define PyIntpArrType_Type PyLongArrType_Type @@ -958,7 +959,7 @@ #define NPY_MIN_INTP MIN_LONG #define NPY_MAX_UINTP NPY_MAX_ULONG #define NPY_INTP_FMT "ld" -#elif defined(PY_LONG_LONG) && (SIZEOF_PY_INTPTR_T == SIZEOF_LONG_LONG) +#elif defined(PY_LONG_LONG) && (NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONGLONG) #define NPY_INTP NPY_LONGLONG #define NPY_UINTP NPY_ULONGLONG #define PyIntpArrType_Type PyLongLongArrType_Type @@ -1894,7 +1895,7 @@ #define PyArray_REFCOUNT(obj) (((PyObject *)(obj))->ob_refcnt) #define NPY_REFCOUNT PyArray_REFCOUNT -#define NPY_MAX_ELSIZE (2*SIZEOF_LONGDOUBLE) +#define NPY_MAX_ELSIZE (2 * NPY_SIZEOF_LONGDOUBLE) #define PyArray_ContiguousFromAny(op, type, min_depth, max_depth) \ PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \ Modified: branches/numpy.scons/numpy/core/setup.py =================================================================== --- branches/numpy.scons/numpy/core/setup.py 2007-10-18 04:02:24 UTC (rev 4218) +++ branches/numpy.scons/numpy/core/setup.py 2007-10-18 04:35:29 UTC (rev 4219) @@ -18,6 +18,11 @@ ('rint', 'HAVE_RINT'), ] +def is_npy_no_signal(): + """Return True if the NPY_NO_SIGNAL symbol must be defined in configuration + header.""" + return sys.platform == 'win32' + def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration,dot_join from numpy.distutils.system_info import get_info, default_lib_dirs @@ -73,8 +78,7 @@ nosmp = 1 except KeyError: nosmp = 0 - if nosmp: moredefs = [('NPY_ALLOW_THREADS', '0')] - else: moredefs = [] + moredefs = [] # mathlibs = [] tc = testcode_mathlib() @@ -102,7 +106,7 @@ if check_func(func_name): moredefs.append(defsymbol) - if sys.platform == 'win32': + if is_npy_no_signal(): moredefs.append('NPY_NO_SIGNAL') if sys.platform=='win32' or os.name=='nt': @@ -123,8 +127,12 @@ target_f.write('#define %s\n' % (d)) else: target_f.write('#define %s %s\n' % (d[0],d[1])) - if not nosmp: # default is to use WITH_THREAD - target_f.write('#ifdef WITH_THREAD\n#define NPY_ALLOW_THREADS 1\n#else\n#define NPY_ALLOW_THREADS 0\n#endif\n') + # Define NPY_NOSMP to 1 if explicitely requested, or if we cannot + # support thread support reliably + if nosmp: + target_f.write('#define NPY_NOSMP 1\n') + else: + target_f.write('#define NPY_NOSMP 0\n') target_f.close() print 'File:',target target_f = open(target) @@ -151,6 +159,39 @@ config.add_data_files((header_dir,target)) return target + def generate_numpyconfig_h(ext, build_dir): + """Depends on config.h: generate_config_h has to be called before !""" + target = join(build_dir,'numpyconfig.h') + if newer(__file__,target): + config_cmd = config.get_config_cmd() + log.info('Generating %s',target) + testcode = generate_numpyconfig_code(target) + + from distutils import sysconfig + python_include = sysconfig.get_python_inc() + python_h = join(python_include, 'Python.h') + if not os.path.isfile(python_h): + raise SystemError,\ + "Non-existing %s. Perhaps you need to install"\ + " python-dev|python-devel." % (python_h) + + config.numpy_include_dirs + result = config_cmd.try_run(testcode, + include_dirs = [python_include] + \ + config.numpy_include_dirs, + library_dirs = default_lib_dirs) + + if not result: + raise SystemError,"Failed to generate numpy configuration. "\ + "See previous error messages for more information." + + print 'File: %s' % target + target_f = open(target) + print target_f.read() + target_f.close() + print 'EOF' + return target + def generate_api_func(module_name): def generate_api(ext, build_dir): script = join(codegen_dir, module_name + '.py') @@ -205,6 +246,7 @@ config.add_extension('multiarray', sources = [join('src','multiarraymodule.c'), generate_config_h, + generate_numpyconfig_h, generate_array_api, join('src','scalartypes.inc.src'), join('src','arraytypes.inc.src'), @@ -216,6 +258,7 @@ config.add_extension('umath', sources = [generate_config_h, + generate_numpyconfig_h, join('src','umathmodule.c.src'), generate_umath_c, generate_ufunc_api, @@ -231,6 +274,7 @@ config.add_extension('_sort', sources=[join('src','_sortmodule.c.src'), generate_config_h, + generate_numpyconfig_h, generate_array_api, ], ) @@ -238,6 +282,7 @@ config.add_extension('scalarmath', sources=[join('src','scalarmathmodule.c.src'), generate_config_h, + generate_numpyconfig_h, generate_array_api, generate_ufunc_api], ) @@ -342,6 +387,77 @@ testcode = '\n'.join(testcode) return testcode +def generate_numpyconfig_code(target): + """Return the source code as a string of the code to generate the + numpyconfig header file.""" + # Config symbols to prepend + prepends = [('NPY_SIZEOF_SHORT', 'SIZEOF_SHORT'), + ('NPY_SIZEOF_INT', 'SIZEOF_INT'), + ('NPY_SIZEOF_LONG', 'SIZEOF_LONG'), + ('NPY_SIZEOF_FLOAT', 'SIZEOF_FLOAT'), + ('NPY_SIZEOF_DOUBLE', 'SIZEOF_DOUBLE'), + ('NPY_SIZEOF_LONGDOUBLE', 'SIZEOF_LONG_DOUBLE'), + ('NPY_SIZEOF_PY_INTPTR_T', 'SIZEOF_PY_INTPTR_T'), + ('NPY_NOSMP', 'NPY_NOSMP'),] + + testcode = [""" +#include +#include "config.h" + +int main() +{ + FILE* f; + + f = fopen("%s", "w"); + if (f == NULL) { + return -1; + } +""" % target] + + testcode.append(r""" + fprintf(f, "/*\n * This file is generated by %s. DO NOT EDIT \n */\n"); +""" % __file__) + + # Prepend NPY_ to any SIZEOF defines + testcode.extend([r' fprintf(f, "#define ' + i + r' %%d \n", %s);' % j for i, j in prepends]) + + # Conditionally define NPY_NO_SIGNAL + if is_npy_no_signal(): + testcode.append(r' fprintf(f, "\n#define NPY_NO_SIGNAL\n");') + + tmpcode = r""" + #ifdef PY_LONG_LONG + fprintf(f, "\n#define %s %%d \n", %s); + fprintf(f, "#define %s %%d \n", %s); + #else + fprintf(f, "/* PY_LONG_LONG not defined */ \n"); + #endif""" + testcode.append(tmpcode % ('NPY_SIZEOF_LONGLONG', 'SIZEOF_LONG_LONG', + 'NPY_SIZEOF_PY_LONG_LONG', 'SIZEOF_PY_LONG_LONG')) + + testcode.append(r""" +#ifndef CHAR_BIT + { + unsigned char var = 2; + int i = 0; + while (var >= 2) { + var = var << 1; + i++; + } + fprintf(f,"#define CHAR_BIT %d\n", i+1); + } +#else + fprintf(f, "/* #define CHAR_BIT %d */\n", CHAR_BIT); +#endif""") + + testcode.append(""" + fclose(f); + + return 0; +} +""") + return "\n".join(testcode) + if __name__=='__main__': from numpy.distutils.core import setup setup(configuration=configuration) Modified: branches/numpy.scons/numpy/core/src/arraytypes.inc.src =================================================================== --- branches/numpy.scons/numpy/core/src/arraytypes.inc.src 2007-10-18 04:02:24 UTC (rev 4218) +++ branches/numpy.scons/numpy/core/src/arraytypes.inc.src 2007-10-18 04:35:29 UTC (rev 4219) @@ -1,4 +1,5 @@ /* -*- c -*- */ +#include "config.h" static longlong MyPyLong_AsLongLong(PyObject *vv) Modified: branches/numpy.scons/numpy/core/src/ufuncobject.c =================================================================== --- branches/numpy.scons/numpy/core/src/ufuncobject.c 2007-10-18 04:02:24 UTC (rev 4218) +++ branches/numpy.scons/numpy/core/src/ufuncobject.c 2007-10-18 04:35:29 UTC (rev 4219) @@ -1344,7 +1344,8 @@ loop->meth = BUFFER_UFUNCLOOP; loop->needbuffer[i] = 1; } - if (!loop->obj && mps[i]->descr->type_num == PyArray_OBJECT) { + if (!loop->obj && ((mps[i]->descr->type_num == PyArray_OBJECT) || + (arg_types[i] == PyArray_OBJECT))) { loop->obj = 1; } } @@ -1486,7 +1487,7 @@ /* compute the element size */ for (i=0; inargs;i++) { - if (!loop->needbuffer) continue; + if (!loop->needbuffer[i]) continue; if (arg_types[i] != mps[i]->descr->type_num) { descr = PyArray_DescrFromType(arg_types[i]); if (loop->steps[i]) @@ -1913,6 +1914,7 @@ } /* cast to the other buffer if necessary */ if (loop->cast[i]) { + /* fprintf(stderr, "casting... %d, %p %p\n", i, buffer[i]); */ loop->cast[i](buffer[i], castbuf[i], (intp) datasize[i], @@ -1926,6 +1928,7 @@ for (i=self->nin; inargs; i++) { if (!needbuffer[i]) continue; if (loop->cast[i]) { + /* fprintf(stderr, "casting back... %d, %p", i, castbuf[i]); */ loop->cast[i](castbuf[i], buffer[i], (intp) datasize[i], Modified: branches/numpy.scons/numpy/core/src/umathmodule.c.src =================================================================== --- branches/numpy.scons/numpy/core/src/umathmodule.c.src 2007-10-18 04:02:24 UTC (rev 4218) +++ branches/numpy.scons/numpy/core/src/umathmodule.c.src 2007-10-18 04:35:29 UTC (rev 4219) @@ -5,6 +5,7 @@ #define _UMATHMODULE #include "numpy/ufuncobject.h" #include "abstract.h" +#include "config.h" #include /* A whole slew of basic math functions are provided originally Modified: branches/numpy.scons/numpy/core/tests/test_regression.py =================================================================== --- branches/numpy.scons/numpy/core/tests/test_regression.py 2007-10-18 04:02:24 UTC (rev 4218) +++ branches/numpy.scons/numpy/core/tests/test_regression.py 2007-10-18 04:35:29 UTC (rev 4219) @@ -726,5 +726,12 @@ N.lib.place(1,1,1) + def check_object_casting(self, level=rlevel): + def rs(): + x = N.ones([484,286]) + y = N.zeros([484,286]) + x |= y + self.failUnlessRaises(TypeError,rs) + if __name__ == "__main__": NumpyTest().run() From numpy-svn at scipy.org Thu Oct 18 00:58:20 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 17 Oct 2007 23:58:20 -0500 (CDT) Subject: [Numpy-svn] r4220 - branches/cleanconfig/numpy/core/code_generators Message-ID: <20071018045820.ACB1839C046@new.scipy.org> Author: cdavid Date: 2007-10-17 23:58:09 -0500 (Wed, 17 Oct 2007) New Revision: 4220 Modified: branches/cleanconfig/numpy/core/code_generators/generate_array_api.py Log: Refactor array_api generator so that the implementation is compatible with scons builder API Modified: branches/cleanconfig/numpy/core/code_generators/generate_array_api.py =================================================================== --- branches/cleanconfig/numpy/core/code_generators/generate_array_api.py 2007-10-18 04:35:29 UTC (rev 4219) +++ branches/cleanconfig/numpy/core/code_generators/generate_array_api.py 2007-10-18 04:58:09 UTC (rev 4220) @@ -1,9 +1,6 @@ import os import genapi -OBJECT_API_ORDER = 'array_api_order.txt' -MULTIARRAY_API_ORDER = 'multiarray_api_order.txt' - types = ['Generic','Number','Integer','SignedInteger','UnsignedInteger', 'Inexact', 'Floating', 'ComplexFloating', 'Flexible', 'Character', @@ -122,22 +119,30 @@ """ def generate_api(output_dir, force=False): - header_file = os.path.join(output_dir, '__multiarray_api.h') - c_file = os.path.join(output_dir,'__multiarray_api.c') - doc_file = os.path.join(output_dir, 'multiarray_api.txt') + basename = 'multiarray_api' - targets = (header_file, c_file, doc_file) - if (not force - and not genapi.should_rebuild(targets, - [OBJECT_API_ORDER, - MULTIARRAY_API_ORDER, - __file__])): + h_file = os.path.join(output_dir, '__%s.h' % basename) + c_file = os.path.join(output_dir, '__%s.c' % basename) + d_file = os.path.join(output_dir, '%s.txt' % basename) + targets = (h_file, c_file, d_file) + sources = ['array_api_order.txt', 'multiarray_api_order.txt'] + + if (not force and not genapi.should_rebuild(targets, sources + [__file__])): return targets + else: + do_generate_api(targets, sources) + return targets + +def do_generate_api(targets, sources): + header_file = targets[0] + c_file = targets[1] + doc_file = targets[2] + objectapi_list = genapi.get_api_functions('OBJECT_API', - OBJECT_API_ORDER) + sources[0]) multiapi_list = genapi.get_api_functions('MULTIARRAY_API', - MULTIARRAY_API_ORDER) + sources[1]) # API fixes for __arrayobject_api.h fixed = 10 From numpy-svn at scipy.org Thu Oct 18 01:02:20 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 00:02:20 -0500 (CDT) Subject: [Numpy-svn] r4221 - branches/cleanconfig/numpy/core/code_generators Message-ID: <20071018050220.6C4F8C7C026@new.scipy.org> Author: cdavid Date: 2007-10-18 00:02:14 -0500 (Thu, 18 Oct 2007) New Revision: 4221 Modified: branches/cleanconfig/numpy/core/code_generators/generate_ufunc_api.py Log: Refactor ufunc_api generator so that the implementation is compatible with scons builder API Modified: branches/cleanconfig/numpy/core/code_generators/generate_ufunc_api.py =================================================================== --- branches/cleanconfig/numpy/core/code_generators/generate_ufunc_api.py 2007-10-18 04:58:09 UTC (rev 4220) +++ branches/cleanconfig/numpy/core/code_generators/generate_ufunc_api.py 2007-10-18 05:02:14 UTC (rev 4221) @@ -1,8 +1,6 @@ import os import genapi -UFUNC_API_ORDER = 'ufunc_api_order.txt' - h_template = r""" #ifdef _UMATHMODULE @@ -72,18 +70,29 @@ """ def generate_api(output_dir, force=False): - header_file = os.path.join(output_dir, '__ufunc_api.h') - c_file = os.path.join(output_dir, '__ufunc_api.c') - doc_file = os.path.join(output_dir, 'ufunc_api.txt') + basename = 'ufunc_api' + + h_file = os.path.join(output_dir, '__%s.h' % basename) + c_file = os.path.join(output_dir, '__%s.c' % basename) + d_file = os.path.join(output_dir, '%s.txt' % basename) + targets = (h_file, c_file, d_file) - targets = (header_file, c_file, doc_file) - if (not force - and not genapi.should_rebuild(targets, - [UFUNC_API_ORDER, __file__])): + sources = ['ufunc_api_order.txt'] + + if (not force and not genapi.should_rebuild(targets, sources + [__file__])): return targets + else: + do_generate_api(targets, sources) - ufunc_api_list = genapi.get_api_functions('UFUNC_API', UFUNC_API_ORDER) + return targets +def do_generate_api(targets, sources): + header_file = targets[0] + c_file = targets[1] + doc_file = targets[2] + + ufunc_api_list = genapi.get_api_functions('UFUNC_API', sources[0]) + # API fixes for __arrayobject_api.h fixed = 1 From numpy-svn at scipy.org Thu Oct 18 01:15:25 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 00:15:25 -0500 (CDT) Subject: [Numpy-svn] r4222 - branches/numpy.scons/numpy/core/code_generators Message-ID: <20071018051525.0D35DC7C035@new.scipy.org> Author: cdavid Date: 2007-10-18 00:15:15 -0500 (Thu, 18 Oct 2007) New Revision: 4222 Modified: branches/numpy.scons/numpy/core/code_generators/generate_array_api.py branches/numpy.scons/numpy/core/code_generators/generate_ufunc_api.py Log: Merge back cleanconfig modifications for reuse of code generators Modified: branches/numpy.scons/numpy/core/code_generators/generate_array_api.py =================================================================== --- branches/numpy.scons/numpy/core/code_generators/generate_array_api.py 2007-10-18 05:02:14 UTC (rev 4221) +++ branches/numpy.scons/numpy/core/code_generators/generate_array_api.py 2007-10-18 05:15:15 UTC (rev 4222) @@ -1,9 +1,6 @@ import os import genapi -OBJECT_API_ORDER = 'array_api_order.txt' -MULTIARRAY_API_ORDER = 'multiarray_api_order.txt' - types = ['Generic','Number','Integer','SignedInteger','UnsignedInteger', 'Inexact', 'Floating', 'ComplexFloating', 'Flexible', 'Character', @@ -122,22 +119,30 @@ """ def generate_api(output_dir, force=False): - header_file = os.path.join(output_dir, '__multiarray_api.h') - c_file = os.path.join(output_dir,'__multiarray_api.c') - doc_file = os.path.join(output_dir, 'multiarray_api.txt') + basename = 'multiarray_api' - targets = (header_file, c_file, doc_file) - if (not force - and not genapi.should_rebuild(targets, - [OBJECT_API_ORDER, - MULTIARRAY_API_ORDER, - __file__])): + h_file = os.path.join(output_dir, '__%s.h' % basename) + c_file = os.path.join(output_dir, '__%s.c' % basename) + d_file = os.path.join(output_dir, '%s.txt' % basename) + targets = (h_file, c_file, d_file) + sources = ['array_api_order.txt', 'multiarray_api_order.txt'] + + if (not force and not genapi.should_rebuild(targets, sources + [__file__])): return targets + else: + do_generate_api(targets, sources) + return targets + +def do_generate_api(targets, sources): + header_file = targets[0] + c_file = targets[1] + doc_file = targets[2] + objectapi_list = genapi.get_api_functions('OBJECT_API', - OBJECT_API_ORDER) + sources[0]) multiapi_list = genapi.get_api_functions('MULTIARRAY_API', - MULTIARRAY_API_ORDER) + sources[1]) # API fixes for __arrayobject_api.h fixed = 10 Modified: branches/numpy.scons/numpy/core/code_generators/generate_ufunc_api.py =================================================================== --- branches/numpy.scons/numpy/core/code_generators/generate_ufunc_api.py 2007-10-18 05:02:14 UTC (rev 4221) +++ branches/numpy.scons/numpy/core/code_generators/generate_ufunc_api.py 2007-10-18 05:15:15 UTC (rev 4222) @@ -1,8 +1,6 @@ import os import genapi -UFUNC_API_ORDER = 'ufunc_api_order.txt' - h_template = r""" #ifdef _UMATHMODULE @@ -72,18 +70,29 @@ """ def generate_api(output_dir, force=False): - header_file = os.path.join(output_dir, '__ufunc_api.h') - c_file = os.path.join(output_dir, '__ufunc_api.c') - doc_file = os.path.join(output_dir, 'ufunc_api.txt') + basename = 'ufunc_api' + + h_file = os.path.join(output_dir, '__%s.h' % basename) + c_file = os.path.join(output_dir, '__%s.c' % basename) + d_file = os.path.join(output_dir, '%s.txt' % basename) + targets = (h_file, c_file, d_file) - targets = (header_file, c_file, doc_file) - if (not force - and not genapi.should_rebuild(targets, - [UFUNC_API_ORDER, __file__])): + sources = ['ufunc_api_order.txt'] + + if (not force and not genapi.should_rebuild(targets, sources + [__file__])): return targets + else: + do_generate_api(targets, sources) - ufunc_api_list = genapi.get_api_functions('UFUNC_API', UFUNC_API_ORDER) + return targets +def do_generate_api(targets, sources): + header_file = targets[0] + c_file = targets[1] + doc_file = targets[2] + + ufunc_api_list = genapi.get_api_functions('UFUNC_API', sources[0]) + # API fixes for __arrayobject_api.h fixed = 1 From numpy-svn at scipy.org Thu Oct 18 01:42:30 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 00:42:30 -0500 (CDT) Subject: [Numpy-svn] r4223 - branches/numpy.scons/numpy/core Message-ID: <20071018054230.109FE39C046@new.scipy.org> Author: cdavid Date: 2007-10-18 00:42:25 -0500 (Thu, 18 Oct 2007) New Revision: 4223 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Look for strtod if necessary in core config Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-18 05:15:15 UTC (rev 4222) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-18 05:42:25 UTC (rev 4223) @@ -1,4 +1,4 @@ -# Last Change: Tue Oct 16 02:00 PM 2007 J +# Last Change: Thu Oct 18 02:00 PM 2007 J # vim:syntax=python import os from os.path import join as pjoin, basename as pbasename, dirname as pdirname @@ -24,15 +24,6 @@ elif SCons.Util.is_String(value): return "#define %s %s\n\n" % (define, value) t.writelines([write_symbol(i[0], i[1]) for i in sym]) - # XXX: do something about this: a config.h really should not have #ifdef, - # only #define. - t.writelines(""" -#ifdef WITH_THREAD -#define NPY_ALLOW_THREADS 1 -#else -#define NPY_ALLOW_THREADS 0 -#endif -""") t.write('\n') t.close() @@ -69,10 +60,10 @@ nosmp = 1 except KeyError: nosmp = 0 -#if nosmp: -# config_sym.append(('NPY_ALLOW_THREADS', '0')) -#else: -# config_sym.append(('NPY_ALLOW_THREADS', '1')) +if nosmp: + config_sym.append(('NPY_NOSMP', '0')) +else: + config_sym.append(('NPY_NOSMP', '1')) def CheckBrokenMathlib(context, mathlib): src = """ @@ -178,6 +169,14 @@ # XXX: What are we supposed to do if the math lib is broken ? config.CheckBrokenMathlib(mlib) +#------------------------------------------------------- +# Define the function PyOS_ascii_strod if not available +#------------------------------------------------------- +# XXX: would be better to check for PyOS_ascii_strod instead of version +if sys.version[:3] < '2.4': + if config.CheckFunc('strtod'): + config_sym.append('PyOS_ascii_strtod', 'strtod') + #-------------- # Checking Blas #-------------- From numpy-svn at scipy.org Thu Oct 18 02:21:54 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 01:21:54 -0500 (CDT) Subject: [Numpy-svn] r4224 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071018062154.3AFB239C047@new.scipy.org> Author: cdavid Date: 2007-10-18 01:21:48 -0500 (Thu, 18 Oct 2007) New Revision: 4224 Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Add a file substitution tool in scons command Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-18 05:42:25 UTC (rev 4223) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-18 06:21:48 UTC (rev 4224) @@ -16,6 +16,7 @@ from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension from libinfo import get_config from extension_scons import PythonExtension +from tools.substinfile import TOOL_SUBST def pyplat2sconsplat(): # XXX: should see how env['PLATFORM'] is defined, make this a dictionary @@ -80,6 +81,9 @@ # given first. We have to env = Environment(options = opts, tools = [], PYEXTSUFFIX = pyextsuffix) + # Add the file substitution tool + TOOL_SUBST(env) + # Setting dirs according to command line options env.AppendUnique(build_dir = pjoin(env['build_prefix'], env['src_dir'])) env.AppendUnique(distutils_installdir = pjoin(env['distutils_libdir'], From numpy-svn at scipy.org Thu Oct 18 02:54:49 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 01:54:49 -0500 (CDT) Subject: [Numpy-svn] r4225 - in branches/numpy.scons/numpy/distutils/scons: . tools Message-ID: <20071018065449.2004839C29B@new.scipy.org> Author: cdavid Date: 2007-10-18 01:54:21 -0500 (Thu, 18 Oct 2007) New Revision: 4225 Added: branches/numpy.scons/numpy/distutils/scons/tools/ branches/numpy.scons/numpy/distutils/scons/tools/__init__.py branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py Log: Actually add the code for subst in file builder in scons command.... Added: branches/numpy.scons/numpy/distutils/scons/tools/__init__.py =================================================================== Added: branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py 2007-10-18 06:21:48 UTC (rev 4224) +++ branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py 2007-10-18 06:54:21 UTC (rev 4225) @@ -0,0 +1,73 @@ +# Last Change: Thu Oct 18 03:00 PM 2007 J + +import re +import SCons.Action +from SCons.Builder import Builder +from SCons.Script import Depends + +def TOOL_SUBST(env): + """Adds SubstInFile builder, which substitutes the keys->values of SUBST_DICT + from the source to the target. + The values of SUBST_DICT first have any construction variables expanded + (its keys are not expanded). + If a value of SUBST_DICT is a python callable function, it is called and + the result is expanded as the value. + If there's more than one source and more than one target, each target gets + substituted from the corresponding source. + """ + env.Append(TOOLS = 'SUBST') + def do_subst_in_file(targetfile, sourcefile, dict): + """Replace all instances of the keys of dict with their values. + For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'}, + then all instances of %VERSION% in the file will be replaced with 1.2345 etc. + """ + try: + f = open(sourcefile, 'rb') + contents = f.read() + f.close() + except: + raise SCons.Errors.UserError, "Can't read source file %s"%sourcefile + for (k,v) in dict.items(): + contents = re.sub(k, v, contents) + try: + f = open(targetfile, 'wb') + f.write(contents) + f.close() + except: + raise SCons.Errors.UserError, "Can't write target file %s"%targetfile + return 0 # success + + def subst_in_file(target, source, env): + if not env.has_key('SUBST_DICT'): + raise SCons.Errors.UserError, "SubstInFile requires SUBST_DICT to be set." + d = dict(env['SUBST_DICT']) # copy it + for (k,v) in d.items(): + if callable(v): + d[k] = env.subst(v()) + elif SCons.Util.is_String(v): + d[k]=env.subst(v) + else: + raise SCons.Errors.UserError, "SubstInFile: key %s: %s must be a string or callable"%(k, repr(v)) + for (t,s) in zip(target, source): + return do_subst_in_file(str(t), str(s), d) + + def subst_in_file_string(target, source, env): + """This is what gets printed on the console.""" + return '\n'.join(['Substituting vars from %s into %s'%(str(s), str(t)) + for (t,s) in zip(target, source)]) + + def subst_emitter(target, source, env): + """Add dependency from substituted SUBST_DICT to target. + Returns original target, source tuple unchanged. + """ + d = env['SUBST_DICT'].copy() # copy it + for (k,v) in d.items(): + if callable(v): + d[k] = env.subst(v()) + elif SCons.Util.is_String(v): + d[k]=env.subst(v) + Depends(target, SCons.Node.Python.Value(d)) + return target, source + + subst_action=SCons.Action.Action(subst_in_file, subst_in_file_string) + env['BUILDERS']['SubstInFile'] = Builder(action=subst_action, emitter=subst_emitter) From numpy-svn at scipy.org Thu Oct 18 03:11:23 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 02:11:23 -0500 (CDT) Subject: [Numpy-svn] r4226 - in branches/numpy.scons/numpy/scons_fake: checklib ctypesext ctypesext/tests hook pyext Message-ID: <20071018071123.82A2339C097@new.scipy.org> Author: cdavid Date: 2007-10-18 02:11:10 -0500 (Thu, 18 Oct 2007) New Revision: 4226 Modified: branches/numpy.scons/numpy/scons_fake/checklib/ branches/numpy.scons/numpy/scons_fake/ctypesext/ branches/numpy.scons/numpy/scons_fake/ctypesext/tests/ branches/numpy.scons/numpy/scons_fake/hook/ branches/numpy.scons/numpy/scons_fake/pyext/ Log: svn: ignore *.pyc junk in scons_fake Property changes on: branches/numpy.scons/numpy/scons_fake/checklib ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: branches/numpy.scons/numpy/scons_fake/ctypesext ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: branches/numpy.scons/numpy/scons_fake/ctypesext/tests ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: branches/numpy.scons/numpy/scons_fake/hook ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: branches/numpy.scons/numpy/scons_fake/pyext ___________________________________________________________________ Name: svn:ignore + *.pyc From numpy-svn at scipy.org Thu Oct 18 03:13:24 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 02:13:24 -0500 (CDT) Subject: [Numpy-svn] r4227 - in branches/numpy.scons/numpy/core: . include/numpy Message-ID: <20071018071324.74332C7C026@new.scipy.org> Author: cdavid Date: 2007-10-18 02:13:12 -0500 (Thu, 18 Oct 2007) New Revision: 4227 Added: branches/numpy.scons/numpy/core/include/numpy/numpyconfig.h.in Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/setupscons.py Log: Modify scons configuration to be compatible with cleanconfig changes Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-18 07:11:10 UTC (rev 4226) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-18 07:13:12 UTC (rev 4227) @@ -1,4 +1,4 @@ -# Last Change: Thu Oct 18 02:00 PM 2007 J +# Last Change: Thu Oct 18 03:00 PM 2007 J # vim:syntax=python import os from os.path import join as pjoin, basename as pbasename, dirname as pdirname @@ -20,50 +20,46 @@ if value == 1: return "#define %s\n\n" % define elif value == 0: - return "#undef %s\n\n" % define + return r"/* #undef %s */\n\n" % define elif SCons.Util.is_String(value): return "#define %s %s\n\n" % (define, value) t.writelines([write_symbol(i[0], i[1]) for i in sym]) t.write('\n') t.close() + print 'File: %s' % target[0] + target_f = open(str(target[0])) + print target_f.read() + target_f.close() + print 'EOF' return 0 -# Convention: list of tuples (definition, value). value: -# - 0: #undef definition -# - 1: #define definition -# - string: #define definition value -config_sym = [] - -env = GetNumpyEnvironment(ARGUMENTS) - -#-------------------------------- -# Checking SMP and thread options -#-------------------------------- -# Python 2.3 causes a segfault when -# trying to re-acquire the thread-state -# which is done in error-handling -# ufunc code. NPY_ALLOW_C_API and friends -# cause the segfault. So, we disable threading -# for now. -if sys.version[:5] < '2.4.2': - nosmp = 1 -else: - # Perhaps a fancier check is in order here. - # so that threads are only enabled if there - # are actually multiple CPUS? -- but - # threaded code can be nice even on a single - # CPU so that long-calculating code doesn't - # block. - try: - nosmp = os.environ['NPY_NOSMP'] +def define_no_smp(): + """Returns True if we should define NPY_NOSMP, False otherwise.""" + #-------------------------------- + # Checking SMP and thread options + #-------------------------------- + # Python 2.3 causes a segfault when + # trying to re-acquire the thread-state + # which is done in error-handling + # ufunc code. NPY_ALLOW_C_API and friends + # cause the segfault. So, we disable threading + # for now. + if sys.version[:5] < '2.4.2': nosmp = 1 - except KeyError: - nosmp = 0 -if nosmp: - config_sym.append(('NPY_NOSMP', '0')) -else: - config_sym.append(('NPY_NOSMP', '1')) + else: + # Perhaps a fancier check is in order here. + # so that threads are only enabled if there + # are actually multiple CPUS? -- but + # threaded code can be nice even on a single + # CPU so that long-calculating code doesn't + # block. + try: + nosmp = os.environ['NPY_NOSMP'] + nosmp = 1 + except KeyError: + nosmp = 0 + return nosmp == 1 def CheckBrokenMathlib(context, mathlib): src = """ @@ -93,11 +89,20 @@ context.Result(' broken !') return st[0] +env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = [get_python_inc()]) + +#======================= +# Starting Configuration +#======================= config = env.NumpyConfigure(custom_tests = {'CheckTypeSize' : CheckTypeSize, 'CheckBrokenMathlib' : CheckBrokenMathlib}) -# TODO: check python extension can be built (in root or here ?) +# Convention: list of tuples (definition, value). value: +# - 0: #undef definition +# - 1: #define definition +# - string: #define definition value +config_sym = [] #--------------- # Checking Types @@ -111,13 +116,15 @@ config_sym.append(('SIZEOF_%s' % type.upper(), 0)) check_type('short') check_type('int') -#check_type('long') +check_type('long') check_type('float') check_type('double') check_type('long double') check_type('Py_intptr_t', include = ["Python.h"]) check_type('PY_LONG_LONG', include = ["Python.h"]) +# TODO: check python extension can be built (in root or here ?) + #----------------------- # Checking configuration #----------------------- @@ -177,6 +184,11 @@ if config.CheckFunc('strtod'): config_sym.append('PyOS_ascii_strtod', 'strtod') +if define_no_smp(): + config_sym.append(('NPY_NOSMP', '1')) +else: + config_sym.append(('NPY_NOSMP', '0')) + #-------------- # Checking Blas #-------------- @@ -184,6 +196,19 @@ config.Finish() +#--------------------------------------- +# Generate the public configuration file +#--------------------------------------- +config_dict = {} +# XXX: this is ugly, make the API for config.h and numpyconfig.h similar +for key, value in config_sym: + config_dict['@%s@' % key] = str(value) +env['SUBST_DICT'] = config_dict + +include_dir = 'include/numpy' +env.SubstInFile(pjoin(env['build_dir'], 'numpyconfig.h'), + pjoin(env['src_dir'], include_dir, 'numpyconfig.h.in')) + #--------------------------- # Builder for generated code #--------------------------- @@ -273,7 +298,7 @@ pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt')) # XXX -#env.Append(CCFLAGS = "-Wall -O2") +env.Append(CCFLAGS = "-Wall -fno-strict-aliasing") #----------------- # Build multiarray Added: branches/numpy.scons/numpy/core/include/numpy/numpyconfig.h.in =================================================================== --- branches/numpy.scons/numpy/core/include/numpy/numpyconfig.h.in 2007-10-18 07:11:10 UTC (rev 4226) +++ branches/numpy.scons/numpy/core/include/numpy/numpyconfig.h.in 2007-10-18 07:13:12 UTC (rev 4227) @@ -0,0 +1,21 @@ +#define NPY_SIZEOF_SHORT @SIZEOF_SHORT@ +#define NPY_SIZEOF_INT @SIZEOF_INT@ +#define NPY_SIZEOF_LONG @SIZEOF_LONG@ +#define NPY_SIZEOF_FLOAT @SIZEOF_FLOAT@ +#define NPY_SIZEOF_DOUBLE @SIZEOF_DOUBLE@ +#define NPY_SIZEOF_LONGDOUBLE @SIZEOF_LONG_DOUBLE@ +#define NPY_SIZEOF_PY_INTPTR_T @SIZEOF_PY_INTPTR_T@ + +#define NPY_NOSMP @NPY_NOSMP@ + +/* Conditionally define them */ +/* XXX: this has to be done outside config files !!!! */ +#ifdef PY_LONG_LONG + #define NPY_SIZEOF_LONGLONG @SIZEOF_PY_LONG_LONG@ + #define NPY_SIZEOF_PY_LONG_LONG @SIZEOF_PY_LONG_LONG@ +#endif + +#ifndef CHAR_BIT + #error Configuration for undefined CHAR_BIT is not supported, contact the maintainter + #define CHAR_BIT @CHAR_BIT@ +#endif Modified: branches/numpy.scons/numpy/core/setupscons.py =================================================================== --- branches/numpy.scons/numpy/core/setupscons.py 2007-10-18 07:11:10 UTC (rev 4226) +++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-18 07:13:12 UTC (rev 4227) @@ -24,6 +24,17 @@ incl_dir = os.path.dirname(target) if incl_dir not in config.numpy_include_dirs: config.numpy_include_dirs.append(incl_dir) + #config.add_data_files((header_dir, target)) + + def add_numpyconfig_header(): + scons_build_dir = config.get_scons_build_dir() + # XXX: I really have to think about how to communicate path info + # between scons and distutils, and set the options at one single + # location. + target = join(scons_build_dir, local_dir, 'numpyconfig.h') + incl_dir = os.path.dirname(target) + if incl_dir not in config.numpy_include_dirs: + config.numpy_include_dirs.append(incl_dir) config.add_data_files((header_dir, target)) def add_array_api(): @@ -48,6 +59,7 @@ def add_generated_files(): add_config_header() + add_numpyconfig_header() add_array_api() add_ufunc_api() From numpy-svn at scipy.org Thu Oct 18 04:16:27 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 03:16:27 -0500 (CDT) Subject: [Numpy-svn] r4228 - branches/numpy.scons/numpy/distutils/scons/tools Message-ID: <20071018081627.F313639C013@new.scipy.org> Author: cdavid Date: 2007-10-18 03:16:23 -0500 (Thu, 18 Oct 2007) New Revision: 4228 Modified: branches/numpy.scons/numpy/distutils/scons/tools/ Log: Ignore *.pyc in scons subpackage Property changes on: branches/numpy.scons/numpy/distutils/scons/tools ___________________________________________________________________ Name: svn:ignore + *.pyc From numpy-svn at scipy.org Thu Oct 18 04:18:27 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 03:18:27 -0500 (CDT) Subject: [Numpy-svn] r4229 - branches/numpy.scons/numpy/core Message-ID: <20071018081827.1C87C39C11F@new.scipy.org> Author: cdavid Date: 2007-10-18 03:18:22 -0500 (Thu, 18 Oct 2007) New Revision: 4229 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/scons_support.py Log: * Clean up custom builders for numpy.core, using changes from cleanconfig branch * Other minor clean up in numpy.core SConscript and support Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-18 08:16:23 UTC (rev 4228) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-18 08:18:22 UTC (rev 4229) @@ -1,4 +1,4 @@ -# Last Change: Thu Oct 18 03:00 PM 2007 J +# Last Change: Thu Oct 18 04:00 PM 2007 J # vim:syntax=python import os from os.path import join as pjoin, basename as pbasename, dirname as pdirname @@ -8,8 +8,6 @@ from numpy.distutils.scons import get_python_inc from numpy.distutils.scons import GetNumpyEnvironment, CheckTypeSize -import SCons.Util - def generate_config_header(target, source, env): t = open(str(target[0]), 'w') if not env.has_key('config_h_gen'): @@ -21,7 +19,7 @@ return "#define %s\n\n" % define elif value == 0: return r"/* #undef %s */\n\n" % define - elif SCons.Util.is_String(value): + else: return "#define %s %s\n\n" % (define, value) t.writelines([write_symbol(i[0], i[1]) for i in sym]) t.write('\n') @@ -196,6 +194,10 @@ config.Finish() +#========== +# Build +#========== + #--------------------------------------- # Generate the public configuration file #--------------------------------------- @@ -212,11 +214,28 @@ #--------------------------- # Builder for generated code #--------------------------- -from scons_support import do_generate_api, generate_api_emitter, do_generate_ufunc_api +from scons_support import do_generate_array_api, do_generate_ufunc_api, \ + generate_api_emitter,\ + generate_from_template, generate_from_template_emitter, \ + generate_umath, generate_umath_emitter -# XXX: put the builder in scons support lib. -bld = Builder(action = do_generate_api, emitter = generate_api_emitter) -env.Append(BUILDERS = {'GenerateApi' : bld}) +array_api_gen_bld = Builder(action = do_generate_array_api, + emitter = generate_api_emitter) + +ufunc_api_gen_bld = Builder(action = do_generate_ufunc_api, + emitter = generate_api_emitter) + +template_bld = Builder(action = generate_from_template, + emitter = generate_from_template_emitter) + +umath_bld = Builder(action = generate_umath, + emitter = generate_umath_emitter) + +env.Append(BUILDERS = {'GenerateMultiarrayApi' : array_api_gen_bld, + 'GenerateUfuncApi' : ufunc_api_gen_bld, + 'GenerateFromTemplate' : template_bld, + 'GenerateUmath' : umath_bld}) + from os.path import join as pjoin # Take into account the change in config_sym (using emitter, see SubstDic @@ -225,88 +244,55 @@ bld = Builder(action = generate_config_header) env.Append(BUILDERS = {'GenerateConfigHeader' : bld}) -# Builder to generate .inc from .inc.src -from numpy.distutils.conv_template import process_str -def do_generate_from_template(targetfile, sourcefile, env): - t = open(targetfile, 'w') - s = open(sourcefile, 'r') - allstr = s.read() - s.close() - writestr = process_str(allstr) - t.write(writestr) - t.close() - return 0 +#------------------------ +# Generate generated code +#------------------------ +config_header = env.GenerateConfigHeader(pjoin(env['build_dir'], 'config.h'), []) -def generate_from_template(target, source, env): - for t, s in zip(target, source): - do_generate_from_template(str(t), str(s), env) +scalartypes_src = env.GenerateFromTemplate( + pjoin(env['build_dir'], 'src', 'scalartypes'), + pjoin(env['src_dir'], 'src', 'scalartypes.inc.src')) -def generate_from_template_emitter(target, source, env): - base, ext = SCons.Util.splitext(pbasename(str(source[0]))) - t = pjoin(pdirname(str(target[0])), base) - return ([t], source) - -def do_generate_umath(targetfile, sourcefile, env): - t = open(targetfile, 'w') - from code_generators import generate_umath - code = generate_umath.make_code(generate_umath.defdict, generate_umath.__file__) - t.write(code) - t.close() +arraytypes_src = env.GenerateFromTemplate( + pjoin(env['build_dir'], 'src', 'arraytypes'), + pjoin(env['src_dir'], 'src', 'arraytypes.inc.src')) -def generate_umath(target, source, env): - for t, s in zip(target, source): - do_generate_umath(str(t), str(s), env) +sortmodule_src = env.GenerateFromTemplate( + pjoin(env['build_dir'], 'src', '_sortmodule'), + pjoin(env['src_dir'], 'src', '_sortmodule.c.src')) -def generate_umath_emitter(target, source, env): - t = str(target[0]) + '.c' - return ([t], source) - -bld = Builder(action = generate_umath, emitter = generate_umath_emitter) -env.Append(BUILDERS = {'GenerateUmath' : bld}) +umathmodule_src = env.GenerateFromTemplate( + pjoin(env['build_dir'], 'src', 'umathmodule'), + pjoin(env['src_dir'], 'src', 'umathmodule.c.src')) -bld = Builder(action = do_generate_ufunc_api, emitter = generate_api_emitter) -env.Append(BUILDERS = {'GenerateUfuncApi' : bld}) +scalarmathmodule_src = env.GenerateFromTemplate( + pjoin(env['build_dir'], 'src', 'scalarmathmodule'), + pjoin(env['src_dir'], 'src', 'scalarmathmodule.c.src')) -bld = Builder(action = generate_from_template, emitter = generate_from_template_emitter) -env.Append(BUILDERS = {'FromTemplate' : bld}) +umath = env.GenerateUmath( + pjoin(env['build_dir'], '__umath_generated'), + pjoin(env['src_dir'], 'code_generators', 'generate_umath.py')) -#------------------------ -# Generate generated code -#------------------------ -config_header = env.GenerateConfigHeader(pjoin(env['build_dir'], 'config.h'), []) +multiarray_api = env.GenerateMultiarrayApi( + pjoin(env['build_dir'], 'multiarray_api'), + [ pjoin(env['src_dir'], 'code_generators', + 'array_api_order.txt'), + pjoin(env['src_dir'], 'code_generators', + 'multiarray_api_order.txt')]) -scalartypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'scalartypes'), - pjoin(env['src_dir'], 'src', 'scalartypes.inc.src')) -arraytypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'arraytypes'), - pjoin(env['src_dir'], 'src', 'arraytypes.inc.src')) -sortmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', '_sortmodule'), - pjoin(env['src_dir'], 'src', '_sortmodule.c.src')) -umathmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'umathmodule'), - pjoin(env['src_dir'], 'src', 'umathmodule.c.src')) -scalarmathmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', - 'scalarmathmodule'), - pjoin(env['src_dir'], 'src', - 'scalarmathmodule.c.src')) +ufunc_api = env.GenerateUfuncApi( + pjoin(env['build_dir'], 'ufunc_api'), + pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt')) -umath = env.GenerateUmath(pjoin(env['build_dir'], '__umath_generated'), - pjoin(env['src_dir'], 'code_generators', 'generate_umath.py')) - -multiarray_api = env.GenerateApi(pjoin(env['build_dir'], 'multiarray_api'), - [pjoin(env['src_dir'], 'code_generators', 'array_api_order.txt'), - pjoin(env['src_dir'], 'code_generators', 'multiarray_api_order.txt')]) -ufunc_api = env.GenerateUfuncApi(pjoin(env['build_dir'], 'ufunc_api'), - pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt')) - # XXX env.Append(CCFLAGS = "-Wall -fno-strict-aliasing") +env.Append(CPPPATH = [pjoin(env['src_dir'], 'include'), env['build_dir']]) + #----------------- # Build multiarray #----------------- -env.Append(CPPPATH = [pjoin(env['src_dir'], 'include'), env['build_dir']]) -multiarray_src = [ - pjoin('src', 'multiarraymodule.c'), -] +multiarray_src = [pjoin('src', 'multiarraymodule.c')] multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src) #------------------ Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-10-18 08:16:23 UTC (rev 4228) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-18 08:18:22 UTC (rev 4229) @@ -1,160 +1,82 @@ from os.path import join as pjoin, dirname as pdirname, basename as pbasename from code_generators.generate_array_api import \ - types, h_template as multiarray_h_template, \ - c_template as multiarray_c_template + do_generate_api as nowrap_do_generate_array_api from code_generators.generate_ufunc_api import \ - h_template as ufunc_h_template, \ - c_template as ufunc_c_template -import code_generators.genapi as genapi + do_generate_api as nowrap_do_generate_ufunc_api -import SCons.Errors +from numpy.distutils.conv_template import process_str -# XXX: better refactor code_generators.generate* functions, and use them -# directly -def do_generate_api(target, source, env): - """source has to be a sequence of OBJECT, MULTIARRAY txt files.""" - h_file = str(target[0]) - c_file = str(target[1]) - t_file = str(target[2]) +def split_ext(string): + sp = string.rsplit('.', 1) + if len(sp) == 1: + return (sp[0], '') + else: + return sp +#------------------------------------ +# Ufunc and multiarray API generators +#------------------------------------ +def do_generate_array_api(target, source, env): + nowrap_do_generate_array_api([str(i) for i in target], + [str(i) for i in source]) + return 0 - if not len(source) == 2: - # XXX - assert 0 == 1 - OBJECT_API_ORDER = str(source[0]) - MULTIARRAY_API_ORDER = str(source[1]) - objectapi_list = genapi.get_api_functions('OBJECT_API', - OBJECT_API_ORDER) - multiapi_list = genapi.get_api_functions('MULTIARRAY_API', - MULTIARRAY_API_ORDER) - # API fixes for __arrayobject_api.h - - fixed = 10 - numtypes = len(types) + fixed - numobject = len(objectapi_list) + numtypes - nummulti = len(multiapi_list) - numtotal = numobject + nummulti - - module_list = [] - extension_list = [] - init_list = [] - - # setup types - for k, atype in enumerate(types): - num = fixed + k - astr = " (void *) &Py%sArrType_Type," % types[k] - init_list.append(astr) - astr = "static PyTypeObject Py%sArrType_Type;" % types[k] - module_list.append(astr) - astr = "#define Py%sArrType_Type (*(PyTypeObject *)PyArray_API[%d])" % \ - (types[k], num) - extension_list.append(astr) - - # set up object API - genapi.add_api_list(numtypes, 'PyArray_API', objectapi_list, - module_list, extension_list, init_list) - - # set up multiarray module API - genapi.add_api_list(numobject, 'PyArray_API', multiapi_list, - module_list, extension_list, init_list) - - - # Write to header - fid = open(h_file, 'w') - s = multiarray_h_template % ('\n'.join(module_list), '\n'.join(extension_list)) - fid.write(s) - fid.close() - - # Write to c-code - fid = open(c_file, 'w') - s = multiarray_c_template % '\n'.join(init_list) - fid.write(s) - fid.close() - - # write to documentation - fid = open(t_file, 'w') - fid.write(''' -=========== -Numpy C-API -=========== - -Object API -========== -''') - for func in objectapi_list: - fid.write(func.to_ReST()) - fid.write('\n\n') - fid.write(''' - -Multiarray API -============== -''') - for func in multiapi_list: - fid.write(func.to_ReST()) - fid.write('\n\n') - fid.close() - +def do_generate_ufunc_api(target, source, env): + nowrap_do_generate_ufunc_api([str(i) for i in target], + [str(i) for i in source]) return 0 def generate_api_emitter(target, source, env): - """Returns the list of targets generated by the code generator for array api.""" - base, ext = SCons.Util.splitext(str(target[0])) + """Returns the list of targets generated by the code generator for array + api and ufunc api.""" + base, ext = split_ext(str(target[0])) dir = pdirname(base) ba = pbasename(base) h = pjoin(dir, '__' + ba + '.h') c = pjoin(dir, '__' + ba + '.c') txt = base + '.txt' - print h, c, txt + #print h, c, txt t = [h, c, txt] return (t, source) -def do_generate_ufunc_api(target, source, env): - """source has to be a txt file.""" - h_file = str(target[0]) - c_file = str(target[1]) - d_file = str(target[2]) +#------------------------- +# From template generators +#------------------------- +# XXX: this is general and can be used outside numpy.core. +def do_generate_from_template(targetfile, sourcefile, env): + t = open(targetfile, 'w') + s = open(sourcefile, 'r') + allstr = s.read() + s.close() + writestr = process_str(allstr) + t.write(writestr) + t.close() + return 0 - targets = (h_file, c_file, d_file) +def generate_from_template(target, source, env): + for t, s in zip(target, source): + do_generate_from_template(str(t), str(s), env) - UFUNC_API_ORDER = str(source[0]) - ufunc_api_list = genapi.get_api_functions('UFUNC_API', UFUNC_API_ORDER) +def generate_from_template_emitter(target, source, env): + base, ext = split_ext(pbasename(str(source[0]))) + t = pjoin(pdirname(str(target[0])), base) + return ([t], source) + +#---------------- +# umath generator +#---------------- +def do_generate_umath(targetfile, sourcefile, env): + t = open(targetfile, 'w') + from code_generators import generate_umath + code = generate_umath.make_code(generate_umath.defdict, generate_umath.__file__) + t.write(code) + t.close() - # API fixes for __arrayobject_api.h +def generate_umath(target, source, env): + for t, s in zip(target, source): + do_generate_umath(str(t), str(s), env) - fixed = 1 - nummulti = len(ufunc_api_list) - numtotal = fixed + nummulti - - module_list = [] - extension_list = [] - init_list = [] - - # set up object API - genapi.add_api_list(fixed, 'PyUFunc_API', ufunc_api_list, - module_list, extension_list, init_list) - - # Write to header - fid = open(h_file, 'w') - s = ufunc_h_template % ('\n'.join(module_list), '\n'.join(extension_list)) - fid.write(s) - fid.close() - - # Write to c-code - fid = open(c_file, 'w') - s = ufunc_c_template % '\n'.join(init_list) - fid.write(s) - fid.close() - - # Write to documentation - fid = open(d_file, 'w') - fid.write(''' -================= -Numpy Ufunc C-API -================= -''') - for func in ufunc_api_list: - fid.write(func.to_ReST()) - fid.write('\n\n') - fid.close() - - return 0 +def generate_umath_emitter(target, source, env): + t = str(target[0]) + '.c' + return ([t], source) + From numpy-svn at scipy.org Thu Oct 18 04:48:27 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 03:48:27 -0500 (CDT) Subject: [Numpy-svn] r4230 - branches/numpy.scons/numpy/core Message-ID: <20071018084827.BAC50C7C02C@new.scipy.org> Author: cdavid Date: 2007-10-18 03:48:21 -0500 (Thu, 18 Oct 2007) New Revision: 4230 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Improve config header builder in numpy.core Sconsctruct: any configuration change is now detected by scons Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-18 08:18:22 UTC (rev 4229) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-18 08:48:21 UTC (rev 4230) @@ -1,4 +1,4 @@ -# Last Change: Thu Oct 18 04:00 PM 2007 J +# Last Change: Thu Oct 18 05:00 PM 2007 J # vim:syntax=python import os from os.path import join as pjoin, basename as pbasename, dirname as pdirname @@ -8,17 +8,19 @@ from numpy.distutils.scons import get_python_inc from numpy.distutils.scons import GetNumpyEnvironment, CheckTypeSize +import SCons.Node + def generate_config_header(target, source, env): t = open(str(target[0]), 'w') - if not env.has_key('config_h_gen'): + if not env.has_key('CONFIG_H_GEN'): # XXX assert 0 == 1 - sym = env['config_h_gen'] + sym = env['CONFIG_H_GEN'] def write_symbol(define, value): if value == 1: return "#define %s\n\n" % define elif value == 0: - return r"/* #undef %s */\n\n" % define + return "/* #undef %s */\n\n" % define else: return "#define %s %s\n\n" % (define, value) t.writelines([write_symbol(i[0], i[1]) for i in sym]) @@ -32,6 +34,13 @@ print 'EOF' return 0 +def generate_config_header_emitter(target, source, env): + """Add dependency from config list CONFIG_H_GEN to target. Returns + original target, source tuple unchanged. """ + d = deepcopy(env['CONFIG_H_GEN']) # copy it + Depends(target, SCons.Node.Python.Value(d)) + return target, source + def define_no_smp(): """Returns True if we should define NPY_NOSMP, False otherwise.""" #-------------------------------- @@ -157,6 +166,7 @@ else: mlib = 'm' config_sym.append(('MATHLIB', str(mlib))) + def check_lib(f, autoadd = 0): """Check that f is available in mlib, and add the symbol appropriately. @@ -171,8 +181,10 @@ for f in mfuncs[1:]: check_lib(f) -# XXX: What are we supposed to do if the math lib is broken ? -config.CheckBrokenMathlib(mlib) +if not config.CheckBrokenMathlib(mlib): + raise SCons.Errors.UserError("Your mathlib looks broken: chose another "\ + "one using the MATHLIB env variable, eg "\ + "MATHLIB=m") #------------------------------------------------------- # Define the function PyOS_ascii_strod if not available @@ -211,6 +223,8 @@ env.SubstInFile(pjoin(env['build_dir'], 'numpyconfig.h'), pjoin(env['src_dir'], include_dir, 'numpyconfig.h.in')) +env['CONFIG_H_GEN'] = config_sym + #--------------------------- # Builder for generated code #--------------------------- @@ -231,22 +245,20 @@ umath_bld = Builder(action = generate_umath, emitter = generate_umath_emitter) +config_h_bld = Builder(action = generate_config_header, + emitter = generate_config_header_emitter) + env.Append(BUILDERS = {'GenerateMultiarrayApi' : array_api_gen_bld, 'GenerateUfuncApi' : ufunc_api_gen_bld, 'GenerateFromTemplate' : template_bld, - 'GenerateUmath' : umath_bld}) + 'GenerateUmath' : umath_bld, + 'GenerateConfigHeader' : config_h_bld}) -from os.path import join as pjoin - -# Take into account the change in config_sym (using emitter, see SubstDic -# example in scons wiki) ? -env['config_h_gen'] = config_sym -bld = Builder(action = generate_config_header) -env.Append(BUILDERS = {'GenerateConfigHeader' : bld}) - #------------------------ # Generate generated code #------------------------ +from os.path import join as pjoin + config_header = env.GenerateConfigHeader(pjoin(env['build_dir'], 'config.h'), []) scalartypes_src = env.GenerateFromTemplate( From numpy-svn at scipy.org Thu Oct 18 05:38:46 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 04:38:46 -0500 (CDT) Subject: [Numpy-svn] r4231 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071018093846.78D6039C013@new.scipy.org> Author: cdavid Date: 2007-10-18 04:38:38 -0500 (Thu, 18 Oct 2007) New Revision: 4231 Modified: branches/numpy.scons/numpy/distutils/scons/default.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Add basic optimization options for gcc Modified: branches/numpy.scons/numpy/distutils/scons/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/default.py 2007-10-18 08:48:21 UTC (rev 4230) +++ branches/numpy.scons/numpy/distutils/scons/default.py 2007-10-18 09:38:38 UTC (rev 4231) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Thu Oct 11 04:00 PM 2007 J +# Last Change: Thu Oct 18 05:00 PM 2007 J # This is a copy of scons/Tools/__init__.py, because scons does not offer any # public api for this Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-18 08:48:21 UTC (rev 4230) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-18 09:38:38 UTC (rev 4231) @@ -159,6 +159,11 @@ env['ENV']['HOME'] = os.environ['HOME'] except KeyError: pass + + # XXX: think about how to handle optimizations per compiler + if env['CC'] == 'gcc': + env.Append(CCFLAGS = "-Wall -Wstrict-prototypes -fno-strict-aliasing -O3 -g") + #print Environment().Dump() # Adding custom builder env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary @@ -180,4 +185,3 @@ env['NUMPYCONFIG'] = config return env - From numpy-svn at scipy.org Thu Oct 18 05:40:16 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 04:40:16 -0500 (CDT) Subject: [Numpy-svn] r4232 - branches/numpy.scons/numpy/core Message-ID: <20071018094016.5115439C00C@new.scipy.org> Author: cdavid Date: 2007-10-18 04:40:11 -0500 (Thu, 18 Oct 2007) New Revision: 4232 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/scons_support.py Log: Put some configuration code in scons_support Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-18 09:38:38 UTC (rev 4231) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-18 09:40:11 UTC (rev 4232) @@ -1,8 +1,8 @@ -# Last Change: Thu Oct 18 05:00 PM 2007 J +# Last Change: Thu Oct 18 06:00 PM 2007 J # vim:syntax=python import os -from os.path import join as pjoin, basename as pbasename, dirname as pdirname import sys +from os.path import join as pjoin, basename as pbasename, dirname as pdirname from copy import deepcopy from numpy.distutils.scons import get_python_inc @@ -10,92 +10,9 @@ import SCons.Node -def generate_config_header(target, source, env): - t = open(str(target[0]), 'w') - if not env.has_key('CONFIG_H_GEN'): - # XXX - assert 0 == 1 - sym = env['CONFIG_H_GEN'] - def write_symbol(define, value): - if value == 1: - return "#define %s\n\n" % define - elif value == 0: - return "/* #undef %s */\n\n" % define - else: - return "#define %s %s\n\n" % (define, value) - t.writelines([write_symbol(i[0], i[1]) for i in sym]) - t.write('\n') - t.close() +from scons_support import CheckBrokenMathlib, define_no_smp, \ + generate_config_header, generate_config_header_emitter - print 'File: %s' % target[0] - target_f = open(str(target[0])) - print target_f.read() - target_f.close() - print 'EOF' - return 0 - -def generate_config_header_emitter(target, source, env): - """Add dependency from config list CONFIG_H_GEN to target. Returns - original target, source tuple unchanged. """ - d = deepcopy(env['CONFIG_H_GEN']) # copy it - Depends(target, SCons.Node.Python.Value(d)) - return target, source - -def define_no_smp(): - """Returns True if we should define NPY_NOSMP, False otherwise.""" - #-------------------------------- - # Checking SMP and thread options - #-------------------------------- - # Python 2.3 causes a segfault when - # trying to re-acquire the thread-state - # which is done in error-handling - # ufunc code. NPY_ALLOW_C_API and friends - # cause the segfault. So, we disable threading - # for now. - if sys.version[:5] < '2.4.2': - nosmp = 1 - else: - # Perhaps a fancier check is in order here. - # so that threads are only enabled if there - # are actually multiple CPUS? -- but - # threaded code can be nice even on a single - # CPU so that long-calculating code doesn't - # block. - try: - nosmp = os.environ['NPY_NOSMP'] - nosmp = 1 - except KeyError: - nosmp = 0 - return nosmp == 1 - -def CheckBrokenMathlib(context, mathlib): - src = """ -/* check whether libm is broken */ -#include -int main(int argc, char *argv[]) -{ - return exp(-720.) > 1.0; /* typically an IEEE denormal */ -} -""" - - try: - oldLIBS = deepcopy(context.env['LIBS']) - except: - oldLIBS = [] - - try: - context.Message("Checking if math lib %s is broken ... " % mathlib) - context.env.AppendUnique(LIBS = mathlib) - st = context.TryRun(src, '.c') - finally: - env['LIBS'] = oldLIBS - - if st[0]: - context.Result(' not broken !') - else: - context.Result(' broken !') - return st[0] - env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = [get_python_inc()]) @@ -296,9 +213,6 @@ pjoin(env['build_dir'], 'ufunc_api'), pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt')) -# XXX -env.Append(CCFLAGS = "-Wall -fno-strict-aliasing") - env.Append(CPPPATH = [pjoin(env['src_dir'], 'include'), env['build_dir']]) #----------------- Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-10-18 09:38:38 UTC (rev 4231) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-18 09:40:11 UTC (rev 4232) @@ -1,4 +1,8 @@ +import sys +import os + from os.path import join as pjoin, dirname as pdirname, basename as pbasename +from copy import deepcopy from code_generators.generate_array_api import \ do_generate_api as nowrap_do_generate_array_api @@ -7,6 +11,8 @@ from numpy.distutils.conv_template import process_str +import SCons.Node + def split_ext(string): sp = string.rsplit('.', 1) if len(sp) == 1: @@ -80,3 +86,96 @@ t = str(target[0]) + '.c' return ([t], source) +#------------------- +# Generate config.h +#------------------- +def generate_config_header(target, source, env): + t = open(str(target[0]), 'w') + if not env.has_key('CONFIG_H_GEN'): + # XXX + assert 0 == 1 + sym = env['CONFIG_H_GEN'] + def write_symbol(define, value): + if value == 1: + return "#define %s\n\n" % define + elif value == 0: + return "/* #undef %s */\n\n" % define + else: + return "#define %s %s\n\n" % (define, value) + t.writelines([write_symbol(i[0], i[1]) for i in sym]) + t.write('\n') + t.close() + + print 'File: %s' % target[0] + target_f = open(str(target[0])) + print target_f.read() + target_f.close() + print 'EOF' + return 0 + +def generate_config_header_emitter(target, source, env): + """Add dependency from config list CONFIG_H_GEN to target. Returns + original target, source tuple unchanged. """ + from SCons.Script import * + d = deepcopy(env['CONFIG_H_GEN']) # copy it + Depends(target, SCons.Node.Python.Value(d)) + return target, source + +#----------------------------------------- +# Other functions related to configuration +#----------------------------------------- +def CheckBrokenMathlib(context, mathlib): + src = """ +/* check whether libm is broken */ +#include +int main(int argc, char *argv[]) +{ + return exp(-720.) > 1.0; /* typically an IEEE denormal */ +} +""" + + try: + oldLIBS = deepcopy(context.env['LIBS']) + except: + oldLIBS = [] + + try: + context.Message("Checking if math lib %s is broken ... " % mathlib) + context.env.AppendUnique(LIBS = mathlib) + st = context.TryRun(src, '.c') + finally: + context.env['LIBS'] = oldLIBS + + if st[0]: + context.Result(' not broken !') + else: + context.Result(' broken !') + return st[0] + +def define_no_smp(): + """Returns True if we should define NPY_NOSMP, False otherwise.""" + #-------------------------------- + # Checking SMP and thread options + #-------------------------------- + # Python 2.3 causes a segfault when + # trying to re-acquire the thread-state + # which is done in error-handling + # ufunc code. NPY_ALLOW_C_API and friends + # cause the segfault. So, we disable threading + # for now. + if sys.version[:5] < '2.4.2': + nosmp = 1 + else: + # Perhaps a fancier check is in order here. + # so that threads are only enabled if there + # are actually multiple CPUS? -- but + # threaded code can be nice even on a single + # CPU so that long-calculating code doesn't + # block. + try: + nosmp = os.environ['NPY_NOSMP'] + nosmp = 1 + except KeyError: + nosmp = 0 + return nosmp == 1 + From numpy-svn at scipy.org Thu Oct 18 05:43:52 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 04:43:52 -0500 (CDT) Subject: [Numpy-svn] r4233 - branches/numpy.scons/numpy/core Message-ID: <20071018094352.768AE39C041@new.scipy.org> Author: cdavid Date: 2007-10-18 04:43:48 -0500 (Thu, 18 Oct 2007) New Revision: 4233 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Remove unused scons import in numpy/core sconscript Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-18 09:40:11 UTC (rev 4232) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-18 09:43:48 UTC (rev 4233) @@ -8,8 +8,6 @@ from numpy.distutils.scons import get_python_inc from numpy.distutils.scons import GetNumpyEnvironment, CheckTypeSize -import SCons.Node - from scons_support import CheckBrokenMathlib, define_no_smp, \ generate_config_header, generate_config_header_emitter From numpy-svn at scipy.org Thu Oct 18 08:34:54 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 07:34:54 -0500 (CDT) Subject: [Numpy-svn] r4234 - in branches/numpy.scons/numpy/distutils: command scons Message-ID: <20071018123454.29CDCC7C05D@new.scipy.org> Author: cdavid Date: 2007-10-18 07:34:47 -0500 (Thu, 18 Oct 2007) New Revision: 4234 Modified: branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Add option to scons command to bootstrap numpy Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-18 09:43:48 UTC (rev 4233) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-18 12:34:47 UTC (rev 4234) @@ -7,6 +7,7 @@ from numpy.distutils.command.build_ext import build_ext as old_build_ext from numpy.distutils.ccompiler import CCompiler from numpy.distutils.exec_command import find_executable +from numpy.distutils import log def get_scons_build_dir(): """Return the top path where everything produced by scons will be put. @@ -30,6 +31,13 @@ import sys return sys.executable +def dirl_to_str(dirlist): + """Given a list of directories, returns a string where the paths are + concatenated by the path separator. + + example: ['foo/bar', 'bar/foo'] will return 'foo/bar:bar/foo'.""" + return os.pathsep.join(dirlist) + def dist2sconscc(compiler): """This converts the name passed to distutils to scons name convention (C compiler). The argument should be a CCompiler instance. @@ -132,6 +140,7 @@ scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py')) for sconscript, pre_hook, post_hook in self.scons_scripts: # XXX: This is inefficient... (use join instead) + from numpy.distutils.misc_util import get_numpy_include_dirs cmd = scons_exec + " -f " + sconscript + ' -I. ' if self.jobs: cmd += " --jobs=%d " % int(self.jobs) @@ -140,6 +149,8 @@ pdirname(sconscript))) cmd += ' cc_opt=%s ' % dist2sconscc(self.compiler) cmd += ' cc_opt_path=%s ' % protect_path(get_tool_path(self.compiler)) + cmd += ' include_bootstrap=%s ' % dirl_to_str(get_numpy_include_dirs()) + log.info("Executing scons command: %s ", cmd) st = os.system(cmd) if st: print "status is %d" % st Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-18 09:43:48 UTC (rev 4233) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-18 12:34:47 UTC (rev 4234) @@ -1,4 +1,5 @@ from numpyenv import GetNumpyEnvironment, GetNumpyOptions from libinfo_scons import NumpyCheckLib +from libinfo import get_paths as scons_get_paths from custom_checkers import CheckTypeSize from extension import get_python_inc Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-18 09:43:48 UTC (rev 4233) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-18 12:34:47 UTC (rev 4234) @@ -59,6 +59,10 @@ opts.Add('distutils_libdir', 'build dir for libraries of distutils (NOT including the package name)', pjoin('build', 'lib')) + opts.Add('include_bootstrap', + "include directories for boostraping numpy (if you do not know" \ + " what that means, you don't need it)" , + '') # Add compiler related info opts.Add('cc_opt', 'name of C compiler', '') From numpy-svn at scipy.org Thu Oct 18 08:40:34 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 07:40:34 -0500 (CDT) Subject: [Numpy-svn] r4235 - branches/numpy.scons/numpy/fft Message-ID: <20071018124034.78C4E39C041@new.scipy.org> Author: cdavid Date: 2007-10-18 07:40:30 -0500 (Thu, 18 Oct 2007) New Revision: 4235 Modified: branches/numpy.scons/numpy/fft/setupscons.py Log: fft consified Modified: branches/numpy.scons/numpy/fft/setupscons.py =================================================================== --- branches/numpy.scons/numpy/fft/setupscons.py 2007-10-18 12:34:47 UTC (rev 4234) +++ branches/numpy.scons/numpy/fft/setupscons.py 2007-10-18 12:40:30 UTC (rev 4235) @@ -1,12 +1,13 @@ +def configuration(parent_package = '', top_path = None): + from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs + config = Configuration('fft', parent_package, top_path) + config.add_data_dir('tests') -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('fft',parent_package,top_path) + print "!!!!!! %s !!!!!!!!!" % get_numpy_include_dirs() - config.add_data_dir('tests') - # Configure fftpack_lite + config.add_sconscript('SConstruct') config.add_extension('fftpack_lite', sources=['fftpack_litemodule.c', 'fftpack.c'] ) From numpy-svn at scipy.org Thu Oct 18 08:44:37 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 07:44:37 -0500 (CDT) Subject: [Numpy-svn] r4236 - in branches/numpy.scons/numpy: fft lib Message-ID: <20071018124437.43A4839C05A@new.scipy.org> Author: cdavid Date: 2007-10-18 07:44:32 -0500 (Thu, 18 Oct 2007) New Revision: 4236 Modified: branches/numpy.scons/numpy/fft/setupscons.py branches/numpy.scons/numpy/lib/setupscons.py Log: numpy/lib sconsified Modified: branches/numpy.scons/numpy/fft/setupscons.py =================================================================== --- branches/numpy.scons/numpy/fft/setupscons.py 2007-10-18 12:40:30 UTC (rev 4235) +++ branches/numpy.scons/numpy/fft/setupscons.py 2007-10-18 12:44:32 UTC (rev 4236) @@ -4,15 +4,9 @@ config.add_data_dir('tests') - print "!!!!!! %s !!!!!!!!!" % get_numpy_include_dirs() - # Configure fftpack_lite config.add_sconscript('SConstruct') - config.add_extension('fftpack_lite', - sources=['fftpack_litemodule.c', 'fftpack.c'] - ) - return config if __name__ == '__main__': Modified: branches/numpy.scons/numpy/lib/setupscons.py =================================================================== --- branches/numpy.scons/numpy/lib/setupscons.py 2007-10-18 12:40:30 UTC (rev 4235) +++ branches/numpy.scons/numpy/lib/setupscons.py 2007-10-18 12:44:32 UTC (rev 4236) @@ -5,13 +5,7 @@ config = Configuration('lib',parent_package,top_path) - config.add_include_dirs(join('..','core','include')) - - - config.add_extension('_compiled_base', - sources=[join('src','_compiled_base.c')] - ) - + config.add_sconscript('SConstruct') config.add_data_dir('tests') return config From numpy-svn at scipy.org Thu Oct 18 08:58:24 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 07:58:24 -0500 (CDT) Subject: [Numpy-svn] r4237 - in branches/numpy.scons/numpy: fft lib linalg Message-ID: <20071018125824.5668E39C05A@new.scipy.org> Author: cdavid Date: 2007-10-18 07:58:14 -0500 (Thu, 18 Oct 2007) New Revision: 4237 Added: branches/numpy.scons/numpy/fft/SConstruct branches/numpy.scons/numpy/lib/SConstruct branches/numpy.scons/numpy/linalg/SConstruct Modified: branches/numpy.scons/numpy/linalg/setupscons.py Log: linalg sconsified (wo lapack support), added forgotten SConscript Added: branches/numpy.scons/numpy/fft/SConstruct =================================================================== --- branches/numpy.scons/numpy/fft/SConstruct 2007-10-18 12:44:32 UTC (rev 4236) +++ branches/numpy.scons/numpy/fft/SConstruct 2007-10-18 12:58:14 UTC (rev 4237) @@ -0,0 +1,10 @@ +# Last Change: Thu Oct 18 09:00 PM 2007 J +# vim:syntax=python +from numpy.distutils.misc_util import get_numpy_include_dirs +from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths + +env = GetNumpyEnvironment(ARGUMENTS) +env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) + +fftpack_lite = env.NumpyPythonExtension('fftpack_litemodule', + source = ['fftpack_litemodule.c', 'fftpack.c']) Added: branches/numpy.scons/numpy/lib/SConstruct =================================================================== --- branches/numpy.scons/numpy/lib/SConstruct 2007-10-18 12:44:32 UTC (rev 4236) +++ branches/numpy.scons/numpy/lib/SConstruct 2007-10-18 12:58:14 UTC (rev 4237) @@ -0,0 +1,10 @@ +# Last Change: Thu Oct 18 09:00 PM 2007 J +# vim:syntax=python +from numpy.distutils.misc_util import get_numpy_include_dirs +from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths + +env = GetNumpyEnvironment(ARGUMENTS) +env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) + +_compiled_base = env.NumpyPythonExtension('_compiled_base', + source = ['src/_compiled_base.c']) Added: branches/numpy.scons/numpy/linalg/SConstruct =================================================================== --- branches/numpy.scons/numpy/linalg/SConstruct 2007-10-18 12:44:32 UTC (rev 4236) +++ branches/numpy.scons/numpy/linalg/SConstruct 2007-10-18 12:58:14 UTC (rev 4237) @@ -0,0 +1,12 @@ +# Last Change: Thu Oct 18 09:00 PM 2007 J +# vim:syntax=python +from numpy.distutils.misc_util import get_numpy_include_dirs +from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths + +env = GetNumpyEnvironment(ARGUMENTS) +env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) + +sources = ['lapack_litemodule.c', 'zlapack_lite.c', 'dlapack_lite.c', + 'blas_lite.c', 'dlamch.c', 'f2c_lite.c'] +lapack_lite = env.NumpyPythonExtension('lapack_lite', source = sources) + Modified: branches/numpy.scons/numpy/linalg/setupscons.py =================================================================== --- branches/numpy.scons/numpy/linalg/setupscons.py 2007-10-18 12:44:32 UTC (rev 4236) +++ branches/numpy.scons/numpy/linalg/setupscons.py 2007-10-18 12:58:14 UTC (rev 4237) @@ -6,23 +6,9 @@ config.add_data_dir('tests') - # Configure lapack_lite - lapack_info = get_info('lapack_opt',0) - def get_lapack_lite_sources(ext, build_dir): - if not lapack_info: - print "### Warning: Using unoptimized lapack ###" - return ext.depends[:-1] - else: - return ext.depends[:1] + print "### Warning: Using unoptimized lapack ###" - config.add_extension('lapack_lite', - sources = [get_lapack_lite_sources], - depends= ['lapack_litemodule.c', - 'zlapack_lite.c', 'dlapack_lite.c', - 'blas_lite.c', 'dlamch.c', - 'f2c_lite.c','f2c.h'], - extra_info = lapack_info - ) + config.add_sconscript('SConstruct') return config From numpy-svn at scipy.org Thu Oct 18 09:35:32 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 08:35:32 -0500 (CDT) Subject: [Numpy-svn] r4238 - branches/numpy.scons/numpy/random Message-ID: <20071018133532.D42E9C7C06B@new.scipy.org> Author: cdavid Date: 2007-10-18 08:35:27 -0500 (Thu, 18 Oct 2007) New Revision: 4238 Added: branches/numpy.scons/numpy/random/SConstruct Modified: branches/numpy.scons/numpy/random/setupscons.py Log: random module sconsified Added: branches/numpy.scons/numpy/random/SConstruct =================================================================== --- branches/numpy.scons/numpy/random/SConstruct 2007-10-18 12:58:14 UTC (rev 4237) +++ branches/numpy.scons/numpy/random/SConstruct 2007-10-18 13:35:27 UTC (rev 4238) @@ -0,0 +1,27 @@ +# Last Change: Thu Oct 18 10:00 PM 2007 J +# vim:syntax=python +import os + +from numpy.distutils.misc_util import get_numpy_include_dirs +from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths + +env = GetNumpyEnvironment(ARGUMENTS) +env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) + +mathlib = os.environ.get('MATHLIB') +if mathlib: + # XXX: prepend it ? + mlib = mathlib +else: + mlib = 'm' +env.Append(LIBS = mlib) + +import sys +if sys.platform == 'win32': + assert 0 == 1, 'FIXME: support Advapi32 detection for win32 in mtrand' + +sources = [os.path.join('mtrand', x) for x in + ['mtrand.c', 'randomkit.c', 'initarray.c', 'distributions.c']] + +# XXX: Pyrex dependency +mtrand = env.NumpyPythonExtension('mtrand', source = sources) Modified: branches/numpy.scons/numpy/random/setupscons.py =================================================================== --- branches/numpy.scons/numpy/random/setupscons.py 2007-10-18 12:58:14 UTC (rev 4237) +++ branches/numpy.scons/numpy/random/setupscons.py 2007-10-18 13:35:27 UTC (rev 4238) @@ -4,34 +4,7 @@ from numpy.distutils.misc_util import Configuration, get_mathlibs config = Configuration('random',parent_package,top_path) - def generate_libraries(ext, build_dir): - config_cmd = config.get_config_cmd() - if top_path is None: - libs = get_mathlibs() - else: - #path = join(split(build_dir)[0],'core') - # XXX - path = join(config.get_scons_build_dir(), 'numpy','core') - libs = get_mathlibs(path) - tc = testcode_wincrypt() - if config_cmd.try_run(tc): - libs.append('Advapi32') - ext.libraries.extend(libs) - return None - - libs = [] - # Configure mtrand - config.add_extension('mtrand', - sources=[join('mtrand', x) for x in - ['mtrand.c', 'randomkit.c', 'initarray.c', - 'distributions.c']]+[generate_libraries], - libraries=libs, - depends = [join('mtrand','*.h'), - join('mtrand','*.pyx'), - join('mtrand','*.pxi'), - ] - ) - + config.add_sconscript('SConstruct') config.add_data_files(('.', join('mtrand', 'randomkit.h'))) config.add_data_dir('tests') From numpy-svn at scipy.org Thu Oct 18 09:36:57 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 08:36:57 -0500 (CDT) Subject: [Numpy-svn] r4239 - branches/numpy.scons/numpy/core Message-ID: <20071018133657.EDBF8C7C057@new.scipy.org> Author: cdavid Date: 2007-10-18 08:36:54 -0500 (Thu, 18 Oct 2007) New Revision: 4239 Modified: branches/numpy.scons/numpy/core/scons_support.py Log: Avoid * import from scons Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-10-18 13:35:27 UTC (rev 4238) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-18 13:36:54 UTC (rev 4239) @@ -116,7 +116,7 @@ def generate_config_header_emitter(target, source, env): """Add dependency from config list CONFIG_H_GEN to target. Returns original target, source tuple unchanged. """ - from SCons.Script import * + from SCons.Script import Depends d = deepcopy(env['CONFIG_H_GEN']) # copy it Depends(target, SCons.Node.Python.Value(d)) return target, source From numpy-svn at scipy.org Thu Oct 18 09:37:30 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 08:37:30 -0500 (CDT) Subject: [Numpy-svn] r4240 - branches/numpy.scons Message-ID: <20071018133730.A1D1AC7C057@new.scipy.org> Author: cdavid Date: 2007-10-18 08:37:26 -0500 (Thu, 18 Oct 2007) New Revision: 4240 Modified: branches/numpy.scons/test.sh Log: Update test shell script to use jobs Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-10-18 13:36:54 UTC (rev 4239) +++ branches/numpy.scons/test.sh 2007-10-18 13:37:26 UTC (rev 4240) @@ -1,7 +1,7 @@ -PREFIX=/usr/media/src/src/dsp/bzrversion/numpy.scons/tmp -rm -rf build -rm -rf $PREFIX -python setupscons.py scons -python setupscons.py build -python setupscons.py install --prefix=$PREFIX -(cd $PREFIX && PYTHONPATH=$PREFIX/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") +PREFIX=/usr/media/src/src/dsp/numpy/numpy.scons/ +rm -rf $PREFIX/build +rm -rf $PREFIX/tmp +python setup.py scons --jobs=4 +python setup.py build +python setup.py install --prefix=$PREFIX/tmp +(cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") From numpy-svn at scipy.org Thu Oct 18 11:18:59 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 10:18:59 -0500 (CDT) Subject: [Numpy-svn] r4241 - in trunk/numpy: core/include/numpy distutils lib Message-ID: <20071018151859.515C339C041@new.scipy.org> Author: oliphant Date: 2007-10-18 10:18:57 -0500 (Thu, 18 Oct 2007) New Revision: 4241 Modified: trunk/numpy/core/include/numpy/ndarrayobject.h trunk/numpy/distutils/system_info.py trunk/numpy/lib/function_base.py Log: Fix vectorize to work with strings. Fix where 64-bit looks for X11 libraries. Fix comment. Modified: trunk/numpy/core/include/numpy/ndarrayobject.h =================================================================== --- trunk/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 13:37:26 UTC (rev 4240) +++ trunk/numpy/core/include/numpy/ndarrayobject.h 2007-10-18 15:18:57 UTC (rev 4241) @@ -1282,7 +1282,7 @@ and WRITEABLE. */ #define NPY_ENSURECOPY 0x0020 -/* Make sure the returned array is an ndarray or a bigndarray */ +/* Make sure the returned array is a base-class ndarray */ #define NPY_ENSUREARRAY 0x0040 /* Make sure that the strides are in units of the element size Modified: trunk/numpy/distutils/system_info.py =================================================================== --- trunk/numpy/distutils/system_info.py 2007-10-18 13:37:26 UTC (rev 4240) +++ trunk/numpy/distutils/system_info.py 2007-10-18 15:18:57 UTC (rev 4241) @@ -143,7 +143,18 @@ '/opt/include', '/usr/include', '/opt/local/include', '/sw/include'] default_src_dirs = ['.','/usr/local/src', '/opt/src','/sw/src'] - default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib','/usr/lib'] + + try: + platform = os.uname() + bit64 = platform[-1].endswith('64') + except: + bit64 = False + + if bit64: + default_x11_lib_dirs = ['/usr/lib64'] + else: + default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib','/usr/lib'] + default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include', '/usr/include'] Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2007-10-18 13:37:26 UTC (rev 4240) +++ trunk/numpy/lib/function_base.py 2007-10-18 15:18:57 UTC (rev 4241) @@ -914,6 +914,7 @@ raise ValueError, "mismatch between python function inputs"\ " and received arguments" + # we need a new ufunc if this is being called with more arguments. if (self.lastcallargs != nargs): self.lastcallargs = nargs self.ufunc = None @@ -935,14 +936,17 @@ otypes.append(asarray(theout[k]).dtype.char) self.otypes = ''.join(otypes) + # Create ufunc if not already created if (self.ufunc is None): self.ufunc = frompyfunc(self.thefunc, nargs, self.nout) + # Convert to object arrays first + newargs = [asarray(arg,dtype=object) for arg in args] if self.nout == 1: - _res = array(self.ufunc(*args),copy=False).astype(self.otypes[0]) + _res = array(self.ufunc(*newargs),copy=False).astype(self.otypes[0]) else: _res = tuple([array(x,copy=False).astype(c) \ - for x, c in zip(self.ufunc(*args), self.otypes)]) + for x, c in zip(self.ufunc(*newargs), self.otypes)]) return _res def cov(m, y=None, rowvar=1, bias=0): From numpy-svn at scipy.org Thu Oct 18 19:23:38 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 18:23:38 -0500 (CDT) Subject: [Numpy-svn] r4242 - branches/numpy.scons/numpy/core Message-ID: <20071018232338.00F7739C049@new.scipy.org> Author: cdavid Date: 2007-10-18 18:23:34 -0500 (Thu, 18 Oct 2007) New Revision: 4242 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Typo in Sconstruct of numpy.core preventing configuration to work with python2.3 Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-18 15:18:57 UTC (rev 4241) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-18 23:23:34 UTC (rev 4242) @@ -1,4 +1,4 @@ -# Last Change: Thu Oct 18 06:00 PM 2007 J +# Last Change: Fri Oct 19 08:00 AM 2007 J # vim:syntax=python import os import sys @@ -107,7 +107,7 @@ # XXX: would be better to check for PyOS_ascii_strod instead of version if sys.version[:3] < '2.4': if config.CheckFunc('strtod'): - config_sym.append('PyOS_ascii_strtod', 'strtod') + config_sym.append(('PyOS_ascii_strtod', 'strtod')) if define_no_smp(): config_sym.append(('NPY_NOSMP', '1')) From numpy-svn at scipy.org Thu Oct 18 19:42:00 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 18:42:00 -0500 (CDT) Subject: [Numpy-svn] r4243 - trunk/numpy/lib Message-ID: <20071018234200.5AB5839C049@new.scipy.org> Author: oliphant Date: 2007-10-18 18:41:59 -0500 (Thu, 18 Oct 2007) New Revision: 4243 Modified: trunk/numpy/lib/function_base.py Log: Allow subclasses through vectorize. Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2007-10-18 23:23:34 UTC (rev 4242) +++ trunk/numpy/lib/function_base.py 2007-10-18 23:41:59 UTC (rev 4243) @@ -941,7 +941,7 @@ self.ufunc = frompyfunc(self.thefunc, nargs, self.nout) # Convert to object arrays first - newargs = [asarray(arg,dtype=object) for arg in args] + newargs = [asanyarray(arg,dtype=object) for arg in args] if self.nout == 1: _res = array(self.ufunc(*newargs),copy=False).astype(self.otypes[0]) else: From numpy-svn at scipy.org Thu Oct 18 20:08:34 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 19:08:34 -0500 (CDT) Subject: [Numpy-svn] r4244 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071019000834.9EBF239C058@new.scipy.org> Author: cdavid Date: 2007-10-18 19:08:30 -0500 (Thu, 18 Oct 2007) New Revision: 4244 Modified: branches/numpy.scons/numpy/distutils/scons/utils.py Log: Add rsplit function for python < 2.4 Modified: branches/numpy.scons/numpy/distutils/scons/utils.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-18 23:41:59 UTC (rev 4243) +++ branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-19 00:08:30 UTC (rev 4244) @@ -42,6 +42,24 @@ except KeyError, e: return [] +def rsplit(s, sep, max = -1): + """Equivalent of rsplit, but works on 2.3.""" + try: + return s.rsplit(sep, max) + except AttributeError: + return _rsplit(s, sep, max) + +def _rsplit(s, sep, max): + """Equivalent of rsplit, but works on 2.3.""" + l = s.split(sep) + if max < 0: + return l[-len(l):] + elif max == 0: + return [s] + else: + st = sep.join(l[0:-max]) + return [st] + l[-max:] + class curry: def __init__(self, fun, *args, **kwargs): self.fun = fun @@ -56,3 +74,13 @@ kw = kwargs or self.kwargs return self.fun(*(self.pending + args), **kw) + +if __name__ == '__main__': + a1 = 'a.b.c' + assert a1.split('.', -1) == a1.rsplit('.', -1) == _rsplit(a1, '.', -1) + + assert a1.rsplit('.', 1) == _rsplit(a1, '.', 1) + + assert a1.rsplit('.', 0) == _rsplit(a1, '.', 0) + + assert a1.rsplit('.', 2) == _rsplit(a1, '.', 2) From numpy-svn at scipy.org Thu Oct 18 20:09:07 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 19:09:07 -0500 (CDT) Subject: [Numpy-svn] r4245 - branches/numpy.scons/numpy/core Message-ID: <20071019000907.5DD51C7C040@new.scipy.org> Author: cdavid Date: 2007-10-18 19:09:02 -0500 (Thu, 18 Oct 2007) New Revision: 4245 Modified: branches/numpy.scons/numpy/core/scons_support.py Log: Replace rsplit string method by our custom rsplit, to support python 2.3 Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-10-19 00:08:30 UTC (rev 4244) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-19 00:09:02 UTC (rev 4245) @@ -10,11 +10,12 @@ do_generate_api as nowrap_do_generate_ufunc_api from numpy.distutils.conv_template import process_str +from numpy.distutils.scons.utils import rsplit import SCons.Node def split_ext(string): - sp = string.rsplit('.', 1) + sp = rsplit(string, '.', 1) if len(sp) == 1: return (sp[0], '') else: From numpy-svn at scipy.org Thu Oct 18 20:54:55 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 19:54:55 -0500 (CDT) Subject: [Numpy-svn] r4246 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071019005455.4B0FC39C195@new.scipy.org> Author: cdavid Date: 2007-10-18 19:54:51 -0500 (Thu, 18 Oct 2007) New Revision: 4246 Modified: branches/numpy.scons/numpy/distutils/scons/utils.py Log: Bug in rsplit replacement when no sep in string fixed Modified: branches/numpy.scons/numpy/distutils/scons/utils.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-19 00:09:02 UTC (rev 4245) +++ branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-19 00:54:51 UTC (rev 4246) @@ -52,10 +52,10 @@ def _rsplit(s, sep, max): """Equivalent of rsplit, but works on 2.3.""" l = s.split(sep) - if max < 0: + if len(l) < 2 or max == 0: + return [s] + elif max < 0: return l[-len(l):] - elif max == 0: - return [s] else: st = sep.join(l[0:-max]) return [st] + l[-max:] @@ -84,3 +84,7 @@ assert a1.rsplit('.', 0) == _rsplit(a1, '.', 0) assert a1.rsplit('.', 2) == _rsplit(a1, '.', 2) + + a2 = 'floupi' + assert a2.rsplit('.') == _rsplit(a2, '.', -1) + assert a2.rsplit('.', 1) == _rsplit(a2, '.', 1) From numpy-svn at scipy.org Thu Oct 18 21:10:58 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 20:10:58 -0500 (CDT) Subject: [Numpy-svn] r4247 - in branches/numpy.scons/numpy: core numarray Message-ID: <20071019011058.4E87639C043@new.scipy.org> Author: cdavid Date: 2007-10-18 20:10:52 -0500 (Thu, 18 Oct 2007) New Revision: 4247 Modified: branches/numpy.scons/numpy/core/scons_support.py branches/numpy.scons/numpy/numarray/setupscons.py Log: numerarry sconsified Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-10-19 00:54:51 UTC (rev 4246) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-19 01:10:52 UTC (rev 4247) @@ -10,7 +10,7 @@ do_generate_api as nowrap_do_generate_ufunc_api from numpy.distutils.conv_template import process_str -from numpy.distutils.scons.utils import rsplit +from numpy.distutils.scons.utils import _rsplit as rsplit import SCons.Node Modified: branches/numpy.scons/numpy/numarray/setupscons.py =================================================================== --- branches/numpy.scons/numpy/numarray/setupscons.py 2007-10-19 00:54:51 UTC (rev 4246) +++ branches/numpy.scons/numpy/numarray/setupscons.py 2007-10-19 01:10:52 UTC (rev 4247) @@ -5,11 +5,8 @@ config = Configuration('numarray',parent_package,top_path) config.add_data_files('numpy/') + config.add_sconscript('SConstruct') - config.add_extension('_capi', - sources=['_capi.c'], - ) - return config if __name__ == '__main__': From numpy-svn at scipy.org Thu Oct 18 21:31:55 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 20:31:55 -0500 (CDT) Subject: [Numpy-svn] r4248 - branches/numpy.scons/numpy/core Message-ID: <20071019013155.20973C7C040@new.scipy.org> Author: cdavid Date: 2007-10-18 20:31:51 -0500 (Thu, 18 Oct 2007) New Revision: 4248 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Add blasdot include path Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-19 01:10:52 UTC (rev 4247) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-19 01:31:51 UTC (rev 4248) @@ -1,4 +1,4 @@ -# Last Change: Fri Oct 19 08:00 AM 2007 J +# Last Change: Fri Oct 19 10:00 AM 2007 J # vim:syntax=python import os import sys @@ -172,6 +172,9 @@ #------------------------ # Generate generated code #------------------------ +# XXX: the use of env['build_dir'] and env['src_dir'] are really ugly. Will +# have to think about how removing them (using hierarchical scons and dir +# option ?) from os.path import join as pjoin config_header = env.GenerateConfigHeader(pjoin(env['build_dir'], 'config.h'), []) @@ -239,4 +242,6 @@ # Build _dotblas module #---------------------- dotblas_src = [pjoin('blasdot', i) for i in ['_dotblas.c']] -dotblas = env.NumpyPythonExtension('_dotblas', source = dotblas_src) +blasenv = env.Copy() +blasenv.Append(CPPPATH = pjoin(env['src_dir'], 'blasdot')) +dotblas = blasenv.NumpyPythonExtension('_dotblas', source = dotblas_src) From numpy-svn at scipy.org Thu Oct 18 22:36:08 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 21:36:08 -0500 (CDT) Subject: [Numpy-svn] r4249 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071019023608.01B4339C042@new.scipy.org> Author: cdavid Date: 2007-10-18 21:36:04 -0500 (Thu, 18 Oct 2007) New Revision: 4249 Modified: branches/numpy.scons/numpy/distutils/scons/extension_scons.py Log: LDMODULE buidler of scons does not propgate LDMODULESUFFIX to SHAREDSUFFIX, so we set both vars to the same value Modified: branches/numpy.scons/numpy/distutils/scons/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-19 01:31:51 UTC (rev 4248) +++ branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-10-19 02:36:04 UTC (rev 4249) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Thu Oct 11 03:00 PM 2007 J +# Last Change: Fri Oct 19 11:00 AM 2007 J # Module for support to build python extension. scons specific code goes here. import sys @@ -36,6 +36,8 @@ # Use LoadableModule because of Mac OS X wrap = env.LoadableModule(target, source, SHLIBPREFIX = '', - LDMODULESUFFIX = '$PYEXTSUFFIX', LINKFLAGS = LINKFLAGS, - CPPPATH = CPPPATH, *args, **kw) + LDMODULESUFFIX = '$PYEXTSUFFIX', + SHLIBSUFFIX = '$PYEXTSUFFIX', + LINKFLAGS = LINKFLAGS, + CPPPATH = CPPPATH, *args, **kw) return wrap From numpy-svn at scipy.org Thu Oct 18 22:39:29 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 21:39:29 -0500 (CDT) Subject: [Numpy-svn] r4250 - branches/numpy.scons/numpy/numarray Message-ID: <20071019023929.74FDB39C046@new.scipy.org> Author: cdavid Date: 2007-10-18 21:39:25 -0500 (Thu, 18 Oct 2007) New Revision: 4250 Added: branches/numpy.scons/numpy/numarray/SConstruct Log: Add forgotten Sconscript for numpy/numarray Added: branches/numpy.scons/numpy/numarray/SConstruct =================================================================== --- branches/numpy.scons/numpy/numarray/SConstruct 2007-10-19 02:36:04 UTC (rev 4249) +++ branches/numpy.scons/numpy/numarray/SConstruct 2007-10-19 02:39:25 UTC (rev 4250) @@ -0,0 +1,9 @@ +# Last Change: Fri Oct 19 09:00 AM 2007 J +# vim:syntax=python +from numpy.distutils.misc_util import get_numpy_include_dirs +from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths + +env = GetNumpyEnvironment(ARGUMENTS) +env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) + +_capi = env.NumpyPythonExtension('_capi', source = ['_capi.c']) From numpy-svn at scipy.org Thu Oct 18 23:20:10 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 22:20:10 -0500 (CDT) Subject: [Numpy-svn] r4251 - in branches/numpy.scons/numpy: distutils/scons scons_fake/hook Message-ID: <20071019032010.5D49239C04C@new.scipy.org> Author: cdavid Date: 2007-10-18 22:20:02 -0500 (Thu, 18 Oct 2007) New Revision: 4251 Added: branches/numpy.scons/numpy/scons_fake/hook/SConstruct branches/numpy.scons/numpy/scons_fake/hook/hello.c Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Avoid sconscript wo target in examples Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-19 02:39:25 UTC (rev 4250) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-19 03:20:02 UTC (rev 4251) @@ -135,16 +135,17 @@ from utils import curry NumpyConfigure = curry(env.Configure, conf_dir = pjoin(env['build_dir'], '.sconf')) env.NumpyConfigure = NumpyConfigure - # XXX: Huge, ungly hack ! SConsign needs an absolute path or a path + # XXX: Huge, ugly hack ! SConsign needs an absolute path or a path # relative to where the SConstruct file is. We have to find the path of # the build dir relative to the src_dir: we add n .., where n is the number # of occureant of the path separator in the src dir. def get_build_relative_src(srcdir, builddir): n = srcdir.count(os.sep) + 1 - return pjoin(os.sep.join([r'..' for i in range(n)]), builddir) - env.SConsignFile(pjoin(get_build_relative_src(env['src_dir'], - env['build_dir']), - '.sconsign.dblite')) + return pjoin(os.sep.join([os.pardir for i in range(n)]), builddir) + sconsign = pjoin(get_build_relative_src(env['src_dir'], + env['build_dir']), + '.sconsign.dblite') + env.SConsignFile(sconsign) # ======================================================================== # Adding default tools for the one we do not customize: mingw is special Added: branches/numpy.scons/numpy/scons_fake/hook/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/hook/SConstruct 2007-10-19 02:39:25 UTC (rev 4250) +++ branches/numpy.scons/numpy/scons_fake/hook/SConstruct 2007-10-19 03:20:02 UTC (rev 4251) @@ -0,0 +1,5 @@ +# vim:syntax=python +from numpy.distutils.scons import GetNumpyEnvironment + +env = GetNumpyEnvironment(ARGUMENTS) +env.NumpySharedLibrary('hello', 'hello.c') Added: branches/numpy.scons/numpy/scons_fake/hook/hello.c =================================================================== --- branches/numpy.scons/numpy/scons_fake/hook/hello.c 2007-10-19 02:39:25 UTC (rev 4250) +++ branches/numpy.scons/numpy/scons_fake/hook/hello.c 2007-10-19 03:20:02 UTC (rev 4251) @@ -0,0 +1,4 @@ +int hello() +{ + return 0; +} From numpy-svn at scipy.org Thu Oct 18 23:27:26 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 22:27:26 -0500 (CDT) Subject: [Numpy-svn] r4252 - branches/numpy.scons/numpy/scons_fake/hook Message-ID: <20071019032726.F16FA39C04C@new.scipy.org> Author: cdavid Date: 2007-10-18 22:27:17 -0500 (Thu, 18 Oct 2007) New Revision: 4252 Modified: branches/numpy.scons/numpy/scons_fake/hook/SConstruct Log: Do not build SharedLibrary in examples because f**** windows needs special declarations to work in the C code. Modified: branches/numpy.scons/numpy/scons_fake/hook/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/hook/SConstruct 2007-10-19 03:20:02 UTC (rev 4251) +++ branches/numpy.scons/numpy/scons_fake/hook/SConstruct 2007-10-19 03:27:17 UTC (rev 4252) @@ -2,4 +2,4 @@ from numpy.distutils.scons import GetNumpyEnvironment env = GetNumpyEnvironment(ARGUMENTS) -env.NumpySharedLibrary('hello', 'hello.c') +env.NumpyCtypes('hello', 'hello.c') From numpy-svn at scipy.org Thu Oct 18 23:47:02 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 22:47:02 -0500 (CDT) Subject: [Numpy-svn] r4253 - trunk/numpy/f2py/lib/extgen Message-ID: <20071019034702.C84C639C04C@new.scipy.org> Author: jarrod.millman Date: 2007-10-18 22:47:00 -0500 (Thu, 18 Oct 2007) New Revision: 4253 Modified: trunk/numpy/f2py/lib/extgen/base.py Log: removing decorators (see #580) Modified: trunk/numpy/f2py/lib/extgen/base.py =================================================================== --- trunk/numpy/f2py/lib/extgen/base.py 2007-10-19 03:27:17 UTC (rev 4252) +++ trunk/numpy/f2py/lib/extgen/base.py 2007-10-19 03:47:00 UTC (rev 4253) @@ -53,7 +53,6 @@ obj = obj.initialize(*args, **kws) # initialize from constructor arguments return obj - @property def components(self): if Component._running_generate: try: @@ -65,6 +64,7 @@ self._generate_components[Component._running_generate_id] = l = list(self._components) return l return self._components + components = property(components) def initialize(self, *components, **options): """ @@ -83,7 +83,6 @@ def __repr__(self): return '%s(%s)' % (self.__class__.__name__, ', '.join([repr(c) for (c,l) in self.components])) - @property def provides(self): """ Return a code idiom name that the current class defines. @@ -93,14 +92,16 @@ if self._provides is None: return '%s_%s' % (self.__class__.__name__, id(self)) return self._provides + provides = property(provides) - @staticmethod def warning(message): #raise RuntimeError('extgen:' + message) print >> sys.stderr, 'extgen:',message - @staticmethod + warning = staticmethod(warning) + def info(message): print >> sys.stderr, message + info = staticmethod(info) def __getattr__(self, attr): if attr.startswith('container_'): # convenience feature @@ -114,7 +115,6 @@ return self __iadd__ = __add__ - @staticmethod def _get_class_names(cls): if not issubclass(cls, Component): return [cls] @@ -122,7 +122,8 @@ for b in cls.__bases__: r += Component._get_class_names(b) return r - + _get_class_names = staticmethod(_get_class_names) + def add(self, component, container_label=None): """ Append component and its target container label to components list. @@ -349,7 +350,6 @@ _registered_components_map = {} - @staticmethod def register(*components): """ Register components so that component classes can use @@ -363,8 +363,8 @@ else: d[provides] = component return + register = staticmethod(register) - @staticmethod def get(provides): """ Return predefined component with given provides property.. @@ -374,12 +374,12 @@ except KeyError: pass raise KeyError('no registered component provides %r' % (provides)) + get = staticmethod(get) - @property def numpy_version(self): import numpy return numpy.__version__ - + numpy_version = property(numpy_version) class Container(object): """ From numpy-svn at scipy.org Fri Oct 19 00:03:21 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 23:03:21 -0500 (CDT) Subject: [Numpy-svn] r4254 - branches/cleanconfig/numpy/core Message-ID: <20071019040321.82BBC39C04C@new.scipy.org> Author: cdavid Date: 2007-10-18 23:03:12 -0500 (Thu, 18 Oct 2007) New Revision: 4254 Modified: branches/cleanconfig/numpy/core/setup.py Log: Fix escape pb on win32 in numpyconfig.h generation Modified: branches/cleanconfig/numpy/core/setup.py =================================================================== --- branches/cleanconfig/numpy/core/setup.py 2007-10-19 03:47:00 UTC (rev 4253) +++ branches/cleanconfig/numpy/core/setup.py 2007-10-19 04:03:12 UTC (rev 4254) @@ -390,6 +390,8 @@ def generate_numpyconfig_code(target): """Return the source code as a string of the code to generate the numpyconfig header file.""" + if sys.platform == 'win32': + target = target.replace('\\','\\\\') # Config symbols to prepend prepends = [('NPY_SIZEOF_SHORT', 'SIZEOF_SHORT'), ('NPY_SIZEOF_INT', 'SIZEOF_INT'), From numpy-svn at scipy.org Fri Oct 19 00:14:23 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 23:14:23 -0500 (CDT) Subject: [Numpy-svn] r4255 - branches/numpy.scons/numpy/core Message-ID: <20071019041423.1D54439C087@new.scipy.org> Author: cdavid Date: 2007-10-18 23:14:17 -0500 (Thu, 18 Oct 2007) New Revision: 4255 Modified: branches/numpy.scons/numpy/core/setup.py Log: Merge back work on cleanconfig Modified: branches/numpy.scons/numpy/core/setup.py =================================================================== --- branches/numpy.scons/numpy/core/setup.py 2007-10-19 04:03:12 UTC (rev 4254) +++ branches/numpy.scons/numpy/core/setup.py 2007-10-19 04:14:17 UTC (rev 4255) @@ -390,6 +390,8 @@ def generate_numpyconfig_code(target): """Return the source code as a string of the code to generate the numpyconfig header file.""" + if sys.platform == 'win32': + target = target.replace('\\','\\\\') # Config symbols to prepend prepends = [('NPY_SIZEOF_SHORT', 'SIZEOF_SHORT'), ('NPY_SIZEOF_INT', 'SIZEOF_INT'), From numpy-svn at scipy.org Fri Oct 19 00:34:02 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 18 Oct 2007 23:34:02 -0500 (CDT) Subject: [Numpy-svn] r4256 - trunk/numpy/lib Message-ID: <20071019043402.2FAEA39C052@new.scipy.org> Author: jarrod.millman Date: 2007-10-18 23:33:58 -0500 (Thu, 18 Oct 2007) New Revision: 4256 Modified: trunk/numpy/lib/function_base.py Log: raise error if histogram is called with a decending range to bin into (see #586) Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2007-10-19 04:14:17 UTC (rev 4255) +++ trunk/numpy/lib/function_base.py 2007-10-19 04:33:58 UTC (rev 4256) @@ -108,6 +108,12 @@ """ a = asarray(a).ravel() + + if (range is not None): + mn, mx = range + if (mn > mx): + raise AttributeError, 'max must be larger than min in range parameter.' + if not iterable(bins): if range is None: range = (a.min(), a.max()) @@ -116,6 +122,9 @@ mn -= 0.5 mx += 0.5 bins = linspace(mn, mx, bins, endpoint=False) + else: + if(any(bins[1:]-bins[:-1] < 0)): + raise AttributeError, 'bins must increase monotonically.' # best block size probably depends on processor cache size block = 65536 From numpy-svn at scipy.org Fri Oct 19 06:14:59 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 19 Oct 2007 05:14:59 -0500 (CDT) Subject: [Numpy-svn] r4257 - branches/numpy.scons/numpy/core Message-ID: <20071019101459.709D2C7C071@new.scipy.org> Author: cdavid Date: 2007-10-19 05:14:54 -0500 (Fri, 19 Oct 2007) New Revision: 4257 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Dump the config.log file for numpy.core Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-19 04:33:58 UTC (rev 4256) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-19 10:14:54 UTC (rev 4257) @@ -1,4 +1,4 @@ -# Last Change: Fri Oct 19 10:00 AM 2007 J +# Last Change: Fri Oct 19 07:00 PM 2007 J # vim:syntax=python import os import sys @@ -121,6 +121,12 @@ config.Finish() +try: + config_file = open('config.log') + for i in config_file.readlines(): + print i +except: + pass #========== # Build #========== From numpy-svn at scipy.org Fri Oct 19 06:44:52 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 19 Oct 2007 05:44:52 -0500 (CDT) Subject: [Numpy-svn] r4258 - in branches/numpy.scons/numpy: core distutils/scons distutils/scons-local/scons-local-0.97.0d20070918/SCons Message-ID: <20071019104452.8313F39C040@new.scipy.org> Author: cdavid Date: 2007-10-19 05:44:43 -0500 (Fri, 19 Oct 2007) New Revision: 4258 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons-local/scons-local-0.97.0d20070918/SCons/Conftest.py branches/numpy.scons/numpy/distutils/scons-local/scons-local-0.97.0d20070918/SCons/SConf.py branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: * Improve the Type checker, and put it in scons-local * Use it instead of previous custom checker (more robust on solaris) Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-19 10:14:54 UTC (rev 4257) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-19 10:44:43 UTC (rev 4258) @@ -6,7 +6,7 @@ from copy import deepcopy from numpy.distutils.scons import get_python_inc -from numpy.distutils.scons import GetNumpyEnvironment, CheckTypeSize +from numpy.distutils.scons import GetNumpyEnvironment from scons_support import CheckBrokenMathlib, define_no_smp, \ generate_config_header, generate_config_header_emitter @@ -17,8 +17,7 @@ #======================= # Starting Configuration #======================= -config = env.NumpyConfigure(custom_tests = {'CheckTypeSize' : CheckTypeSize, - 'CheckBrokenMathlib' : CheckBrokenMathlib}) +config = env.NumpyConfigure(custom_tests = {'CheckBrokenMathlib' : CheckBrokenMathlib}) # Convention: list of tuples (definition, value). value: # - 0: #undef definition @@ -42,8 +41,8 @@ check_type('float') check_type('double') check_type('long double') -check_type('Py_intptr_t', include = ["Python.h"]) -check_type('PY_LONG_LONG', include = ["Python.h"]) +check_type('Py_intptr_t', include = r"#include \n") +check_type('PY_LONG_LONG', include = r"#include \n") # TODO: check python extension can be built (in root or here ?) @@ -123,8 +122,8 @@ try: config_file = open('config.log') - for i in config_file.readlines(): - print i + #for i in config_file.readlines(): + # print i except: pass #========== Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-19 10:14:54 UTC (rev 4257) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-19 10:44:43 UTC (rev 4258) @@ -1,5 +1,5 @@ from numpyenv import GetNumpyEnvironment, GetNumpyOptions from libinfo_scons import NumpyCheckLib from libinfo import get_paths as scons_get_paths -from custom_checkers import CheckTypeSize +#from custom_checkers import CheckTypeSize from extension import get_python_inc Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-19 10:14:54 UTC (rev 4257) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-19 10:44:43 UTC (rev 4258) @@ -1,102 +0,0 @@ -# Sensible default for common types on common platforms. -_DEFAULTS = { - 'short' : [2,], - 'int' : [4, 2], - 'long' : [4, 8], - 'long long' : [8, 4], - # Normally, there is no need to check unsigned types, because they are - # guaranteed to be of the same size than their signed counterpart. - 'unsigned short' : [2,], - 'unsigned int' : [4, 2], - 'unsigned long' : [4, 8], - 'unsigned long long' : [8, 4], - 'float' : [4,], - 'double' : [8,], - 'long double' : [12,], - 'size_t' : [4,], -} - -def CheckTypeSize(context, type, includes = None, language = 'C', size = None): - """This check can be used to get the size of a given type, or to check whether - the type is of expected size. - - Arguments: - - type : str - the type to check - - includes : sequence - list of headers to include in the test code before testing the type - - language : str - 'C' or 'C++' - - size : int - if given, will test wether the type has the given number of bytes. - If not given, will test against a list of sizes (all sizes between - 0 and 16 bytes are tested). - - Returns: - status : int - 0 if the check failed, or the found size of the type if - the check succeeded.""" - minsz = 0 - maxsz = 16 - - if includes: - src = "\n".join([r"#include <%s>\n" % i for i in includes]) - else: - src = "" - - if language == 'C': - ext = '.c' - elif language == 'C++': - ext = '.cpp' - else: - raise NotImplementedError("%s is not a recognized language" % language) - - # test code taken from autoconf: this is a pretty clever hack to find that - # a type is of a given size using only compilation. This speeds things up - # quite a bit compared to straightforward code using TryRun - src += r""" -typedef %s scons_check_type; - -int main() -{ - static int test_array[1 - 2 * !(((long int) (sizeof(scons_check_type))) <= %d)]; - test_array[0] = 0; - - return 0; -} -""" - - if size: - # Only check if the given size is the right one - context.Message('Checking %s is %d bytes... ' % (type, size)) - st = context.TryCompile(src % (type, size), ext) - context.Result(st) - - if st: - return size - else: - return 0 - else: - # Check against a list of sizes. - context.Message('Checking size of %s ... ' % type) - - # Try sensible defaults first - try: - szrange = _DEFAULTS[type] - except KeyError: - szrange = [] - szrange.extend(xrange(minsz, maxsz)) - st = 0 - - # Actual test - for sz in szrange: - st = context.TryCompile(src % (type, sz), ext) - if st: - break - - if st: - context.Result('%d' % sz) - return sz - else: - context.Result('Failed !') - return 0 Modified: branches/numpy.scons/numpy/distutils/scons-local/scons-local-0.97.0d20070918/SCons/Conftest.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons-local/scons-local-0.97.0d20070918/SCons/Conftest.py 2007-10-19 10:14:54 UTC (rev 4257) +++ branches/numpy.scons/numpy/distutils/scons-local/scons-local-0.97.0d20070918/SCons/Conftest.py 2007-10-19 10:44:43 UTC (rev 4258) @@ -422,6 +422,102 @@ return ret +def CheckTypeSize(context, type_name, header = None, language = None, expect = None): + """This check can be used to get the size of a given type, or to check whether + the type is of expected size. + + Arguments: + - type : str + the type to check + - includes : sequence + list of headers to include in the test code before testing the type + - language : str + 'C' or 'C++' + - expect : int + if given, will test wether the type has the given number of bytes. + If not given, will automatically find the size. + + Returns: + status : int + 0 if the check failed, or the found size of the type if the check succeeded.""" + + # Include "confdefs.h" first, so that the header can use HAVE_HEADER_H. + if context.headerfilename: + includetext = '#include "%s"' % context.headerfilename + else: + includetext = '' + + if not header: + header = "" + + lang, suffix, msg = _lang2suffix(language) + if msg: + context.Display("Cannot check for %s type: %s\n" % (type_name, msg)) + return msg + + src = includetext + header + if not expect is None: + # Only check if the given size is the right one + context.Display('Checking %s is %d bytes... ' % (type_name, expect)) + + # test code taken from autoconf: this is a pretty clever hack to find that + # a type is of a given size using only compilation. This speeds things up + # quite a bit compared to straightforward code using TryRun + src += r""" +typedef %s scons_check_type; + +int main() +{ + static int test_array[1 - 2 * !(((long int) (sizeof(scons_check_type))) == %d)]; + test_array[0] = 0; + + return 0; +} +""" + + # XXX: Try* vs CompileProg ? + st = context.TryCompile(src % (type_name, expect), suffix) + if st: + _Have(context, "SIZEOF_" + type_name, str(expect)) + context.Display("yes\n") + return expect + else: + context.Display("no\n") + _LogFailed(context, src, st) + return 0 + else: + # Only check if the given size is the right one + context.Message('Checking size of %s ... ' % type_name) + + # We have to be careful with the program we wish to test here since + # compilation will be attempted using the current environment's flags. + # So make sure that the program will compile without any warning. For + # example using: 'int main(int argc, char** argv)' will fail with the + # '-Wall -Werror' flags since the variables argc and argv would not be + # used in the program... + # + src += """ +#include +#include +int main() { + printf("%d", (int)sizeof(""" + type_name + """)); + return 0; +} + """ + ret = context.TryRun(src, suffix) + st = ret[0] + try: + size = int(ret[1]) + _Have(context, "SIZEOF_" + type_name, str(size)) + context.Display("%d\n" % size) + except ValueError: + size = 0 + _LogFailed(context, src, st) + context.Display(" Failed !\n") + if st: + return size + else: + return 0 # # END OF PUBLIC FUNCTIONS # Modified: branches/numpy.scons/numpy/distutils/scons-local/scons-local-0.97.0d20070918/SCons/SConf.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons-local/scons-local-0.97.0d20070918/SCons/SConf.py 2007-10-19 10:14:54 UTC (rev 4257) +++ branches/numpy.scons/numpy/distutils/scons-local/scons-local-0.97.0d20070918/SCons/SConf.py 2007-10-19 10:44:43 UTC (rev 4258) @@ -395,6 +395,7 @@ default_tests = { 'CheckFunc' : CheckFunc, 'CheckType' : CheckType, + 'CheckTypeSize' : CheckTypeSize, 'CheckHeader' : CheckHeader, 'CheckCHeader' : CheckCHeader, 'CheckCXXHeader' : CheckCXXHeader, @@ -826,6 +827,13 @@ context.did_show_result = 1 return not res +def CheckTypeSize(context, type_name, includes = "", language = None, expect = None): + res = SCons.Conftest.CheckTypeSize(context, type_name, + header = includes, language = language, + expect = expect) + context.did_show_result = 1 + return res + def createIncludesFromHeaders(headers, leaveLast, include_quotes = '""'): # used by CheckHeader and CheckLibWithHeader to produce C - #include # statements from the specified header (list) From numpy-svn at scipy.org Fri Oct 19 15:06:22 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 19 Oct 2007 14:06:22 -0500 (CDT) Subject: [Numpy-svn] r4259 - trunk/numpy/lib Message-ID: <20071019190622.D1ECB39C09B@new.scipy.org> Author: oliphant Date: 2007-10-19 14:06:21 -0500 (Fri, 19 Oct 2007) New Revision: 4259 Modified: trunk/numpy/lib/function_base.py Log: Fix so that vectorize passes sub-classes through. Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2007-10-19 10:44:43 UTC (rev 4258) +++ trunk/numpy/lib/function_base.py 2007-10-19 19:06:21 UTC (rev 4259) @@ -952,9 +952,10 @@ # Convert to object arrays first newargs = [asanyarray(arg,dtype=object) for arg in args] if self.nout == 1: - _res = array(self.ufunc(*newargs),copy=False).astype(self.otypes[0]) + _res = array(self.ufunc(*newargs),copy=False, + subok=True).astype(self.otypes[0]) else: - _res = tuple([array(x,copy=False).astype(c) \ + _res = tuple([array(x,copy=False,subok=True).astype(c) \ for x, c in zip(self.ufunc(*newargs), self.otypes)]) return _res From numpy-svn at scipy.org Fri Oct 19 15:31:18 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 19 Oct 2007 14:31:18 -0500 (CDT) Subject: [Numpy-svn] r4260 - trunk/numpy/lib Message-ID: <20071019193118.D8169C7C06E@new.scipy.org> Author: oliphant Date: 2007-10-19 14:31:16 -0500 (Fri, 19 Oct 2007) New Revision: 4260 Modified: trunk/numpy/lib/function_base.py Log: Avoid extra copy if otype is object on output. Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2007-10-19 19:06:21 UTC (rev 4259) +++ trunk/numpy/lib/function_base.py 2007-10-19 19:31:16 UTC (rev 4260) @@ -950,12 +950,12 @@ self.ufunc = frompyfunc(self.thefunc, nargs, self.nout) # Convert to object arrays first - newargs = [asanyarray(arg,dtype=object) for arg in args] + newargs = [array(arg,copy=False,subok=True,dtype=object) for arg in args] if self.nout == 1: _res = array(self.ufunc(*newargs),copy=False, - subok=True).astype(self.otypes[0]) + subok=True,dtype=self.otypes[0]) else: - _res = tuple([array(x,copy=False,subok=True).astype(c) \ + _res = tuple([array(x,copy=False,subok=True,dtype=c) \ for x, c in zip(self.ufunc(*newargs), self.otypes)]) return _res From numpy-svn at scipy.org Sat Oct 20 06:03:09 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 20 Oct 2007 05:03:09 -0500 (CDT) Subject: [Numpy-svn] r4261 - branches/numpy.scons/numpy/core Message-ID: <20071020100309.3375739C0F6@new.scipy.org> Author: cdavid Date: 2007-10-20 05:03:03 -0500 (Sat, 20 Oct 2007) New Revision: 4261 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/setupscons.py Log: disable _dotblas build in scons Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-19 19:31:16 UTC (rev 4260) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-20 10:03:03 UTC (rev 4261) @@ -1,4 +1,4 @@ -# Last Change: Fri Oct 19 07:00 PM 2007 J +# Last Change: Sat Oct 20 06:00 PM 2007 J # vim:syntax=python import os import sys @@ -243,10 +243,10 @@ scalarmathmodule = env.NumpyPythonExtension('scalarmathmodule', source = scalarmathmodule_src) -#---------------------- -# Build _dotblas module -#---------------------- -dotblas_src = [pjoin('blasdot', i) for i in ['_dotblas.c']] -blasenv = env.Copy() -blasenv.Append(CPPPATH = pjoin(env['src_dir'], 'blasdot')) -dotblas = blasenv.NumpyPythonExtension('_dotblas', source = dotblas_src) +# #---------------------- +# # Build _dotblas module +# #---------------------- +# dotblas_src = [pjoin('blasdot', i) for i in ['_dotblas.c']] +# blasenv = env.Copy() +# blasenv.Append(CPPPATH = pjoin(env['src_dir'], 'blasdot')) +# dotblas = blasenv.NumpyPythonExtension('_dotblas', source = dotblas_src) Modified: branches/numpy.scons/numpy/core/setupscons.py =================================================================== --- branches/numpy.scons/numpy/core/setupscons.py 2007-10-19 19:31:16 UTC (rev 4260) +++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-20 10:03:03 UTC (rev 4261) @@ -74,16 +74,6 @@ if sys.platform == 'cygwin': config.add_data_dir('include/numpy/fenv') - # # Configure blasdot - # blas_info = get_info('blas_opt',0) - # #blas_info = {} - # def get_dotblas_sources(ext, build_dir): - # if blas_info: - # if ('NO_ATLAS_INFO',1) in blas_info.get('define_macros',[]): - # return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient. - # return ext.depends[:1] - # return None # no extension module will be built - config.add_data_dir('tests') config.make_svn_version_py() From numpy-svn at scipy.org Sat Oct 20 08:49:20 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 20 Oct 2007 07:49:20 -0500 (CDT) Subject: [Numpy-svn] r4262 - branches/numpy.scons/numpy Message-ID: <20071020124920.6793D39C134@new.scipy.org> Author: cdavid Date: 2007-10-20 07:49:15 -0500 (Sat, 20 Oct 2007) New Revision: 4262 Modified: branches/numpy.scons/numpy/setupscons.py Log: Add fake extension to fool distutils. Modified: branches/numpy.scons/numpy/setupscons.py =================================================================== --- branches/numpy.scons/numpy/setupscons.py 2007-10-20 10:03:03 UTC (rev 4261) +++ branches/numpy.scons/numpy/setupscons.py 2007-10-20 12:49:15 UTC (rev 4262) @@ -16,6 +16,11 @@ config.add_subpackage('random') config.add_data_dir('doc') config.add_data_dir('tests') + # The following empty extension is done on purpose to fool distutils, and + # process as usual, even if we do not build any extension (because we use + # scons instead). + # !! DO NOT REMOVE THIS !! + config.add_extension('', sources = []) config.make_config_py() # installs __config__.py return config From numpy-svn at scipy.org Sat Oct 20 12:32:58 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 20 Oct 2007 11:32:58 -0500 (CDT) Subject: [Numpy-svn] r4263 - branches/numpy.scons/numpy/core Message-ID: <20071020163258.2890439C019@new.scipy.org> Author: cdavid Date: 2007-10-20 11:32:52 -0500 (Sat, 20 Oct 2007) New Revision: 4263 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/scons_support.py Log: Add proper check for broken mathlib Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-20 12:49:15 UTC (rev 4262) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-20 16:32:52 UTC (rev 4263) @@ -9,7 +9,8 @@ from numpy.distutils.scons import GetNumpyEnvironment from scons_support import CheckBrokenMathlib, define_no_smp, \ - generate_config_header, generate_config_header_emitter + generate_config_header, generate_config_header_emitter, \ + CheckMathlib env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = [get_python_inc()]) @@ -17,7 +18,9 @@ #======================= # Starting Configuration #======================= -config = env.NumpyConfigure(custom_tests = {'CheckBrokenMathlib' : CheckBrokenMathlib}) +# XXX: separate env for configuration +config = env.NumpyConfigure(custom_tests = {'CheckBrokenMathlib' : CheckBrokenMathlib, + 'CheckMathlib' : CheckMathlib}) # Convention: list of tuples (definition, value). value: # - 0: #undef definition @@ -73,12 +76,21 @@ # TODO: getting the math lib automatically ? Having a list ? # TODO: checklib vs checkfunc ? +mlibs = [[], ['cpml']] mathlib = os.environ.get('MATHLIB') if mathlib: - # XXX: prepend it ? - mlib = mathlib -else: - mlib = 'm' + # XXX: prepend it + mlibs.insert(0, mathlib) +for mlib in mlibs: + st = config.CheckBrokenMathlib(mlib) + if st: + break + +if not st: + import SCons + raise SCons.Errors.UserError("No usable mathlib was found: chose another "\ + "one using the MATHLIB env variable, eg "\ + "MATHLIB=m") config_sym.append(('MATHLIB', str(mlib))) def check_lib(f, autoadd = 0): @@ -95,11 +107,6 @@ for f in mfuncs[1:]: check_lib(f) -if not config.CheckBrokenMathlib(mlib): - raise SCons.Errors.UserError("Your mathlib looks broken: chose another "\ - "one using the MATHLIB env variable, eg "\ - "MATHLIB=m") - #------------------------------------------------------- # Define the function PyOS_ascii_strod if not available #------------------------------------------------------- Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-10-20 12:49:15 UTC (rev 4262) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-20 16:32:52 UTC (rev 4263) @@ -125,6 +125,33 @@ #----------------------------------------- # Other functions related to configuration #----------------------------------------- +def CheckMathlib(context, mathlib): + src = """ +/* check whether exp can be found with current link/compile options */ +#include +int main(int argc, char *argv[]) +{ + double a = exp(0); +} +""" + try: + oldLIBS = deepcopy(context.env['LIBS']) + except: + oldLIBS = [] + + try: + context.Message("Checking if math lib %s defines exp ... " % mathlib) + context.env.AppendUnique(LIBS = mathlib) + st = context.TryLink(src, '.c') + finally: + context.env['LIBS'] = oldLIBS + + if st: + context.Result(' Yes') + else: + context.Result(' No ') + return st + def CheckBrokenMathlib(context, mathlib): src = """ /* check whether libm is broken */ @@ -141,16 +168,16 @@ oldLIBS = [] try: - context.Message("Checking if math lib %s is broken ... " % mathlib) + context.Message("Checking if math lib %s is usable for numpy ... " % mathlib) context.env.AppendUnique(LIBS = mathlib) st = context.TryRun(src, '.c') finally: context.env['LIBS'] = oldLIBS if st[0]: - context.Result(' not broken !') + context.Result(' Yes !') else: - context.Result(' broken !') + context.Result(' No !') return st[0] def define_no_smp(): From numpy-svn at scipy.org Sat Oct 20 12:44:56 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 20 Oct 2007 11:44:56 -0500 (CDT) Subject: [Numpy-svn] r4264 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071020164456.C196339C019@new.scipy.org> Author: cdavid Date: 2007-10-20 11:44:51 -0500 (Sat, 20 Oct 2007) New Revision: 4264 Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/utils.py Log: Add isstring func in scons utils Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-20 16:32:52 UTC (rev 4263) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-20 16:44:51 UTC (rev 4264) @@ -3,3 +3,4 @@ from libinfo import get_paths as scons_get_paths #from custom_checkers import CheckTypeSize from extension import get_python_inc +from utils import isstring Modified: branches/numpy.scons/numpy/distutils/scons/utils.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-20 16:32:52 UTC (rev 4263) +++ branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-20 16:44:51 UTC (rev 4264) @@ -75,6 +75,27 @@ return self.fun(*(self.pending + args), **kw) +import types +# Don't "from types import ..." these because we need to get at the +# types module later to look for UnicodeType. +DictType = types.DictType +InstanceType = types.InstanceType +ListType = types.ListType +StringType = types.StringType +TupleType = types.TupleType +if hasattr(types, 'UnicodeType'): + UnicodeType = types.UnicodeType + def isstring(obj): + t = type(obj) + return t is StringType \ + or t is UnicodeType \ + or (t is InstanceType and isinstance(obj, UserString)) +else: + def isstring(obj): + t = type(obj) + return t is StringType \ + or (t is InstanceType and isinstance(obj, UserString)) + if __name__ == '__main__': a1 = 'a.b.c' assert a1.split('.', -1) == a1.rsplit('.', -1) == _rsplit(a1, '.', -1) From numpy-svn at scipy.org Sat Oct 20 12:46:04 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 20 Oct 2007 11:46:04 -0500 (CDT) Subject: [Numpy-svn] r4265 - branches/numpy.scons/numpy/core Message-ID: <20071020164604.8EB0D39C044@new.scipy.org> Author: cdavid Date: 2007-10-20 11:45:59 -0500 (Sat, 20 Oct 2007) New Revision: 4265 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/scons_support.py Log: Set mathlib to a string instead of stringed list on config.h Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-20 16:44:51 UTC (rev 4264) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-20 16:45:59 UTC (rev 4265) @@ -76,7 +76,7 @@ # TODO: getting the math lib automatically ? Having a list ? # TODO: checklib vs checkfunc ? -mlibs = [[], ['cpml']] +mlibs = [[], ['m'], ['cpml']] mathlib = os.environ.get('MATHLIB') if mathlib: # XXX: prepend it @@ -91,7 +91,7 @@ raise SCons.Errors.UserError("No usable mathlib was found: chose another "\ "one using the MATHLIB env variable, eg "\ "MATHLIB=m") -config_sym.append(('MATHLIB', str(mlib))) +config_sym.append(('MATHLIB', mlib)) def check_lib(f, autoadd = 0): """Check that f is available in mlib, and add the symbol appropriately. Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-10-20 16:44:51 UTC (rev 4264) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-20 16:45:59 UTC (rev 4265) @@ -10,7 +10,7 @@ do_generate_api as nowrap_do_generate_ufunc_api from numpy.distutils.conv_template import process_str -from numpy.distutils.scons.utils import _rsplit as rsplit +from numpy.distutils.scons.utils import _rsplit as rsplit, isstring import SCons.Node @@ -101,8 +101,10 @@ return "#define %s\n\n" % define elif value == 0: return "/* #undef %s */\n\n" % define + elif isstring(value): + return "#define %s %s\n\n" % (define, value) else: - return "#define %s %s\n\n" % (define, value) + return "#define %s %s\n\n" % (define, ' '.join(value)) t.writelines([write_symbol(i[0], i[1]) for i in sym]) t.write('\n') t.close() From numpy-svn at scipy.org Sat Oct 20 12:49:17 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 20 Oct 2007 11:49:17 -0500 (CDT) Subject: [Numpy-svn] r4266 - branches/numpy.scons/numpy/core Message-ID: <20071020164917.7152139C044@new.scipy.org> Author: cdavid Date: 2007-10-20 11:49:13 -0500 (Sat, 20 Oct 2007) New Revision: 4266 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Add USE_DISTUTILS_SDK config for AMD64 under windows Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-20 16:45:59 UTC (rev 4265) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-20 16:49:13 UTC (rev 4266) @@ -120,6 +120,13 @@ else: config_sym.append(('NPY_NOSMP', '0')) +# XXX: this is ugly +if sys.platform=='win32' or os.name=='nt': + from distutils.msvccompiler import get_build_architecture + a = get_build_architecture() + print 'BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % (a, os.name, sys.platform) + if a == 'AMD64': + moredefs.append(('DISTUTILS_USE_SDK', 1)) #-------------- # Checking Blas #-------------- From numpy-svn at scipy.org Sun Oct 21 09:16:46 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 21 Oct 2007 08:16:46 -0500 (CDT) Subject: [Numpy-svn] r4267 - in branches/numpy.scons/numpy: core distutils/scons Message-ID: <20071021131646.CA61339C177@new.scipy.org> Author: cdavid Date: 2007-10-21 08:16:39 -0500 (Sun, 21 Oct 2007) New Revision: 4267 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Add pythonlib libpath for configuration of core on windows Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-20 16:49:13 UTC (rev 4266) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-21 13:16:39 UTC (rev 4267) @@ -1,11 +1,11 @@ -# Last Change: Sat Oct 20 06:00 PM 2007 J +# Last Change: Sun Oct 21 09:00 PM 2007 J # vim:syntax=python import os import sys from os.path import join as pjoin, basename as pbasename, dirname as pdirname from copy import deepcopy -from numpy.distutils.scons import get_python_inc +from numpy.distutils.scons import get_python_inc, get_pythonlib_dir from numpy.distutils.scons import GetNumpyEnvironment from scons_support import CheckBrokenMathlib, define_no_smp, \ @@ -14,6 +14,8 @@ env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = [get_python_inc()]) +if os.name == 'nt': + env.AppendUnique(LIBPATH = [get_pythonlib_dir()]) #======================= # Starting Configuration @@ -38,6 +40,7 @@ config_sym.append(('SIZEOF_%s' % type.upper(), '%d' % st)) else: config_sym.append(('SIZEOF_%s' % type.upper(), 0)) + check_type('short') check_type('int') check_type('long') Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-20 16:49:13 UTC (rev 4266) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-21 13:16:39 UTC (rev 4267) @@ -2,5 +2,5 @@ from libinfo_scons import NumpyCheckLib from libinfo import get_paths as scons_get_paths #from custom_checkers import CheckTypeSize -from extension import get_python_inc +from extension import get_python_inc, get_pythonlib_dir from utils import isstring Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-20 16:49:13 UTC (rev 4266) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-21 13:16:39 UTC (rev 4267) @@ -135,6 +135,7 @@ from utils import curry NumpyConfigure = curry(env.Configure, conf_dir = pjoin(env['build_dir'], '.sconf')) env.NumpyConfigure = NumpyConfigure + # XXX: Huge, ugly hack ! SConsign needs an absolute path or a path # relative to where the SConstruct file is. We have to find the path of # the build dir relative to the src_dir: we add n .., where n is the number From numpy-svn at scipy.org Sun Oct 21 09:28:52 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 21 Oct 2007 08:28:52 -0500 (CDT) Subject: [Numpy-svn] r4268 - in branches/numpy.scons/numpy: distutils/scons random Message-ID: <20071021132852.2495439C016@new.scipy.org> Author: cdavid Date: 2007-10-21 08:28:45 -0500 (Sun, 21 Oct 2007) New Revision: 4268 Modified: branches/numpy.scons/numpy/distutils/scons/TODO branches/numpy.scons/numpy/random/SConstruct Log: Add Advapi32 support on windows for random module. Modified: branches/numpy.scons/numpy/distutils/scons/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-21 13:16:39 UTC (rev 4267) +++ branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-21 13:28:45 UTC (rev 4268) @@ -19,6 +19,7 @@ g77, gfortran (1st priority), MS and Intel (2d priority), others (3rd: sun, aix, etc...) - Refactor code for API generation (numpy/core/code_generators) + - Problems of per packages things (config.log, sconsign files, etc....) Documentation: - scons / distutils integration Modified: branches/numpy.scons/numpy/random/SConstruct =================================================================== --- branches/numpy.scons/numpy/random/SConstruct 2007-10-21 13:16:39 UTC (rev 4267) +++ branches/numpy.scons/numpy/random/SConstruct 2007-10-21 13:28:45 UTC (rev 4268) @@ -1,25 +1,40 @@ -# Last Change: Thu Oct 18 10:00 PM 2007 J +# Last Change: Sun Oct 21 10:00 PM 2007 J # vim:syntax=python import os from numpy.distutils.misc_util import get_numpy_include_dirs from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths +def CheckWincrypt(context): + from copy import deepcopy + src = """\ +/* check to see if _WIN32 is defined */ +int main(int argc, char *argv[]) +{ +#ifdef _WIN32 + return 0; +#else + return 1; +#endif +} +""" + + context.Message("Checking if using wincrypt ... ") + st = context.env.TryRun(src, '.C') + if st[0] == 0: + context.Result('No') + else: + context.Result('Yes') + return st[0] + env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) -mathlib = os.environ.get('MATHLIB') -if mathlib: - # XXX: prepend it ? - mlib = mathlib -else: - mlib = 'm' -env.Append(LIBS = mlib) +if os.name == 'nt': + config = env.NumpyConfigure(custom_tests = {'CheckWincrypt' : CheckWincrypt}) + if config.CheckWincrypt: + config.env.AppendUnique(LIBS = 'Advapi32') -import sys -if sys.platform == 'win32': - assert 0 == 1, 'FIXME: support Advapi32 detection for win32 in mtrand' - sources = [os.path.join('mtrand', x) for x in ['mtrand.c', 'randomkit.c', 'initarray.c', 'distributions.c']] From numpy-svn at scipy.org Sun Oct 21 09:40:12 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 21 Oct 2007 08:40:12 -0500 (CDT) Subject: [Numpy-svn] r4269 - branches/numpy.scons/numpy/random Message-ID: <20071021134012.ED4C539C016@new.scipy.org> Author: cdavid Date: 2007-10-21 08:40:09 -0500 (Sun, 21 Oct 2007) New Revision: 4269 Modified: branches/numpy.scons/numpy/random/SConstruct Log: Add comment Modified: branches/numpy.scons/numpy/random/SConstruct =================================================================== --- branches/numpy.scons/numpy/random/SConstruct 2007-10-21 13:28:45 UTC (rev 4268) +++ branches/numpy.scons/numpy/random/SConstruct 2007-10-21 13:40:09 UTC (rev 4269) @@ -30,6 +30,7 @@ env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) +# On windows, see if we should use Advapi32 if os.name == 'nt': config = env.NumpyConfigure(custom_tests = {'CheckWincrypt' : CheckWincrypt}) if config.CheckWincrypt: From numpy-svn at scipy.org Sun Oct 21 09:50:35 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 21 Oct 2007 08:50:35 -0500 (CDT) Subject: [Numpy-svn] r4270 - in branches/numpy.scons/numpy: distutils/scons random Message-ID: <20071021135035.97C6739C016@new.scipy.org> Author: cdavid Date: 2007-10-21 08:50:30 -0500 (Sun, 21 Oct 2007) New Revision: 4270 Modified: branches/numpy.scons/numpy/distutils/scons/TODO branches/numpy.scons/numpy/random/SConstruct Log: Get mathlib dynamically for random module Modified: branches/numpy.scons/numpy/distutils/scons/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-21 13:40:09 UTC (rev 4269) +++ branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-21 13:50:30 UTC (rev 4270) @@ -1,5 +1,6 @@ Checker: - improve CheckTypeSize for upstream integration + - improve BrokenMathlib and Mathlib in core, and make them available to everyone - improve Fortran runtime detection for upstream integration - improve Fortran mangling and dummy main detection for upstream integration Modified: branches/numpy.scons/numpy/random/SConstruct =================================================================== --- branches/numpy.scons/numpy/random/SConstruct 2007-10-21 13:40:09 UTC (rev 4269) +++ branches/numpy.scons/numpy/random/SConstruct 2007-10-21 13:50:30 UTC (rev 4270) @@ -2,7 +2,7 @@ # vim:syntax=python import os -from numpy.distutils.misc_util import get_numpy_include_dirs +from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths def CheckWincrypt(context): @@ -30,6 +30,15 @@ env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) +# XXX: this is ugly, better find the mathlibs with a checker +for i in scons_get_paths(env['include_bootstrap']): + try: + mlib = get_mathlibs(i) + break + except IOError: + pass +env.AppendUnique(LIBS = mlib) + # On windows, see if we should use Advapi32 if os.name == 'nt': config = env.NumpyConfigure(custom_tests = {'CheckWincrypt' : CheckWincrypt}) From numpy-svn at scipy.org Sun Oct 21 11:02:40 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 21 Oct 2007 10:02:40 -0500 (CDT) Subject: [Numpy-svn] r4271 - in branches/numpy.scons: . numpy/core numpy/fft Message-ID: <20071021150240.2E96C39C01B@new.scipy.org> Author: cdavid Date: 2007-10-21 10:02:32 -0500 (Sun, 21 Oct 2007) New Revision: 4271 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/fft/SConstruct branches/numpy.scons/test.sh Log: Fix incorrect module names in core and fft Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-21 13:50:30 UTC (rev 4270) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-21 15:02:32 UTC (rev 4271) @@ -252,12 +252,12 @@ #------------------- # Build umath module #------------------- -umathmodule = env.NumpyPythonExtension('umathmodule', source = umathmodule_src) +umathmodule = env.NumpyPythonExtension('umath', source = umathmodule_src) #------------------------ # Build scalarmath module #------------------------ -scalarmathmodule = env.NumpyPythonExtension('scalarmathmodule', +scalarmathmodule = env.NumpyPythonExtension('scalarmath', source = scalarmathmodule_src) # #---------------------- Modified: branches/numpy.scons/numpy/fft/SConstruct =================================================================== --- branches/numpy.scons/numpy/fft/SConstruct 2007-10-21 13:50:30 UTC (rev 4270) +++ branches/numpy.scons/numpy/fft/SConstruct 2007-10-21 15:02:32 UTC (rev 4271) @@ -6,5 +6,6 @@ env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) -fftpack_lite = env.NumpyPythonExtension('fftpack_litemodule', - source = ['fftpack_litemodule.c', 'fftpack.c']) +fftpack_lite = env.NumpyPythonExtension('fftpack_lite', + source = ['fftpack_litemodule.c', + 'fftpack.c']) Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-10-21 13:50:30 UTC (rev 4270) +++ branches/numpy.scons/test.sh 2007-10-21 15:02:32 UTC (rev 4271) @@ -1,4 +1,4 @@ -PREFIX=/usr/media/src/src/dsp/numpy/numpy.scons/ +PREFIX=$PWD rm -rf $PREFIX/build rm -rf $PREFIX/tmp python setup.py scons --jobs=4 From numpy-svn at scipy.org Tue Oct 23 06:07:06 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 23 Oct 2007 05:07:06 -0500 (CDT) Subject: [Numpy-svn] r4272 - branches/numpy.scons/numpy/core Message-ID: <20071023100706.3877139C074@new.scipy.org> Author: cdavid Date: 2007-10-23 05:06:59 -0500 (Tue, 23 Oct 2007) New Revision: 4272 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Remove unused code in core sconscript Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-21 15:02:32 UTC (rev 4271) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-23 10:06:59 UTC (rev 4272) @@ -1,4 +1,4 @@ -# Last Change: Sun Oct 21 09:00 PM 2007 J +# Last Change: Tue Oct 23 04:00 PM 2007 J # vim:syntax=python import os import sys @@ -137,12 +137,6 @@ config.Finish() -try: - config_file = open('config.log') - #for i in config_file.readlines(): - # print i -except: - pass #========== # Build #========== From numpy-svn at scipy.org Tue Oct 23 07:47:56 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 23 Oct 2007 06:47:56 -0500 (CDT) Subject: [Numpy-svn] r4273 - in branches/numpy.scons/numpy/distutils/scons: . tests Message-ID: <20071023114756.6849A39C010@new.scipy.org> Author: cdavid Date: 2007-10-23 06:47:46 -0500 (Tue, 23 Oct 2007) New Revision: 4273 Added: branches/numpy.scons/numpy/distutils/scons/fortran.py branches/numpy.scons/numpy/distutils/scons/tests/ branches/numpy.scons/numpy/distutils/scons/tests/empty.f branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py Log: Start support of fortran and fortran-related capabilities for scons: * Add fortran module to parse link output of fortran compilers * Add test for the above functionality Added: branches/numpy.scons/numpy/distutils/scons/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-10-23 10:06:59 UTC (rev 4272) +++ branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-10-23 11:47:46 UTC (rev 4273) @@ -0,0 +1,127 @@ +#! Last Change: Tue Oct 23 08:00 PM 2007 J + +# This module defines some functions/classes useful for testing fortran-related +# features (name mangling, F77/C runtime, etc...). + +# KEEP THIS INDEPENDENT OF SCONS, PLEASE !!! + +import sys +import re + +GCC_DRIVER_LINE = re.compile('^Driving:') +POSIX_STATIC_EXT = re.compile('\S+\.a') +POSIX_LIB_FLAGS = re.compile('-l\S+') + +def _check_link_verbose_posix(lines): + """Returns true if useful link options can be found in output. + + Expect lines to be a list of lines.""" + for line in lines: + if not GCC_DRIVER_LINE.search(line): + #print line + #print POSIX_STATIC_EXT.search(line) + #print POSIX_LIB_FLAGS.search(line) + if POSIX_STATIC_EXT.search(line) or POSIX_LIB_FLAGS.search(line): + return True + return False + +def check_link_verbose(lines): + if sys.platform == 'win32': + raise NotImplementedError("FIXME: not implemented on win32") + else: + return _check_link_verbose_posix(lines) + +merge_space_r1 = re.compile('^-[LRuYz]$') + +def merge_space(line): + """matcher should be a callable, line a list of tokens.""" + nline = [] + for i in range(len(line)): + ##print "hoho is %s" % line[i] + if merge_space_r1.match(line[i]): + ##print '%s matched !' % line[i] + merged = [line[i]] + if not (line[i+1][0] == '-'): + merged.append(line[i+1]) + i += 1 + nline.append(''.join(merged)) + ##print '\t%s matched !' % ''.join(merged) + else: + nline.append(line[i]) + return nline + +def homo_libpath_flags(flags): + nflags = [] + #print 'flags is %s' % flags + #print "len flags is %d" % len(flags) + for i in flags: + if i[:4] == "-YP,": + i = i.replace('-YP,', '-L') + i = i.replace(':', ' -L') + nflags.append(i) + else: + nflags.append(i) + return nflags + +def parse_f77link(lines): + """Given the output of verbose link of F77 compiler, this returns a list of + flags necessary for linking using the standard linker.""" + # TODO: On windows ? + # TODO: take into account quotting... + # TODO: those regex are really bad... Should try to get as similar as + # possible to autoconf here. + # XXX: this is really messy, clean it up ! + ignored = ['-lang*', r'-lcrt[a-zA-Z0-9]*\.o', '-lc', '-lgcc*', + '-lSystem', '-libmil', '-LIST:*', '-LNO:*'] + inter = ['-[lLR][a-zA-Z0-9]*'] + # Those options takes an argument, so concatenate any following item + # until the end of the line or a new option. + remove_space = ['-[LRuYz]*'] + import re + rignored = [re.compile(i) for i in ignored] + rinter = [re.compile(i) for i in inter] + # We ignore lines starting with Driving + rgccignored = re.compile('^Driving:') + final_flags = [] + for line in lines: + # Here we go (convention for wildcard is shell, not regex !) + # 1 TODO: we first get some root .a libraries + # 2 TODO: take everything starting by -bI:* + # 3 TODO: ignore the following flags: -lang* | -lcrt*.o | -lc | + # -lgcc* | -lSystem | -libmil | -LANG:=* | -LIST:* | -LNO:*) + # 4 TODO: take into account -lkernel32 + # 5 For options of the kind -[[LRuYz]], as they take one argument + # after, we have to somewhat keep it. We do as autoconf, that is + # removing space between the flag and its argument. + # 6 For -YP,*: take and replace by -Larg where arg is the old argument + # 7 For -[lLR]*: take + if not rgccignored.match(line): + # Step 5 + flags = merge_space(line.split()) + # Step 6 + ##print 'homo flags are: %s (%d items)' % (flags, len(flags)) + flags = homo_libpath_flags(flags) + #print 'homo flags are: %s ' % flags + def match_ignore(str): + if [i for i in rignored if i.match(str)]: + return True + else: + return False + + def match_interesting(str): + pop = [i for i in rinter if i.match(str)] + if pop: + #print "pop %s" % str + return True + else: + return False + + # Step 3 + good_flags = [i for i in flags if not match_ignore(i)] + #print good_flags + good_flags = [i for i in good_flags if match_interesting(i)] + final_flags.extend(good_flags) + return final_flags + +if __name__ == '__main__': + pass Added: branches/numpy.scons/numpy/distutils/scons/tests/empty.f =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tests/empty.f 2007-10-23 10:06:59 UTC (rev 4272) +++ branches/numpy.scons/numpy/distutils/scons/tests/empty.f 2007-10-23 11:47:46 UTC (rev 4273) @@ -0,0 +1,2 @@ + PROGRAM HELLO + END Added: branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py 2007-10-23 10:06:59 UTC (rev 4272) +++ branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py 2007-10-23 11:47:46 UTC (rev 4273) @@ -0,0 +1,47 @@ +# Generated bg g77 -o hello hello.o -v +g77_link_output = """ +Driving: g77 -v empty.o -o empty -lfrtbegin -lg2c -lm -shared-libgcc +Reading specs from /usr/lib/gcc/i486-linux-gnu/3.4.6/specs +Configured with: ../src/configure -v --enable-languages=c,c++,f77,pascal --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --with-tune=pentium4 i486-linux-gnu +Thread model: posix +gcc version 3.4.6 (Ubuntu 3.4.6-6ubuntu1) + /usr/lib/gcc/i486-linux-gnu/3.4.6/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o empty /usr/lib/gcc/i486-linux-gnu/3.4.6/../../../../lib/crt1.o /usr/lib/gcc/i486-linux-gnu/3.4.6/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/3.4.6/crtbegin.o -L/usr/lib/gcc/i486-linux-gnu/3.4.6 -L/usr/lib/gcc/i486-linux-gnu/3.4.6 -L/usr/lib/gcc/i486-linux-gnu/3.4.6/../../../../lib -L/usr/lib/gcc/i486-linux-gnu/3.4.6/../../.. -L/lib/../lib -L/usr/lib/../lib empty.o -lfrtbegin -lg2c -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/i486-linux-gnu/3.4.6/crtend.o /usr/lib/gcc/i486-linux-gnu/3.4.6/../../../../lib/crtn.o""" + +gfortran_link_output = """ +Driving: gfortran -v -o hello hello.o -lgfortranbegin -lgfortran -lm -shared-libgcc +Using built-in specs. +Target: i486-linux-gnu +Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu +Thread model: posix +gcc version 4.2.1 (Ubuntu 4.2.1-5ubuntu4) + /usr/lib/gcc/i486-linux-gnu/4.2.1/collect2 --eh-frame-hdr -m elf_i386 --hash-style=both -dynamic-linker /lib/ld-linux.so.2 -o hello /usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib/crt1.o /usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.2.1/crtbegin.o -L/usr/lib/gcc/i486-linux-gnu/4.2.1 -L/usr/lib/gcc/i486-linux-gnu/4.2.1 -L/usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.2.1/../../.. hello.o -lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/i486-linux-gnu/4.2.1/crtend.o /usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib/crtn.o""" + +sunfort_v12_link_output = """ +NOTICE: Invoking /home/david/opt/sun/sunstudio12/bin/f90 -f77 -ftrap=%none -c empty.f +### command line files and options (expanded): + ### -f77=%all -ftrap=%none -v empty.o + ### f90: Note: NLSPATH = /home/david/opt/sun/sunstudio12/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/home/david/opt/sun/sunstudio12/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat + ### f90: Note: LD_LIBRARY_PATH = /home/david/local/intel/cc/9.1.042/lib:/home/david/local/lib: + ### f90: Note: LD_RUN_PATH = (null) + ### f90: Note: LD_OPTIONS = (null) + /usr/bin/ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 --enable-new-dtags -R/home/david/opt/sun/sunstudio12/lib:/opt/sun/sunstudio12/lib:/home/david/opt/sun/lib/rtlibs:/opt/sun/lib/rtlibs -o a.out /home/david/opt/sun/sunstudio12/prod/lib/crti.o /home/david/opt/sun/sunstudio12/prod/lib/crt1.o /home/david/opt/sun/sunstudio12/prod/lib/values-xi.o -Y P,/home/david/opt/sun/sunstudio12/lib:/home/david/opt/sun/sunstudio12/rtlibs:/home/david/opt/sun/sunstudio12/prod/lib:/lib:/usr/lib empty.o -lfui -lfai -lfsu -Bdynamic -lmtsk -lpthread -lm -lc /home/david/opt/sun/sunstudio12/prod/lib/libc_supp.a /home/david/opt/sun/sunstudio12/prod/lib/crtn.o + empty.f: + MAIN hello: +""" + +ifort_v10_link_output = """ +ld /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../crt1.o /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../crti.o /usr/lib/gcc/i486-linux-gnu/4.1.3/crtbegin.o --eh-frame-hdr -dynamic-linker /lib/ld-linux.so.2 -m elf_i386 -o a.out /home/david/opt/intel/fc/10.0.023//lib/for_main.o empty.o -L/home/david/opt/intel/fc/10.0.023//lib -L/usr/lib/gcc/i486-linux-gnu/4.1.3/ -L/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../ -Bstatic -lifport -lifcore -limf -Bdynamic -lm -Bstatic -lipgo -lirc -Bdynamic -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib/gcc/i486-linux-gnu/4.1.3/crtend.o /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../crtn.o +""" +def generate_output(fcomp, verbose): + import os + os.system('%s -c %s &> /dev/null ' % (fcomp, 'empty.f')) + os.system('%s %s %s' % (fcomp, verbose, 'empty.o')) + +if __name__ == '__main__': + import sys + fcomp = sys.argv[1] + try: + vflag = sys.argv[2] + except IndexError: + vflag = '-v' + generate_output(fcomp, vflag) Added: branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py 2007-10-23 10:06:59 UTC (rev 4272) +++ branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py 2007-10-23 11:47:46 UTC (rev 4273) @@ -0,0 +1,33 @@ +#! Last Change: Tue Oct 23 08:00 PM 2007 J + +import sys +import random + +import unittest + +from fortran import parse_f77link + +from fortran_output import g77_link_output, gfortran_link_output, \ + sunfort_v12_link_output, ifort_v10_link_output + +class TestCheckF77Verbose(unittest.TestCase): + def setUp(self): + pass + + def test_g77(self): + print parse_f77link(g77_link_output.split('\n')) + + def test_gfortran(self): + print parse_f77link(gfortran_link_output.split('\n')) + + def test_sunf77(self): + print parse_f77link(sunfort_v12_link_output.split('\n')) + + def test_intel_posix(self): + print parse_f77link(ifort_v10_link_output.split('\n')) + + def test_intel_win(self): + print "FIXME: testing verbose output of win32 intel fortran" + +if __name__ == '__main__': + unittest.main() From numpy-svn at scipy.org Tue Oct 23 08:24:13 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 23 Oct 2007 07:24:13 -0500 (CDT) Subject: [Numpy-svn] r4274 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071023122413.DBF5A39C112@new.scipy.org> Author: cdavid Date: 2007-10-23 07:24:07 -0500 (Tue, 23 Oct 2007) New Revision: 4274 Modified: branches/numpy.scons/numpy/distutils/scons/TODO Log: Update scons TODO Modified: branches/numpy.scons/numpy/distutils/scons/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-23 11:47:46 UTC (rev 4273) +++ branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-23 12:24:07 UTC (rev 4274) @@ -4,6 +4,7 @@ - improve Fortran runtime detection for upstream integration - improve Fortran mangling and dummy main detection for upstream integration + - Cblas checker - Blas/Lapack check - Atlas check From numpy-svn at scipy.org Wed Oct 24 01:20:14 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 24 Oct 2007 00:20:14 -0500 (CDT) Subject: [Numpy-svn] r4275 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071024052014.5EE6139C067@new.scipy.org> Author: cdavid Date: 2007-10-24 00:20:02 -0500 (Wed, 24 Oct 2007) New Revision: 4275 Modified: branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py Log: Catch no section exception when reading site.cfg in libinfo Modified: branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-10-23 12:24:07 UTC (rev 4274) +++ branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-10-24 05:20:02 UTC (rev 4275) @@ -30,13 +30,16 @@ Assumes that libs, symbol, header, libpath and cpppath are sequences (list or tuples). DO NOT USE DIRECTLY IN SCONSCRIPT !!!""" - # XXX: sanitize API for section/siteconfig option: if sectionis not given, + # XXX: sanitize API for section/siteconfig option: if section is not given, # can we just say to ignore the sitecfg ? if not siteconfig: siteconfig, cfgfiles = get_config() def get_descr(): - descr = siteconfig.items(section) + try: + descr = siteconfig.items(section) + except ConfigParser.NoSectionError: + descr = "" sdescr = "" for i in descr: sdescr += str(i) + '\n' @@ -66,9 +69,9 @@ # recommended in C++ portability guide of mozilla for nested comments, # which may happen here). This is also the most robust, since it seems # unlikely to have any #endif somewhere in the return value of get_descr. - #src += "#if 0\n" - #src += get_descr() - #src += "\n#endif\n" + src += "#if 0\n" + src += get_descr() + src += "\n#endif\n" # XXX: handle autoadd # XXX: handle extension From numpy-svn at scipy.org Wed Oct 24 01:46:16 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 24 Oct 2007 00:46:16 -0500 (CDT) Subject: [Numpy-svn] r4276 - in branches/numpy.scons/numpy: core distutils/scons Message-ID: <20071024054616.3B34C39C224@new.scipy.org> Author: cdavid Date: 2007-10-24 00:46:03 -0500 (Wed, 24 Oct 2007) New Revision: 4276 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py Log: Cblas detection for numpy.core Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-24 05:20:02 UTC (rev 4275) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-24 05:46:03 UTC (rev 4276) @@ -7,6 +7,7 @@ from numpy.distutils.scons import get_python_inc, get_pythonlib_dir from numpy.distutils.scons import GetNumpyEnvironment +from numpy.distutils.scons import NumpyCheckLib from scons_support import CheckBrokenMathlib, define_no_smp, \ generate_config_header, generate_config_header_emitter, \ @@ -22,7 +23,8 @@ #======================= # XXX: separate env for configuration config = env.NumpyConfigure(custom_tests = {'CheckBrokenMathlib' : CheckBrokenMathlib, - 'CheckMathlib' : CheckMathlib}) + 'CheckMathlib' : CheckMathlib, + 'NumpyCheckLib' : NumpyCheckLib}) # Convention: list of tuples (definition, value). value: # - 0: #undef definition @@ -130,10 +132,13 @@ print 'BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % (a, os.name, sys.platform) if a == 'AMD64': moredefs.append(('DISTUTILS_USE_SDK', 1)) + #-------------- # Checking Blas #-------------- # TODO +config.NumpyCheckLib(libs = ['cblas'], symbols = ['cblas_dgemm']) +config.NumpyCheckLib(libs = ['blas'], symbols = ['cblas_dgemm']) config.Finish() Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-24 05:20:02 UTC (rev 4275) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-24 05:46:03 UTC (rev 4276) @@ -0,0 +1,4 @@ +from libinfo_scons import NumpyCheckLib + +def NumpyCheckCBlas(context, libs): + pass Modified: branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-10-24 05:20:02 UTC (rev 4275) +++ branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-10-24 05:46:03 UTC (rev 4276) @@ -25,7 +25,7 @@ }\n """ def _CheckLib(context, libs, symbols, header, language, section, siteconfig, - libpath, cpppath): + libpath, cpppath, verbose): """Implementation for checking a list of symbols, with libs. Assumes that libs, symbol, header, libpath and cpppath are sequences (list @@ -92,7 +92,7 @@ def NumpyCheckLib(context, libs, symbols = None, header = None, - language = None, section = None, siteconfig = None, name = None): + language = None, section = None, siteconfig = None, name = None, verbose = None): """Check for symbol in libs. This is the general purpose replacement for numpy.distutils.system_info. It @@ -119,7 +119,8 @@ #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ env = context.env - # XXX: would be nice for each extension to add an option to command line. + # XXX: would be nice for each extension to add an option to + # command line. # XXX: handle env var # XXX: handle language if language: @@ -145,13 +146,14 @@ libpath = None cpppath = None res = _CheckLib(context, libs, symbols, header, language, section, - siteconfig, libpath, cpppath, ) + siteconfig, libpath, cpppath, verbose) context.Result(res) return res def _check_lib_section(context, siteconfig, section, src, libs, libpath, cpppath): - # Convention: if an option is found in site.cfg for the given section, it - # takes precedence on the arguments libs, libpath, cpppath. + # Convention: if an option is found in site.cfg for the given + # section, it takes precedence on the arguments libs, libpath, + # cpppath. res = 1 try: newLIBPATH = get_paths(siteconfig.get(section, 'library_dirs')) From numpy-svn at scipy.org Thu Oct 25 01:07:13 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 00:07:13 -0500 (CDT) Subject: [Numpy-svn] r4277 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025050713.44F5239C0F1@new.scipy.org> Author: cdavid Date: 2007-10-25 00:07:07 -0500 (Thu, 25 Oct 2007) New Revision: 4277 Modified: branches/numpy.scons/numpy/distutils/scons/libinfo.py branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py Log: Parse correctly multi libs in site.cfg in NumpyChecker. Modified: branches/numpy.scons/numpy/distutils/scons/libinfo.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-10-24 05:46:03 UTC (rev 4276) +++ branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-10-25 05:07:07 UTC (rev 4277) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Fri Oct 05 02:00 PM 2007 J +# Last Change: Thu Oct 25 01:00 PM 2007 J # Module for support to look for external code (replacement of # numpy.distutils.system_info). KEEP THIS INDEPENDANT OF SCONS ! @@ -51,7 +51,8 @@ def parse_config_param(var): """Given var, the output of ConfirParser.get(section, name), returns a list of each item of its content.""" - pass + varl = var.split(',') + return [i.strip() for i in varl] def get_paths(var): """Given var, the output of ConfirParser.get(section, name), returns a list Modified: branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-10-24 05:46:03 UTC (rev 4276) +++ branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-10-25 05:07:07 UTC (rev 4277) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Oct 09 04:00 PM 2007 J +# Last Change: Thu Oct 25 01:00 PM 2007 J # Module for support to look for external code (replacement of # numpy.distutils.system_info). scons dependant code. @@ -8,7 +8,7 @@ from SCons.Util import is_List -from libinfo import get_config, get_paths +from libinfo import get_config, get_paths, parse_config_param from utils import get_empty _SYMBOL_DEF_STR = """ @@ -155,6 +155,8 @@ # section, it takes precedence on the arguments libs, libpath, # cpppath. res = 1 + + # XXX: refactor this mess try: newLIBPATH = get_paths(siteconfig.get(section, 'library_dirs')) except ConfigParser.NoSectionError, e: @@ -172,7 +174,7 @@ newCPPPATH = [] try: - newLIBS = siteconfig.get(section, 'libraries') + newLIBS = parse_config_param(siteconfig.get(section, 'libraries')) except ConfigParser.NoSectionError, e: if libs: newLIBS = libs From numpy-svn at scipy.org Thu Oct 25 01:08:15 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 00:08:15 -0500 (CDT) Subject: [Numpy-svn] r4278 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025050815.8E3BF39C091@new.scipy.org> Author: cdavid Date: 2007-10-25 00:08:11 -0500 (Thu, 25 Oct 2007) New Revision: 4278 Added: branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py Log: Start a module which will contain common test codes for scons checkers. Added: branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-10-25 05:07:07 UTC (rev 4277) +++ branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-10-25 05:08:11 UTC (rev 4278) @@ -0,0 +1,33 @@ +#! /usr/bin/env python +# Last Change: Thu Oct 25 01:00 PM 2007 J + +# This module should contains useful test code (as strings). They are mainly +# useful for checkers who need to run the tests (to check the mere presence of +# symbols or headers, those are overkill). + +# Check whether CBLAS sgemm works +cblas_sgemm = """ +#include + +int +main (void) +{ + int lda = 3; + float A[] = { 0.11, 0.12, 0.13, + 0.21, 0.22, 0.23 }; + int ldb = 2; + float B[] = { 1011, 1012, + 1021, 1022, + 1031, 1032 }; + int ldc = 2; + float C[] = { 0.00, 0.00, + 0.00, 0.00 }; + + /* Compute C = A B */ + cblas_sgemm (CblasRowMajor, + CblasNoTrans, CblasNoTrans, 2, 2, 3, + 1.0, A, lda, B, ldb, 0.0, C, ldc); + + return 0; +} +""" From numpy-svn at scipy.org Thu Oct 25 01:09:20 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 00:09:20 -0500 (CDT) Subject: [Numpy-svn] r4279 - branches/numpy.scons Message-ID: <20071025050920.0AEEA39C091@new.scipy.org> Author: cdavid Date: 2007-10-25 00:09:12 -0500 (Thu, 25 Oct 2007) New Revision: 4279 Modified: branches/numpy.scons/test.sh Log: Make test script a one liner for numpy installation Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-10-25 05:08:11 UTC (rev 4278) +++ branches/numpy.scons/test.sh 2007-10-25 05:09:12 UTC (rev 4279) @@ -1,7 +1,5 @@ PREFIX=$PWD rm -rf $PREFIX/build rm -rf $PREFIX/tmp -python setup.py scons --jobs=4 -python setup.py build -python setup.py install --prefix=$PREFIX/tmp +python setup.py scons --jobs=4 install --prefix=$PREFIX/tmp (cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") From numpy-svn at scipy.org Thu Oct 25 01:20:29 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 00:20:29 -0500 (CDT) Subject: [Numpy-svn] r4280 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025052029.429FF39C0AA@new.scipy.org> Author: cdavid Date: 2007-10-25 00:20:24 -0500 (Thu, 25 Oct 2007) New Revision: 4280 Modified: branches/numpy.scons/numpy/distutils/scons/TODO branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: Start implementing library support for custom checkers. Modified: branches/numpy.scons/numpy/distutils/scons/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-25 05:09:12 UTC (rev 4279) +++ branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-25 05:20:24 UTC (rev 4280) @@ -1,12 +1,15 @@ -Checker: +Before True milestone: - improve CheckTypeSize for upstream integration - improve BrokenMathlib and Mathlib in core, and make them available to everyone + - Cblas checker: works for atlas and mkl + - Atlas check + - Mkl check + +Checker: - improve Fortran runtime detection for upstream integration - improve Fortran mangling and dummy main detection for upstream integration - - Cblas checker - Blas/Lapack check - - Atlas check Builder: - Get a PythonExtension builder independant of distutils for upstream Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 05:09:12 UTC (rev 4279) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 05:20:24 UTC (rev 4280) @@ -1,4 +1,61 @@ +#! /usr/bin/env python +# Last Change: Thu Oct 25 02:00 PM 2007 J + +# Module for custom, common checkers for numpy (and scipy) +import os.path +from copy import deepcopy + from libinfo_scons import NumpyCheckLib +from testcode_snippets import cblas_sgemm as cblas_src -def NumpyCheckCBlas(context, libs): - pass +def _check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath): + """This is a basic implementation for generic "test include and run" + testers. + + For example, for library foo, which implements function do_foo, and with + include header foo.h, this will: + - test that foo.h is found and compilable by the compiler + - test that the given source code can be compiled. The source code + should contain a simple program with the function. + + Arguments: + - name: name of the library + - cpppath: list of directories + - headers: list of headers + - run_src: the code for the run test + - libs: list of libraries to link + - libpath: list of library path.""" + context.Message('Checking for %s ... ' % name) + env = context.env + + # Check headers are available + oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] + env.Append(CPPPATH = cpppath) + # XXX: handle context + src = '\n'.join(headers) + + ret = context.TryCompile(src, '.c') + if not ret: + env.Replace(CPPPATH = oldCPPPATH) + context.Result('Failed: %s include not found' % name) + return 0 + + # Check a simple cblas example works + oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] + oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] + oldRPATH = (env.has_key('RPATH') and deepcopy(env['RPATH'])) or [] + env.Append(LIBPATH = libpath) + env.Append(LIBS = libs) + env.Append(RPATH = libpath) + + ret = context.TryLink(run_src, '.c') + if not ret: + env.Replace(LIBS = oldLIBS) + env.Replace(LIBPATH = oldLIBPATH) + env.Replace(RPATH = oldRPATH) + context.Result('Failed: %s test could not be linked and run' % name) + return 0 + + context.Result(ret) + return ret + From numpy-svn at scipy.org Thu Oct 25 01:38:13 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 00:38:13 -0500 (CDT) Subject: [Numpy-svn] r4281 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025053813.7D20C39C05C@new.scipy.org> Author: cdavid Date: 2007-10-25 00:38:10 -0500 (Thu, 25 Oct 2007) New Revision: 4281 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: Use 'vars in comment's source' hack for custom checkers Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 05:20:24 UTC (rev 4280) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 05:38:10 UTC (rev 4281) @@ -32,7 +32,11 @@ oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] env.Append(CPPPATH = cpppath) # XXX: handle context - src = '\n'.join(headers) + hcode = ['#include <%s>' % h for h in headers] + # HACK: we add cpppath in the command of the source, to add dependency of + # the check on the cpppath. + hcode.extend(['#if 0', '%s' % cpppath, '#endif']) + src = '\n'.join(hcode) ret = context.TryCompile(src, '.c') if not ret: @@ -48,7 +52,10 @@ env.Append(LIBS = libs) env.Append(RPATH = libpath) - ret = context.TryLink(run_src, '.c') + # HACK: we add libpath and libs at the end of the source as a comment, to + # add dependency of the check on those. + src = '\n'.join([run_src, '#if 0', '%s' % libpath, '%s' % libs, '#endif']) + ret = context.TryLink(src, '.c') if not ret: env.Replace(LIBS = oldLIBS) env.Replace(LIBPATH = oldLIBPATH) @@ -59,3 +66,13 @@ context.Result(ret) return ret +def CheckMKL(context, mkl_dir, nb): + """mkl_lib is the root path of MKL (the one which contains include, lib, + etc...). nb is 32, 64, emt, etc...""" + + libs = ['mkl'] + cpppath = os.path.join(mkl_dir, 'include') + libpath = os.path.join(mkl_dir, 'lib', nb) + + return _check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], + cblas_src, libs, libpath) From numpy-svn at scipy.org Thu Oct 25 02:04:38 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 01:04:38 -0500 (CDT) Subject: [Numpy-svn] r4282 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025060438.65E2139C05C@new.scipy.org> Author: cdavid Date: 2007-10-25 01:04:33 -0500 (Thu, 25 Oct 2007) New Revision: 4282 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: Add ATLAS, MKL and CBLAS checkers Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 05:38:10 UTC (rev 4281) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 06:04:33 UTC (rev 4282) @@ -28,14 +28,16 @@ context.Message('Checking for %s ... ' % name) env = context.env + #---------------------------- # Check headers are available + #---------------------------- oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] env.Append(CPPPATH = cpppath) # XXX: handle context hcode = ['#include <%s>' % h for h in headers] # HACK: we add cpppath in the command of the source, to add dependency of # the check on the cpppath. - hcode.extend(['#if 0', '%s' % cpppath, '#endif']) + hcode.extend(['#if 0', '%s' % cpppath, '#endif\n']) src = '\n'.join(hcode) ret = context.TryCompile(src, '.c') @@ -44,9 +46,12 @@ context.Result('Failed: %s include not found' % name) return 0 - # Check a simple cblas example works + #------------------------------ + # Check a simple example works + #------------------------------ oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] + # XXX: RPATH, drawbacks using it ? oldRPATH = (env.has_key('RPATH') and deepcopy(env['RPATH'])) or [] env.Append(LIBPATH = libpath) env.Append(LIBS = libs) @@ -76,3 +81,18 @@ return _check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], cblas_src, libs, libpath) + +def CheckATLAS(context, atl_dir): + """atl_dir is the root path of ATLAS (the one which contains libatlas).""" + + libs = ['atlas', 'f77blas', 'cblas'] + libpath = atl_dir + + return _check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h'], + cblas_src, libs, libpath) + +def CheckCBLAS(context): + libs = ['cblas'] + + return _check_include_and_run(context, 'CBLAS', [], [], cblas_src, + libs, []) From numpy-svn at scipy.org Thu Oct 25 02:05:13 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 01:05:13 -0500 (CDT) Subject: [Numpy-svn] r4283 - branches/numpy.scons/numpy/core Message-ID: <20071025060513.53ADA39C05C@new.scipy.org> Author: cdavid Date: 2007-10-25 01:05:09 -0500 (Thu, 25 Oct 2007) New Revision: 4283 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Build blasdot in numpy.core if cblas is found Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-25 06:04:33 UTC (rev 4282) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-25 06:05:09 UTC (rev 4283) @@ -1,4 +1,4 @@ -# Last Change: Tue Oct 23 04:00 PM 2007 J +# Last Change: Thu Oct 25 02:00 PM 2007 J # vim:syntax=python import os import sys @@ -8,6 +8,7 @@ from numpy.distutils.scons import get_python_inc, get_pythonlib_dir from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons import NumpyCheckLib +from numpy.distutils.scons.custom_checkers import CheckCBLAS, CheckMKL, CheckATLAS from scons_support import CheckBrokenMathlib, define_no_smp, \ generate_config_header, generate_config_header_emitter, \ @@ -24,6 +25,9 @@ # XXX: separate env for configuration config = env.NumpyConfigure(custom_tests = {'CheckBrokenMathlib' : CheckBrokenMathlib, 'CheckMathlib' : CheckMathlib, + 'CheckMKL' : CheckMKL, + 'CheckATLAS' : CheckATLAS, + 'CheckCBLAS' : CheckCBLAS, 'NumpyCheckLib' : NumpyCheckLib}) # Convention: list of tuples (definition, value). value: @@ -137,8 +141,11 @@ # Checking Blas #-------------- # TODO -config.NumpyCheckLib(libs = ['cblas'], symbols = ['cblas_dgemm']) -config.NumpyCheckLib(libs = ['blas'], symbols = ['cblas_dgemm']) +if config.CheckCBLAS(): + build_blasdot = 1 +else: + build_blasdot = 0 +#config.CheckMKL('/home/david/opt/intel/mkl/9.1.023/', '32') config.Finish() @@ -259,10 +266,11 @@ scalarmathmodule = env.NumpyPythonExtension('scalarmath', source = scalarmathmodule_src) -# #---------------------- -# # Build _dotblas module -# #---------------------- -# dotblas_src = [pjoin('blasdot', i) for i in ['_dotblas.c']] -# blasenv = env.Copy() -# blasenv.Append(CPPPATH = pjoin(env['src_dir'], 'blasdot')) -# dotblas = blasenv.NumpyPythonExtension('_dotblas', source = dotblas_src) +#---------------------- +# Build _dotblas module +#---------------------- +if build_blasdot: + dotblas_src = [pjoin('blasdot', i) for i in ['_dotblas.c']] + blasenv = env.Copy() + blasenv.Append(CPPPATH = pjoin(env['src_dir'], 'blasdot')) + dotblas = blasenv.NumpyPythonExtension('_dotblas', source = dotblas_src) From numpy-svn at scipy.org Thu Oct 25 03:24:11 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 02:24:11 -0500 (CDT) Subject: [Numpy-svn] r4284 - branches/numpy.scons/numpy/core Message-ID: <20071025072411.0DB6F39C05C@new.scipy.org> Author: cdavid Date: 2007-10-25 02:24:06 -0500 (Thu, 25 Oct 2007) New Revision: 4284 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Dump config.log in numpy.core Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-25 06:05:09 UTC (rev 4283) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-25 07:24:06 UTC (rev 4284) @@ -1,4 +1,4 @@ -# Last Change: Thu Oct 25 02:00 PM 2007 J +# Last Change: Thu Oct 25 04:00 PM 2007 J # vim:syntax=python import os import sys @@ -148,6 +148,11 @@ #config.CheckMKL('/home/david/opt/intel/mkl/9.1.023/', '32') config.Finish() +config_f = open('config.log', 'r') +print "++++++++++ config.log dump ++++++++++++++++++" +for i in config_f: + print i.strip('\n') +print "+++++++++++++++++++++++++++++++++++++++++++++" #========== # Build From numpy-svn at scipy.org Thu Oct 25 03:45:14 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 02:45:14 -0500 (CDT) Subject: [Numpy-svn] r4285 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025074514.F016439C08B@new.scipy.org> Author: cdavid Date: 2007-10-25 02:45:10 -0500 (Thu, 25 Oct 2007) New Revision: 4285 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: Preliminary accelerate framework test Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 07:24:06 UTC (rev 4284) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 07:45:10 UTC (rev 4285) @@ -1,14 +1,17 @@ #! /usr/bin/env python -# Last Change: Thu Oct 25 02:00 PM 2007 J +# Last Change: Thu Oct 25 04:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) +import sys import os.path from copy import deepcopy +from distutils.util import get_platform from libinfo_scons import NumpyCheckLib from testcode_snippets import cblas_sgemm as cblas_src -def _check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath): +def _check_include_and_run(context, name, cpppath, headers, run_src, libs, + libpath, linkflags, cflags): """This is a basic implementation for generic "test include and run" testers. @@ -24,7 +27,8 @@ - headers: list of headers - run_src: the code for the run test - libs: list of libraries to link - - libpath: list of library path.""" + - libpath: list of library path. + - linkflags: list of link flags to add.""" context.Message('Checking for %s ... ' % name) env = context.env @@ -80,7 +84,7 @@ libpath = os.path.join(mkl_dir, 'lib', nb) return _check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], - cblas_src, libs, libpath) + cblas_src, libs, libpath, [], []) def CheckATLAS(context, atl_dir): """atl_dir is the root path of ATLAS (the one which contains libatlas).""" @@ -89,10 +93,28 @@ libpath = atl_dir return _check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h'], - cblas_src, libs, libpath) + cblas_src, libs, libpath, [], []) def CheckCBLAS(context): - libs = ['cblas'] + cflags = [] + if sys.platform == 'darwin': + # According to + # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: + # + # This page contains a continually expanding set of vector libraries + # that are available to the AltiVec programmer through the Accelerate + # framework on MacOS X.3, Panther. On earlier versions of MacOS X, + # these were available in vecLib.framework. The currently available + # libraries are described below. + if get_platform()[-4:] == 'i386': + is_intel = 1 + cflags.append('-msse3') + else: + is_intel = 0 + cflags.append('-faltivec') + cflags.append('-framework Accelerate') + else: + libs = ['cblas'] return _check_include_and_run(context, 'CBLAS', [], [], cblas_src, - libs, []) + libs, [], [], cflags) From numpy-svn at scipy.org Thu Oct 25 03:49:52 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 02:49:52 -0500 (CDT) Subject: [Numpy-svn] r4286 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025074952.AAE8E39C0BE@new.scipy.org> Author: cdavid Date: 2007-10-25 02:49:49 -0500 (Thu, 25 Oct 2007) New Revision: 4286 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: Trivial fix for custom checkers. Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 07:45:10 UTC (rev 4285) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 07:49:49 UTC (rev 4286) @@ -97,6 +97,7 @@ def CheckCBLAS(context): cflags = [] + libs = [] if sys.platform == 'darwin': # According to # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: @@ -112,9 +113,10 @@ else: is_intel = 0 cflags.append('-faltivec') + # TODO: we should have a small test code to test Accelerate vs veclib cflags.append('-framework Accelerate') else: - libs = ['cblas'] + libs.append('cblas') return _check_include_and_run(context, 'CBLAS', [], [], cblas_src, libs, [], [], cflags) From numpy-svn at scipy.org Thu Oct 25 03:53:23 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 02:53:23 -0500 (CDT) Subject: [Numpy-svn] r4287 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025075323.31BA139C10A@new.scipy.org> Author: cdavid Date: 2007-10-25 02:53:18 -0500 (Thu, 25 Oct 2007) New Revision: 4287 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: Fix trivial error: actually use the cflags argument in custom checker. Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 07:49:49 UTC (rev 4286) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 07:53:18 UTC (rev 4287) @@ -36,7 +36,9 @@ # Check headers are available #---------------------------- oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] + oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] env.Append(CPPPATH = cpppath) + env.Append(CFLAGS = cflags) # XXX: handle context hcode = ['#include <%s>' % h for h in headers] # HACK: we add cpppath in the command of the source, to add dependency of @@ -47,6 +49,7 @@ ret = context.TryCompile(src, '.c') if not ret: env.Replace(CPPPATH = oldCPPPATH) + env.Replace(CFLAGS = oldCFLAGS) context.Result('Failed: %s include not found' % name) return 0 From numpy-svn at scipy.org Thu Oct 25 03:58:32 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 02:58:32 -0500 (CDT) Subject: [Numpy-svn] r4288 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025075832.3CD9239C0BE@new.scipy.org> Author: cdavid Date: 2007-10-25 02:58:23 -0500 (Thu, 25 Oct 2007) New Revision: 4288 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: Fix framework flags for custom checker. Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 07:53:18 UTC (rev 4287) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 07:58:23 UTC (rev 4288) @@ -117,7 +117,9 @@ is_intel = 0 cflags.append('-faltivec') # TODO: we should have a small test code to test Accelerate vs veclib - cflags.append('-framework Accelerate') + # XXX: This double append is not good, any other way ? + cflags.append('-framework') + clfags.append('Accelerate') else: libs.append('cblas') From numpy-svn at scipy.org Thu Oct 25 04:00:58 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 03:00:58 -0500 (CDT) Subject: [Numpy-svn] r4289 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025080058.BCA9E39C0BE@new.scipy.org> Author: cdavid Date: 2007-10-25 03:00:54 -0500 (Thu, 25 Oct 2007) New Revision: 4289 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: Fix typo Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 07:58:23 UTC (rev 4288) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 08:00:54 UTC (rev 4289) @@ -119,7 +119,7 @@ # TODO: we should have a small test code to test Accelerate vs veclib # XXX: This double append is not good, any other way ? cflags.append('-framework') - clfags.append('Accelerate') + cflags.append('Accelerate') else: libs.append('cblas') From numpy-svn at scipy.org Thu Oct 25 07:16:42 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 06:16:42 -0500 (CDT) Subject: [Numpy-svn] r4290 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025111642.53E4039C042@new.scipy.org> Author: cdavid Date: 2007-10-25 06:16:33 -0500 (Thu, 25 Oct 2007) New Revision: 4290 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py Log: Fix CheckCBLAS for accelerate framework on mac os X Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 08:00:54 UTC (rev 4289) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 11:16:33 UTC (rev 4290) @@ -66,7 +66,9 @@ # HACK: we add libpath and libs at the end of the source as a comment, to # add dependency of the check on those. - src = '\n'.join([run_src, '#if 0', '%s' % libpath, '%s' % libs, '#endif']) + src = '\n'.join(['#include <%s>' % h for h in headers] +\ + [run_src, '#if 0', '%s' % libpath, + '%s' % headers, '%s' % libs, '#endif']) ret = context.TryLink(src, '.c') if not ret: env.Replace(LIBS = oldLIBS) @@ -95,12 +97,13 @@ libs = ['atlas', 'f77blas', 'cblas'] libpath = atl_dir - return _check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h'], + return _check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h', 'cblas.h'], cblas_src, libs, libpath, [], []) def CheckCBLAS(context): cflags = [] libs = [] + headers = [] if sys.platform == 'darwin': # According to # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: @@ -120,8 +123,10 @@ # XXX: This double append is not good, any other way ? cflags.append('-framework') cflags.append('Accelerate') + headers.append('Accelerate/Accelerate.h') else: + headers.append('cblas.h') libs.append('cblas') - return _check_include_and_run(context, 'CBLAS', [], [], cblas_src, + return _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, libs, [], [], cflags) Modified: branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-10-25 08:00:54 UTC (rev 4289) +++ branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-10-25 11:16:33 UTC (rev 4290) @@ -7,7 +7,6 @@ # Check whether CBLAS sgemm works cblas_sgemm = """ -#include int main (void) From numpy-svn at scipy.org Thu Oct 25 07:19:50 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 06:19:50 -0500 (CDT) Subject: [Numpy-svn] r4291 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025111950.1BC0C39C042@new.scipy.org> Author: cdavid Date: 2007-10-25 06:19:43 -0500 (Thu, 25 Oct 2007) New Revision: 4291 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: More fixes CheckCBLAS for accelerate framework on mac os X Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 11:16:33 UTC (rev 4290) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 11:19:43 UTC (rev 4291) @@ -101,7 +101,7 @@ cblas_src, libs, libpath, [], []) def CheckCBLAS(context): - cflags = [] + linkflags = [] libs = [] headers = [] if sys.platform == 'darwin': @@ -121,12 +121,12 @@ cflags.append('-faltivec') # TODO: we should have a small test code to test Accelerate vs veclib # XXX: This double append is not good, any other way ? - cflags.append('-framework') - cflags.append('Accelerate') + linkflags.append('-framework') + linkflags.append('Accelerate') headers.append('Accelerate/Accelerate.h') else: headers.append('cblas.h') libs.append('cblas') return _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, - libs, [], [], cflags) + libs, [], linkflags, []) From numpy-svn at scipy.org Thu Oct 25 07:21:34 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 06:21:34 -0500 (CDT) Subject: [Numpy-svn] r4292 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025112134.A895039C042@new.scipy.org> Author: cdavid Date: 2007-10-25 06:21:26 -0500 (Thu, 25 Oct 2007) New Revision: 4292 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: More fixes CheckCBLAS for accelerate framework on mac os X Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 11:19:43 UTC (rev 4291) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 11:21:26 UTC (rev 4292) @@ -101,6 +101,7 @@ cblas_src, libs, libpath, [], []) def CheckCBLAS(context): + cflags = [] linkflags = [] libs = [] headers = [] @@ -129,4 +130,4 @@ libs.append('cblas') return _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, - libs, [], linkflags, []) + libs, [], linkflags, cflags) From numpy-svn at scipy.org Thu Oct 25 07:23:51 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 06:23:51 -0500 (CDT) Subject: [Numpy-svn] r4293 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025112351.4D40F39C13A@new.scipy.org> Author: cdavid Date: 2007-10-25 06:23:46 -0500 (Thu, 25 Oct 2007) New Revision: 4293 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: More fixes CheckCBLAS for accelerate framework on mac os X Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 11:21:26 UTC (rev 4292) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 11:23:46 UTC (rev 4293) @@ -60,9 +60,11 @@ oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] # XXX: RPATH, drawbacks using it ? oldRPATH = (env.has_key('RPATH') and deepcopy(env['RPATH'])) or [] + oldLINKFLAGS = (env.has_key('LINKFLAGS') and deepcopy(env['LINKFLAGS'])) or [] env.Append(LIBPATH = libpath) env.Append(LIBS = libs) env.Append(RPATH = libpath) + env.Append(LINKFLAGS = linkflags) # HACK: we add libpath and libs at the end of the source as a comment, to # add dependency of the check on those. @@ -74,6 +76,7 @@ env.Replace(LIBS = oldLIBS) env.Replace(LIBPATH = oldLIBPATH) env.Replace(RPATH = oldRPATH) + env.Replace(LINKFLAGS = oldLINKFLAGS) context.Result('Failed: %s test could not be linked and run' % name) return 0 From numpy-svn at scipy.org Thu Oct 25 11:07:43 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 10:07:43 -0500 (CDT) Subject: [Numpy-svn] r4294 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071025150743.46A9939C04F@new.scipy.org> Author: cdavid Date: 2007-10-25 10:07:36 -0500 (Thu, 25 Oct 2007) New Revision: 4294 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: Add site.cfg support for cblas detector Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 11:23:46 UTC (rev 4293) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 15:07:36 UTC (rev 4294) @@ -7,6 +7,7 @@ from copy import deepcopy from distutils.util import get_platform +from libinfo import get_config, get_paths, parse_config_param from libinfo_scons import NumpyCheckLib from testcode_snippets import cblas_sgemm as cblas_src @@ -104,33 +105,62 @@ cblas_src, libs, libpath, [], []) def CheckCBLAS(context): - cflags = [] - linkflags = [] - libs = [] - headers = [] - if sys.platform == 'darwin': - # According to - # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: - # - # This page contains a continually expanding set of vector libraries - # that are available to the AltiVec programmer through the Accelerate - # framework on MacOS X.3, Panther. On earlier versions of MacOS X, - # these were available in vecLib.framework. The currently available - # libraries are described below. - if get_platform()[-4:] == 'i386': - is_intel = 1 - cflags.append('-msse3') - else: - is_intel = 0 - cflags.append('-faltivec') - # TODO: we should have a small test code to test Accelerate vs veclib - # XXX: This double append is not good, any other way ? - linkflags.append('-framework') - linkflags.append('Accelerate') - headers.append('Accelerate/Accelerate.h') + + # If section cblas is in site.cfg, use those options. Otherwise, use default + section = "cblas" + siteconfig, cfgfiles = get_config() + if siteconfig.has_section('cblas'): + import warnings + import ConfigParser + warnings.warn('FIXME: site.cfg not support yet') + try: + libpath = get_paths(siteconfig.get(section, 'library_dirs')) + except ConfigParser.NoSectionError, e: + libpath = [] + + try: + cpppath = get_paths(siteconfig.get(section, 'include_dirs')) + except ConfigParser.NoSectionError, e: + cpppath = [] + + try: + libs = parse_config_param(siteconfig.get(section, 'libraries')) + except ConfigParser.NoSectionError, e: + libs = [] + headers = ['cblas.h'] + linkflags = [] + cflags = [] else: - headers.append('cblas.h') - libs.append('cblas') + cflags = [] + linkflags = [] + libs = [] + libpath = [] + headers = [] + if sys.platform == 'darwin': + # According to + # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: + # + # This page contains a continually expanding set of vector libraries + # that are available to the AltiVec programmer through the Accelerate + # framework on MacOS X.3, Panther. On earlier versions of MacOS X, + # these were available in vecLib.framework. The currently available + # libraries are described below. + #if get_platform()[-4:] == 'i386': + # is_intel = 1 + # cflags.append('-msse3') + #else: + # is_intel = 0 + # cflags.append('-faltivec') + + # TODO: we should have a small test code to test Accelerate vs veclib + # XXX: This double append is not good, any other way ? + linkflags.append('-framework') + linkflags.append('Accelerate') + headers.append('Accelerate/Accelerate.h') + else: + headers.append('cblas.h') + libs.append('cblas') + return _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, - libs, [], linkflags, cflags) + libs, libpath, linkflags, cflags) From numpy-svn at scipy.org Thu Oct 25 22:40:08 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 21:40:08 -0500 (CDT) Subject: [Numpy-svn] r4295 - in branches/numpy.scons/numpy: core distutils/scons Message-ID: <20071026024008.1690439C020@new.scipy.org> Author: cdavid Date: 2007-10-25 21:39:59 -0500 (Thu, 25 Oct 2007) New Revision: 4295 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/libinfo.py Log: Refactor the site.cfg part in custom checkers, to be reusable in generic checkers. Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-25 15:07:36 UTC (rev 4294) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-26 02:39:59 UTC (rev 4295) @@ -1,4 +1,4 @@ -# Last Change: Thu Oct 25 04:00 PM 2007 J +# Last Change: Fri Oct 26 11:00 AM 2007 J # vim:syntax=python import os import sys @@ -88,7 +88,6 @@ mlibs = [[], ['m'], ['cpml']] mathlib = os.environ.get('MATHLIB') if mathlib: - # XXX: prepend it mlibs.insert(0, mathlib) for mlib in mlibs: st = config.CheckBrokenMathlib(mlib) @@ -99,7 +98,7 @@ import SCons raise SCons.Errors.UserError("No usable mathlib was found: chose another "\ "one using the MATHLIB env variable, eg "\ - "MATHLIB=m") + "'MATHLIB=m python setup.py build'") config_sym.append(('MATHLIB', mlib)) def check_lib(f, autoadd = 0): @@ -145,7 +144,6 @@ build_blasdot = 1 else: build_blasdot = 0 -#config.CheckMKL('/home/david/opt/intel/mkl/9.1.023/', '32') config.Finish() config_f = open('config.log', 'r') Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-25 15:07:36 UTC (rev 4294) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-26 02:39:59 UTC (rev 4295) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Thu Oct 25 04:00 PM 2007 J +# Last Change: Fri Oct 26 11:00 AM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -7,7 +7,7 @@ from copy import deepcopy from distutils.util import get_platform -from libinfo import get_config, get_paths, parse_config_param +from libinfo import get_config, get_config_from_section from libinfo_scons import NumpyCheckLib from testcode_snippets import cblas_sgemm as cblas_src @@ -104,29 +104,22 @@ return _check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h', 'cblas.h'], cblas_src, libs, libpath, [], []) +def CheckAccelerate(context): + """Checker for Accelerate framework (on Mac OS X >= 10.3).""" + + linkflags = ['-framework', 'Accelerate'] + + return _check_include_and_run(context, 'FRAMEWORK: Accelerate', None, + ['Accelerate/Accelerate.h'], cblas_src, [], + [], linkflags, []) + def CheckCBLAS(context): # If section cblas is in site.cfg, use those options. Otherwise, use default section = "cblas" siteconfig, cfgfiles = get_config() - if siteconfig.has_section('cblas'): - import warnings - import ConfigParser - warnings.warn('FIXME: site.cfg not support yet') - try: - libpath = get_paths(siteconfig.get(section, 'library_dirs')) - except ConfigParser.NoSectionError, e: - libpath = [] - - try: - cpppath = get_paths(siteconfig.get(section, 'include_dirs')) - except ConfigParser.NoSectionError, e: - cpppath = [] - - try: - libs = parse_config_param(siteconfig.get(section, 'libraries')) - except ConfigParser.NoSectionError, e: - libs = [] + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if found: headers = ['cblas.h'] linkflags = [] cflags = [] Modified: branches/numpy.scons/numpy/distutils/scons/libinfo.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-10-25 15:07:36 UTC (rev 4294) +++ branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-10-26 02:39:59 UTC (rev 4295) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Thu Oct 25 01:00 PM 2007 J +# Last Change: Fri Oct 26 11:00 AM 2007 J # Module for support to look for external code (replacement of # numpy.distutils.system_info). KEEP THIS INDEPENDANT OF SCONS ! @@ -61,5 +61,30 @@ Example: if var is foo:bar, it will return ['foo', 'bar'] on posix.""" return var.split(os.pathsep) +def get_config_from_section(siteconfig, section): + """For the given siteconfig and section, return the found information. + + Returns a tuple (info, found), where: + info : tuple (cpppath, libs, libpath), containing a list of path or libraries + found: 1 if the section was found, 0 otherwise.""" + if siteconfig.has_section(section): + try: + libpath = get_paths(siteconfig.get(section, 'library_dirs')) + except ConfigParser.NoSectionError, e: + libpath = [] + + try: + cpppath = get_paths(siteconfig.get(section, 'include_dirs')) + except ConfigParser.NoSectionError, e: + cpppath = [] + + try: + libs = parse_config_param(siteconfig.get(section, 'libraries')) + except ConfigParser.NoSectionError, e: + libs = [] + return (cpppath, libs, libpath), 1 + else: + return ([], [], []), 0 + if __name__ == '__main__': pass From numpy-svn at scipy.org Thu Oct 25 23:08:13 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 22:08:13 -0500 (CDT) Subject: [Numpy-svn] r4296 - in branches/numpy.scons/numpy: distutils/scons scons_fake Message-ID: <20071026030813.EBB2639C06A@new.scipy.org> Author: cdavid Date: 2007-10-25 22:07:57 -0500 (Thu, 25 Oct 2007) New Revision: 4296 Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/custom_checkers.py branches/numpy.scons/numpy/scons_fake/setup.py branches/numpy.scons/numpy/scons_fake/setupscons.py Log: Add autoadd option to custom checkers Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 02:39:59 UTC (rev 4295) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 03:07:57 UTC (rev 4296) @@ -1,6 +1,7 @@ from numpyenv import GetNumpyEnvironment, GetNumpyOptions from libinfo_scons import NumpyCheckLib from libinfo import get_paths as scons_get_paths -#from custom_checkers import CheckTypeSize +from custom_checkers import CheckMKL, CheckATLAS, CheckCBLAS, \ + CheckAccelerate, CheckMKL2 from extension import get_python_inc, get_pythonlib_dir from utils import isstring Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-26 02:39:59 UTC (rev 4295) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-26 03:07:57 UTC (rev 4296) @@ -12,7 +12,7 @@ from testcode_snippets import cblas_sgemm as cblas_src def _check_include_and_run(context, name, cpppath, headers, run_src, libs, - libpath, linkflags, cflags): + libpath, linkflags, cflags, autoadd = 1): """This is a basic implementation for generic "test include and run" testers. @@ -73,11 +73,14 @@ [run_src, '#if 0', '%s' % libpath, '%s' % headers, '%s' % libs, '#endif']) ret = context.TryLink(src, '.c') - if not ret: + if (not ret or not autoadd): + # If test failed or autoadd = 0, restore everything env.Replace(LIBS = oldLIBS) env.Replace(LIBPATH = oldLIBPATH) env.Replace(RPATH = oldRPATH) env.Replace(LINKFLAGS = oldLINKFLAGS) + + if not ret: context.Result('Failed: %s test could not be linked and run' % name) return 0 @@ -93,27 +96,36 @@ libpath = os.path.join(mkl_dir, 'lib', nb) return _check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], - cblas_src, libs, libpath, [], []) + cblas_src, libs, libpath, [], [], autoadd) -def CheckATLAS(context, atl_dir): - """atl_dir is the root path of ATLAS (the one which contains libatlas).""" +def CheckMKL2(context, autoadd = 1): + section = "mkl" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + headers = ['mkl.h'] + return _check_include_and_run(context, 'MKL', cpppath, headers, + cblas_src, libs, libpath, [], [], autoadd) + +def CheckATLAS(context, autoadd = 1): + """Check whether ATLAS is usable in C.""" + libs = ['atlas', 'f77blas', 'cblas'] - libpath = atl_dir + libpath = [] return _check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h', 'cblas.h'], - cblas_src, libs, libpath, [], []) + cblas_src, libs, libpath, [], [], autoadd) -def CheckAccelerate(context): +def CheckAccelerate(context, autoadd = 1): """Checker for Accelerate framework (on Mac OS X >= 10.3).""" linkflags = ['-framework', 'Accelerate'] return _check_include_and_run(context, 'FRAMEWORK: Accelerate', None, ['Accelerate/Accelerate.h'], cblas_src, [], - [], linkflags, []) + [], linkflags, [], autoadd) -def CheckCBLAS(context): +def CheckCBLAS(context, autoadd = 1): # If section cblas is in site.cfg, use those options. Otherwise, use default section = "cblas" @@ -156,4 +168,4 @@ libs.append('cblas') return _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, - libs, libpath, linkflags, cflags) + libs, libpath, linkflags, cflags, autoadd) Modified: branches/numpy.scons/numpy/scons_fake/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-26 02:39:59 UTC (rev 4295) +++ branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-26 03:07:57 UTC (rev 4296) @@ -8,6 +8,7 @@ config.add_subpackage('pyext') config.add_subpackage('ctypesext') config.add_subpackage('checklib') + config.add_subpackage('checkers') config.add_subpackage('hook') return config Modified: branches/numpy.scons/numpy/scons_fake/setupscons.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setupscons.py 2007-10-26 02:39:59 UTC (rev 4295) +++ branches/numpy.scons/numpy/scons_fake/setupscons.py 2007-10-26 03:07:57 UTC (rev 4296) @@ -8,6 +8,7 @@ config.add_subpackage('pyext') config.add_subpackage('ctypesext') config.add_subpackage('checklib') + config.add_subpackage('checkers') config.add_subpackage('hook') return config From numpy-svn at scipy.org Thu Oct 25 23:31:51 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 22:31:51 -0500 (CDT) Subject: [Numpy-svn] r4297 - in branches/numpy.scons/numpy/scons_fake: . checkers Message-ID: <20071026033151.E900539C151@new.scipy.org> Author: cdavid Date: 2007-10-25 22:31:45 -0500 (Thu, 25 Oct 2007) New Revision: 4297 Added: branches/numpy.scons/numpy/scons_fake/checkers/ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct branches/numpy.scons/numpy/scons_fake/checkers/setup.py Log: Forgot to add checkers example in svn. Added: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-26 03:07:57 UTC (rev 4296) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-26 03:31:45 UTC (rev 4297) @@ -0,0 +1,22 @@ +# vim:syntax=python +from numpy.distutils.scons import GetNumpyEnvironment, CheckATLAS, \ + CheckAccelerate, CheckMKL2, CheckCBLAS + +env = GetNumpyEnvironment(ARGUMENTS) + +config = env.NumpyConfigure(custom_tests = + {'CheckATLAS' : CheckATLAS, + 'CheckMKL' : CheckMKL2, + 'CheckAccelerate' : CheckAccelerate, + 'CheckCBLAS' : CheckCBLAS}) + +config.CheckATLAS(autoadd = 0) +config.CheckMKL(autoadd = 0) +config.CheckAccelerate(autoadd = 0) + +config.Finish() + +if env.has_key('LIBS'): + print env.Dump('LIBS') +else: + print "No LIBS in env" Added: branches/numpy.scons/numpy/scons_fake/checkers/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/setup.py 2007-10-26 03:07:57 UTC (rev 4296) +++ branches/numpy.scons/numpy/scons_fake/checkers/setup.py 2007-10-26 03:31:45 UTC (rev 4297) @@ -0,0 +1,13 @@ +import os +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('checkers',parent_package,top_path) + + config.add_sconscript('SConstruct') + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) From numpy-svn at scipy.org Fri Oct 26 00:52:30 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 23:52:30 -0500 (CDT) Subject: [Numpy-svn] r4298 - in branches/numpy.scons/numpy: distutils/scons scons_fake/checkers Message-ID: <20071026045230.550FE39C11B@new.scipy.org> Author: cdavid Date: 2007-10-25 23:52:21 -0500 (Thu, 25 Oct 2007) New Revision: 4298 Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct Log: Add Sunperf checker (C called only) Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 03:31:45 UTC (rev 4297) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 04:52:21 UTC (rev 4298) @@ -2,6 +2,6 @@ from libinfo_scons import NumpyCheckLib from libinfo import get_paths as scons_get_paths from custom_checkers import CheckMKL, CheckATLAS, CheckCBLAS, \ - CheckAccelerate, CheckMKL2 + CheckAccelerate, CheckMKL2, CheckSunperf from extension import get_python_inc, get_pythonlib_dir from utils import isstring Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-26 03:31:45 UTC (rev 4297) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-26 04:52:21 UTC (rev 4298) @@ -9,7 +9,7 @@ from libinfo import get_config, get_config_from_section from libinfo_scons import NumpyCheckLib -from testcode_snippets import cblas_sgemm as cblas_src +from testcode_snippets import cblas_sgemm as cblas_src, c_sgemm as sunperf_src def _check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath, linkflags, cflags, autoadd = 1): @@ -99,6 +99,7 @@ cblas_src, libs, libpath, [], [], autoadd) def CheckMKL2(context, autoadd = 1): + """Check MKL is usable using a simple cblas example.""" section = "mkl" siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) @@ -125,6 +126,17 @@ ['Accelerate/Accelerate.h'], cblas_src, [], [], linkflags, [], autoadd) +def CheckSunperf(context, autoadd = 1): + """Checker for sunperf using a simple sunperf example""" + + # XXX: Other options needed ? + linkflags = ['-xlic_lib=sunperf'] + cflags = ['-dalign'] + + return _check_include_and_run(context, 'sunperf', None, + ['sunperf.h'], sunperf_src, [], + [], linkflags, cflags, autoadd) + def CheckCBLAS(context, autoadd = 1): # If section cblas is in site.cfg, use those options. Otherwise, use default Modified: branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-10-26 03:31:45 UTC (rev 4297) +++ branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-10-26 04:52:21 UTC (rev 4298) @@ -6,18 +6,20 @@ # symbols or headers, those are overkill). # Check whether CBLAS sgemm works -cblas_sgemm = """ +cblas_sgemm = r""" int main (void) { int lda = 3; - float A[] = { 0.11, 0.12, 0.13, - 0.21, 0.22, 0.23 }; + float A[] = {1, 2, 3, + 4, 5, 6}; + int ldb = 2; - float B[] = { 1011, 1012, - 1021, 1022, - 1031, 1032 }; + float B[] = {1, 2, + 3, 4, + 5, 6}; + int ldc = 2; float C[] = { 0.00, 0.00, 0.00, 0.00 }; @@ -30,3 +32,34 @@ return 0; } """ + +# Check whether calling sgemm from C works (FOLLOW FORTRAN CONVENTION !). This +# is useful to test sunperf, for example. +c_sgemm = r""" +/* + * sunperf, when calling func wo cblas_ prefix, follows Fortran convention for + * array layout in memory ! + */ +int +main (void) +{ + int lda = 2; + float A[] = {1, 4, + 2, 5, + 3, 6}; + + int ldb = 3; + float B[] = {1, 3, 5, + 2, 4, 6}; + int ldc = 2; + float C[] = { 0.00, 0.00, + 0.00, 0.00 }; + + /* Compute C = A B */ + sgemm('N', 'N', 2, 2, 3, + 1.0, A, lda, B, ldb, 0.0, C, ldc); + + printf("C = {%f, %f; %f, %f}\n", C[0], C[2], C[1], C[3]); + return 0; +} +""" Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-26 03:31:45 UTC (rev 4297) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-26 04:52:21 UTC (rev 4298) @@ -1,6 +1,7 @@ # vim:syntax=python from numpy.distutils.scons import GetNumpyEnvironment, CheckATLAS, \ - CheckAccelerate, CheckMKL2, CheckCBLAS + CheckAccelerate, CheckMKL2, CheckCBLAS, \ + CheckSunperf env = GetNumpyEnvironment(ARGUMENTS) @@ -8,11 +9,14 @@ {'CheckATLAS' : CheckATLAS, 'CheckMKL' : CheckMKL2, 'CheckAccelerate' : CheckAccelerate, + 'CheckSunperf' : CheckSunperf, 'CheckCBLAS' : CheckCBLAS}) config.CheckATLAS(autoadd = 0) config.CheckMKL(autoadd = 0) config.CheckAccelerate(autoadd = 0) +config.CheckSunperf(autoadd = 0) +config.CheckCBLAS(autoadd = 0) config.Finish() From numpy-svn at scipy.org Fri Oct 26 00:53:34 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 25 Oct 2007 23:53:34 -0500 (CDT) Subject: [Numpy-svn] r4299 - branches/numpy.scons/numpy/core Message-ID: <20071026045334.C88FB39C11B@new.scipy.org> Author: cdavid Date: 2007-10-25 23:53:31 -0500 (Thu, 25 Oct 2007) New Revision: 4299 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Trivial changes in numpy.core SConstruct. Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-26 04:52:21 UTC (rev 4298) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-26 04:53:31 UTC (rev 4299) @@ -17,6 +17,9 @@ env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = [get_python_inc()]) if os.name == 'nt': + # NT needs the pythonlib to run any code importing Python.h, including + # simple code using only typedef and so on, so we need it for configuration + # checks env.AppendUnique(LIBPATH = [get_pythonlib_dir()]) #======================= @@ -25,8 +28,6 @@ # XXX: separate env for configuration config = env.NumpyConfigure(custom_tests = {'CheckBrokenMathlib' : CheckBrokenMathlib, 'CheckMathlib' : CheckMathlib, - 'CheckMKL' : CheckMKL, - 'CheckATLAS' : CheckATLAS, 'CheckCBLAS' : CheckCBLAS, 'NumpyCheckLib' : NumpyCheckLib}) @@ -83,7 +84,6 @@ ('rint', 'HAVE_RINT'), ] -# TODO: getting the math lib automatically ? Having a list ? # TODO: checklib vs checkfunc ? mlibs = [[], ['m'], ['cpml']] mathlib = os.environ.get('MATHLIB') From numpy-svn at scipy.org Fri Oct 26 01:46:29 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 00:46:29 -0500 (CDT) Subject: [Numpy-svn] r4300 - in branches/numpy.scons/numpy: core distutils/scons scons_fake/checkers Message-ID: <20071026054629.48B7F39C151@new.scipy.org> Author: cdavid Date: 2007-10-26 00:46:19 -0500 (Fri, 26 Oct 2007) New Revision: 4300 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/custom_checkers.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct Log: Add veclib check for cblas check on darwin; small fixes. Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-26 04:53:31 UTC (rev 4299) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-26 05:46:19 UTC (rev 4300) @@ -1,4 +1,4 @@ -# Last Change: Fri Oct 26 11:00 AM 2007 J +# Last Change: Fri Oct 26 02:00 PM 2007 J # vim:syntax=python import os import sys @@ -146,11 +146,11 @@ build_blasdot = 0 config.Finish() -config_f = open('config.log', 'r') -print "++++++++++ config.log dump ++++++++++++++++++" -for i in config_f: - print i.strip('\n') -print "+++++++++++++++++++++++++++++++++++++++++++++" +#config_f = open('config.log', 'r') +#print "++++++++++ config.log dump ++++++++++++++++++" +#for i in config_f: +# print i.strip('\n') +#print "+++++++++++++++++++++++++++++++++++++++++++++" #========== # Build Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 04:53:31 UTC (rev 4299) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 05:46:19 UTC (rev 4300) @@ -2,6 +2,6 @@ from libinfo_scons import NumpyCheckLib from libinfo import get_paths as scons_get_paths from custom_checkers import CheckMKL, CheckATLAS, CheckCBLAS, \ - CheckAccelerate, CheckMKL2, CheckSunperf + CheckAccelerate, CheckMKL, CheckSunperf from extension import get_python_inc, get_pythonlib_dir from utils import isstring Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-26 04:53:31 UTC (rev 4299) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-26 05:46:19 UTC (rev 4300) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Fri Oct 26 11:00 AM 2007 J +# Last Change: Fri Oct 26 02:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -87,18 +87,18 @@ context.Result(ret) return ret -def CheckMKL(context, mkl_dir, nb): - """mkl_lib is the root path of MKL (the one which contains include, lib, - etc...). nb is 32, 64, emt, etc...""" +#def CheckMKL(context, mkl_dir, nb): +# """mkl_lib is the root path of MKL (the one which contains include, lib, +# etc...). nb is 32, 64, emt, etc...""" +# +# libs = ['mkl'] +# cpppath = os.path.join(mkl_dir, 'include') +# libpath = os.path.join(mkl_dir, 'lib', nb) +# +# return _check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], +# cblas_src, libs, libpath, [], [], autoadd) - libs = ['mkl'] - cpppath = os.path.join(mkl_dir, 'include') - libpath = os.path.join(mkl_dir, 'lib', nb) - - return _check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], - cblas_src, libs, libpath, [], [], autoadd) - -def CheckMKL2(context, autoadd = 1): +def CheckMKL(context, autoadd = 1): """Check MKL is usable using a simple cblas example.""" section = "mkl" siteconfig, cfgfiles = get_config() @@ -118,14 +118,41 @@ cblas_src, libs, libpath, [], [], autoadd) def CheckAccelerate(context, autoadd = 1): - """Checker for Accelerate framework (on Mac OS X >= 10.3).""" + """Checker for Accelerate framework (on Mac OS X >= 10.3). Only test from + C.""" + # According to + # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: + # + # This page contains a continually expanding set of vector libraries + # that are available to the AltiVec programmer through the Accelerate + # framework on MacOS X.3, Panther. On earlier versions of MacOS X, + # these were available in vecLib.framework. The currently available + # libraries are described below. + #XXX: get_platform does not seem to work... + #if get_platform()[-4:] == 'i386': + # is_intel = 1 + # cflags.append('-msse3') + #else: + # is_intel = 0 + # cflags.append('-faltivec') + + # XXX: This double append is not good, any other way ? linkflags = ['-framework', 'Accelerate'] return _check_include_and_run(context, 'FRAMEWORK: Accelerate', None, ['Accelerate/Accelerate.h'], cblas_src, [], [], linkflags, [], autoadd) +def CheckVeclib(context, autoadd = 1): + """Checker for Veclib framework (on Mac OS X < 10.3).""" + # XXX: This double append is not good, any other way ? + linkflags = ['-framework', 'vecLib'] + + return _check_include_and_run(context, 'FRAMEWORK: veclib', None, + ['vecLib/vecLib.h'], cblas_src, [], + [], linkflags, [], autoadd) + def CheckSunperf(context, autoadd = 1): """Checker for sunperf using a simple sunperf example""" @@ -147,37 +174,23 @@ headers = ['cblas.h'] linkflags = [] cflags = [] + return _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, + libs, libpath, linkflags, cflags, autoadd) else: - cflags = [] - linkflags = [] - libs = [] - libpath = [] - headers = [] if sys.platform == 'darwin': - # According to - # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: - # - # This page contains a continually expanding set of vector libraries - # that are available to the AltiVec programmer through the Accelerate - # framework on MacOS X.3, Panther. On earlier versions of MacOS X, - # these were available in vecLib.framework. The currently available - # libraries are described below. - - #if get_platform()[-4:] == 'i386': - # is_intel = 1 - # cflags.append('-msse3') - #else: - # is_intel = 0 - # cflags.append('-faltivec') - - # TODO: we should have a small test code to test Accelerate vs veclib - # XXX: This double append is not good, any other way ? - linkflags.append('-framework') - linkflags.append('Accelerate') - headers.append('Accelerate/Accelerate.h') + st = CheckAccelerate(context, autoadd) + if st: + return st + st = CheckVeclib(context, autoadd) + return st + else: - headers.append('cblas.h') - libs.append('cblas') - - return _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, - libs, libpath, linkflags, cflags, autoadd) + # Check MKL, then ATLAS, then Sunperf + st = CheckMKL(context, autoadd) + if st: + return st + st = CheckATLAS(context, autoadd) + if st: + return st + st = CheckSunperf(context, autoadd) + return st Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-26 04:53:31 UTC (rev 4299) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-26 05:46:19 UTC (rev 4300) @@ -1,22 +1,22 @@ # vim:syntax=python from numpy.distutils.scons import GetNumpyEnvironment, CheckATLAS, \ - CheckAccelerate, CheckMKL2, CheckCBLAS, \ + CheckAccelerate, CheckMKL, CheckCBLAS, \ CheckSunperf env = GetNumpyEnvironment(ARGUMENTS) config = env.NumpyConfigure(custom_tests = {'CheckATLAS' : CheckATLAS, - 'CheckMKL' : CheckMKL2, + 'CheckMKL' : CheckMKL, 'CheckAccelerate' : CheckAccelerate, 'CheckSunperf' : CheckSunperf, 'CheckCBLAS' : CheckCBLAS}) -config.CheckATLAS(autoadd = 0) -config.CheckMKL(autoadd = 0) -config.CheckAccelerate(autoadd = 0) -config.CheckSunperf(autoadd = 0) -config.CheckCBLAS(autoadd = 0) +#config.CheckATLAS(autoadd = 0) +#config.CheckMKL(autoadd = 0) +#config.CheckAccelerate(autoadd = 0) +#config.CheckSunperf(autoadd = 0) +#config.CheckCBLAS(autoadd = 0) config.Finish() From numpy-svn at scipy.org Fri Oct 26 02:01:34 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 01:01:34 -0500 (CDT) Subject: [Numpy-svn] r4301 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071026060134.C4BA239C0D2@new.scipy.org> Author: cdavid Date: 2007-10-26 01:01:31 -0500 (Fri, 26 Oct 2007) New Revision: 4301 Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Put config.log log files into separate directories for each subproject. Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-26 05:46:19 UTC (rev 4300) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-26 06:01:31 UTC (rev 4301) @@ -131,9 +131,11 @@ # XXX: Really, we should use our own subclass of Environment, instead of # adding Numpy* functions ! - # Put config code in separate dir for each subpackage + # Put config code and log in separate dir for each subpackage from utils import curry - NumpyConfigure = curry(env.Configure, conf_dir = pjoin(env['build_dir'], '.sconf')) + NumpyConfigure = curry(env.Configure, + conf_dir = pjoin(env['build_dir'], '.sconf'), + log_file = pjoin(env['build_dir'], 'config.log')) env.NumpyConfigure = NumpyConfigure # XXX: Huge, ugly hack ! SConsign needs an absolute path or a path From numpy-svn at scipy.org Fri Oct 26 02:02:03 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 01:02:03 -0500 (CDT) Subject: [Numpy-svn] r4302 - branches/numpy.scons/numpy/scons_fake/checkers Message-ID: <20071026060203.B4D1539C0D2@new.scipy.org> Author: cdavid Date: 2007-10-26 01:02:00 -0500 (Fri, 26 Oct 2007) New Revision: 4302 Modified: branches/numpy.scons/numpy/scons_fake/checkers/ Log: Ignore .pyc files in scons_fake Property changes on: branches/numpy.scons/numpy/scons_fake/checkers ___________________________________________________________________ Name: svn:ignore + *.pyc From numpy-svn at scipy.org Fri Oct 26 03:18:25 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 02:18:25 -0500 (CDT) Subject: [Numpy-svn] r4303 - in branches/numpy.scons/numpy/distutils/scons: . tools Message-ID: <20071026071825.D690239C148@new.scipy.org> Author: cdavid Date: 2007-10-26 02:18:10 -0500 (Fri, 26 Oct 2007) New Revision: 4303 Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/custom_builders.py branches/numpy.scons/numpy/distutils/scons/fortran.py branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py Log: Do not make any SCons import in modules, to avoid clashes between internal scons and external scons Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 06:02:00 UTC (rev 4302) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 07:18:10 UTC (rev 4303) @@ -5,3 +5,7 @@ CheckAccelerate, CheckMKL, CheckSunperf from extension import get_python_inc, get_pythonlib_dir from utils import isstring + +def test(level=1, verbosity=1): + from numpy.testing import NumpyTest + return NumpyTest().test(level, verbosity) Modified: branches/numpy.scons/numpy/distutils/scons/custom_builders.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_builders.py 2007-10-26 06:02:00 UTC (rev 4302) +++ branches/numpy.scons/numpy/distutils/scons/custom_builders.py 2007-10-26 07:18:10 UTC (rev 4303) @@ -1,8 +1,5 @@ from os.path import join as pjoin -from SCons.Environment import Environment -import SCons.Util - def NumpySharedLibrary(env, target, source, *args, **kw): """This builder is the same than SharedLibrary, except for the fact that it takes into account build dir info passed by distutils, and put the target at @@ -18,6 +15,7 @@ """This builder is the same than PythonExtension, except for the fact that it takes into account build dir info passed by distutils, and put the target at the right location in distutils build directory for correct installation.""" + import SCons.Util newsource = [] for i in source: if SCons.Util.is_String(i): Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-10-26 06:02:00 UTC (rev 4302) +++ branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-10-26 07:18:10 UTC (rev 4303) @@ -1,9 +1,10 @@ -#! Last Change: Tue Oct 23 08:00 PM 2007 J +#! Last Change: Fri Oct 26 03:00 PM 2007 J # This module defines some functions/classes useful for testing fortran-related # features (name mangling, F77/C runtime, etc...). # KEEP THIS INDEPENDENT OF SCONS, PLEASE !!! +# All this module is total crap, refactor it + needs testing import sys import re @@ -11,7 +12,9 @@ GCC_DRIVER_LINE = re.compile('^Driving:') POSIX_STATIC_EXT = re.compile('\S+\.a') POSIX_LIB_FLAGS = re.compile('-l\S+') +MERGE_SPACE_R1 = re.compile('^-[LRuYz]$') + def _check_link_verbose_posix(lines): """Returns true if useful link options can be found in output. @@ -31,14 +34,12 @@ else: return _check_link_verbose_posix(lines) -merge_space_r1 = re.compile('^-[LRuYz]$') - def merge_space(line): """matcher should be a callable, line a list of tokens.""" nline = [] for i in range(len(line)): ##print "hoho is %s" % line[i] - if merge_space_r1.match(line[i]): + if MERGE_SPACE_R1.match(line[i]): ##print '%s matched !' % line[i] merged = [line[i]] if not (line[i+1][0] == '-'): Modified: branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-10-26 06:02:00 UTC (rev 4302) +++ branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-10-26 07:18:10 UTC (rev 4303) @@ -1,13 +1,11 @@ #! /usr/bin/env python -# Last Change: Thu Oct 25 01:00 PM 2007 J +# Last Change: Fri Oct 26 04:00 PM 2007 J # Module for support to look for external code (replacement of # numpy.distutils.system_info). scons dependant code. import ConfigParser from copy import deepcopy -from SCons.Util import is_List - from libinfo import get_config, get_paths, parse_config_param from utils import get_empty @@ -117,6 +115,8 @@ # # This needs testing, too. #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + from SCons.Util import is_List + env = context.env # XXX: would be nice for each extension to add an option to Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-26 06:02:00 UTC (rev 4302) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-26 07:18:10 UTC (rev 4303) @@ -5,19 +5,15 @@ from distutils.sysconfig import get_config_vars -from SCons.Options import Options -from SCons.Environment import Environment -from SCons.Tool import Tool, FindTool, FindAllTools -from SCons.Script import BuildDir, Help - from numpy.distutils.command.scons import get_scons_build_dir from default import tool_list from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension from libinfo import get_config from extension_scons import PythonExtension -from tools.substinfile import TOOL_SUBST +from numpy.distutils.scons.tools.substinfile import TOOL_SUBST + def pyplat2sconsplat(): # XXX: should see how env['PLATFORM'] is defined, make this a dictionary if sys.platform[:5] == 'linux': @@ -50,6 +46,8 @@ def GetNumpyOptions(args): """Call this with args=ARGUMENTS to take into account command line args.""" + from SCons.Options import Options + opts = Options(None, args) # Add directories related info opts.Add('pkg_name', 'name of the package (including parent package if any)', '') @@ -71,6 +69,10 @@ def GetNumpyEnvironment(args): """Call this with args = ARGUMENTS.""" + from SCons.Environment import Environment + from SCons.Tool import Tool, FindTool, FindAllTools + from SCons.Script import BuildDir, Help + # XXX: I would prefer subclassing Environment, because we really expect # some different behaviour than just Environment instances... opts = GetNumpyOptions(args) Modified: branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py 2007-10-26 06:02:00 UTC (rev 4302) +++ branches/numpy.scons/numpy/distutils/scons/tools/substinfile.py 2007-10-26 07:18:10 UTC (rev 4303) @@ -1,9 +1,6 @@ -# Last Change: Thu Oct 18 03:00 PM 2007 J +# Last Change: Fri Oct 26 04:00 PM 2007 J import re -import SCons.Action -from SCons.Builder import Builder -from SCons.Script import Depends def TOOL_SUBST(env): """Adds SubstInFile builder, which substitutes the keys->values of SUBST_DICT @@ -15,6 +12,10 @@ If there's more than one source and more than one target, each target gets substituted from the corresponding source. """ + import SCons.Action + from SCons.Builder import Builder + from SCons.Script import Depends + env.Append(TOOLS = 'SUBST') def do_subst_in_file(targetfile, sourcefile, dict): """Replace all instances of the keys of dict with their values. From numpy-svn at scipy.org Fri Oct 26 03:19:00 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 02:19:00 -0500 (CDT) Subject: [Numpy-svn] r4304 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071026071900.E284939C148@new.scipy.org> Author: cdavid Date: 2007-10-26 02:18:53 -0500 (Fri, 26 Oct 2007) New Revision: 4304 Added: branches/numpy.scons/numpy/distutils/scons/setup.py Log: Forgot to add custom setup.py for scons module Added: branches/numpy.scons/numpy/distutils/scons/setup.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/setup.py 2007-10-26 07:18:10 UTC (rev 4303) +++ branches/numpy.scons/numpy/distutils/scons/setup.py 2007-10-26 07:18:53 UTC (rev 4304) @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('scons',parent_package,top_path) + config.add_subpackage('tools') + config.add_data_dir('tests') + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) From numpy-svn at scipy.org Fri Oct 26 04:06:59 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 03:06:59 -0500 (CDT) Subject: [Numpy-svn] r4305 - in branches/numpy.scons/numpy/distutils/scons: . tests Message-ID: <20071026080659.F09A639C054@new.scipy.org> Author: cdavid Date: 2007-10-26 03:06:46 -0500 (Fri, 26 Oct 2007) New Revision: 4305 Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/fortran.py branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py Log: Refactor fortran link output parsing + tests Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 07:18:53 UTC (rev 4304) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 08:06:46 UTC (rev 4305) @@ -5,6 +5,7 @@ CheckAccelerate, CheckMKL, CheckSunperf from extension import get_python_inc, get_pythonlib_dir from utils import isstring +import fortran def test(level=1, verbosity=1): from numpy.testing import NumpyTest Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-10-26 07:18:53 UTC (rev 4304) +++ branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-10-26 08:06:46 UTC (rev 4305) @@ -1,10 +1,9 @@ -#! Last Change: Fri Oct 26 03:00 PM 2007 J +#! Last Change: Fri Oct 26 04:00 PM 2007 J # This module defines some functions/classes useful for testing fortran-related # features (name mangling, F77/C runtime, etc...). # KEEP THIS INDEPENDENT OF SCONS, PLEASE !!! -# All this module is total crap, refactor it + needs testing import sys import re @@ -14,81 +13,89 @@ POSIX_LIB_FLAGS = re.compile('-l\S+') MERGE_SPACE_R1 = re.compile('^-[LRuYz]$') +# linkflags which match those are ignored +LINKFLAGS_IGNORED = [r'-lang*', r'-lcrt[a-zA-Z0-9]*\.o', r'-lc', r'-lgcc*', + r'-lSystem', r'-libmil', r'-LIST:*', r'-LNO:*'] +RLINKFLAGS_IGNORED = [re.compile(i) for i in LINKFLAGS_IGNORED] +# linkflags which match those are the one we are interested in +LINKFLAGS_INTERESTING = [r'-[lLR][a-zA-Z0-9]*'] +RLINKFLAGS_INTERESTING = [re.compile(i) for i in LINKFLAGS_INTERESTING] + def _check_link_verbose_posix(lines): """Returns true if useful link options can be found in output. + POSIX implementation. + Expect lines to be a list of lines.""" for line in lines: if not GCC_DRIVER_LINE.search(line): - #print line - #print POSIX_STATIC_EXT.search(line) - #print POSIX_LIB_FLAGS.search(line) if POSIX_STATIC_EXT.search(line) or POSIX_LIB_FLAGS.search(line): return True return False def check_link_verbose(lines): + """Return true if useful link option can be found in output.""" if sys.platform == 'win32': raise NotImplementedError("FIXME: not implemented on win32") else: return _check_link_verbose_posix(lines) def merge_space(line): - """matcher should be a callable, line a list of tokens.""" + """For options taking an argument, merge them to avoid spaces. + + line should be a list of tokens.""" nline = [] for i in range(len(line)): - ##print "hoho is %s" % line[i] if MERGE_SPACE_R1.match(line[i]): - ##print '%s matched !' % line[i] merged = [line[i]] if not (line[i+1][0] == '-'): merged.append(line[i+1]) i += 1 nline.append(''.join(merged)) - ##print '\t%s matched !' % ''.join(merged) else: nline.append(line[i]) return nline def homo_libpath_flags(flags): + """For arguments like -YP, transform them into -L.""" nflags = [] - #print 'flags is %s' % flags - #print "len flags is %d" % len(flags) for i in flags: if i[:4] == "-YP,": i = i.replace('-YP,', '-L') i = i.replace(':', ' -L') - nflags.append(i) + nflags.extend(i.split(' ')) else: nflags.append(i) return nflags +def match_ignore(str): + if [i for i in RLINKFLAGS_IGNORED if i.match(str)]: + return True + else: + return False + +def match_interesting(str): + pop = [i for i in RLINKFLAGS_INTERESTING if i.match(str)] + if pop: + return True + else: + return False + def parse_f77link(lines): """Given the output of verbose link of F77 compiler, this returns a list of flags necessary for linking using the standard linker.""" # TODO: On windows ? # TODO: take into account quotting... - # TODO: those regex are really bad... Should try to get as similar as - # possible to autoconf here. - # XXX: this is really messy, clean it up ! - ignored = ['-lang*', r'-lcrt[a-zA-Z0-9]*\.o', '-lc', '-lgcc*', - '-lSystem', '-libmil', '-LIST:*', '-LNO:*'] - inter = ['-[lLR][a-zA-Z0-9]*'] # Those options takes an argument, so concatenate any following item # until the end of the line or a new option. remove_space = ['-[LRuYz]*'] - import re - rignored = [re.compile(i) for i in ignored] - rinter = [re.compile(i) for i in inter] - # We ignore lines starting with Driving - rgccignored = re.compile('^Driving:') final_flags = [] for line in lines: # Here we go (convention for wildcard is shell, not regex !) # 1 TODO: we first get some root .a libraries # 2 TODO: take everything starting by -bI:* - # 3 TODO: ignore the following flags: -lang* | -lcrt*.o | -lc | + # 3 Ignore the following flags: -lang* | -lcrt*.o | -lc | # -lgcc* | -lSystem | -libmil | -LANG:=* | -LIST:* | -LNO:*) # 4 TODO: take into account -lkernel32 # 5 For options of the kind -[[LRuYz]], as they take one argument @@ -96,31 +103,21 @@ # removing space between the flag and its argument. # 6 For -YP,*: take and replace by -Larg where arg is the old argument # 7 For -[lLR]*: take - if not rgccignored.match(line): + if not GCC_DRIVER_LINE.match(line): + flags = line.split() + + # Step 3 + flags = [i for i in flags if not match_ignore(i)] + # Step 5 - flags = merge_space(line.split()) + flags = merge_space(flags) + # Step 6 - ##print 'homo flags are: %s (%d items)' % (flags, len(flags)) flags = homo_libpath_flags(flags) - #print 'homo flags are: %s ' % flags - def match_ignore(str): - if [i for i in rignored if i.match(str)]: - return True - else: - return False - def match_interesting(str): - pop = [i for i in rinter if i.match(str)] - if pop: - #print "pop %s" % str - return True - else: - return False + # Step 7 + good_flags = [i for i in flags if match_interesting(i)] - # Step 3 - good_flags = [i for i in flags if not match_ignore(i)] - #print good_flags - good_flags = [i for i in good_flags if match_interesting(i)] final_flags.extend(good_flags) return final_flags Modified: branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py 2007-10-26 07:18:53 UTC (rev 4304) +++ branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py 2007-10-26 08:06:46 UTC (rev 4305) @@ -7,6 +7,12 @@ gcc version 3.4.6 (Ubuntu 3.4.6-6ubuntu1) /usr/lib/gcc/i486-linux-gnu/3.4.6/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o empty /usr/lib/gcc/i486-linux-gnu/3.4.6/../../../../lib/crt1.o /usr/lib/gcc/i486-linux-gnu/3.4.6/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/3.4.6/crtbegin.o -L/usr/lib/gcc/i486-linux-gnu/3.4.6 -L/usr/lib/gcc/i486-linux-gnu/3.4.6 -L/usr/lib/gcc/i486-linux-gnu/3.4.6/../../../../lib -L/usr/lib/gcc/i486-linux-gnu/3.4.6/../../.. -L/lib/../lib -L/usr/lib/../lib empty.o -lfrtbegin -lg2c -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/i486-linux-gnu/3.4.6/crtend.o /usr/lib/gcc/i486-linux-gnu/3.4.6/../../../../lib/crtn.o""" +g77_link_expected = ['-L/usr/lib/gcc/i486-linux-gnu/3.4.6', + '-L/usr/lib/gcc/i486-linux-gnu/3.4.6', + '-L/usr/lib/gcc/i486-linux-gnu/3.4.6/../../../../lib', + '-L/usr/lib/gcc/i486-linux-gnu/3.4.6/../../..', '-L/lib/../lib', + '-L/usr/lib/../lib', '-lfrtbegin', '-lg2c', '-lm'] + gfortran_link_output = """ Driving: gfortran -v -o hello hello.o -lgfortranbegin -lgfortran -lm -shared-libgcc Using built-in specs. @@ -16,6 +22,12 @@ gcc version 4.2.1 (Ubuntu 4.2.1-5ubuntu4) /usr/lib/gcc/i486-linux-gnu/4.2.1/collect2 --eh-frame-hdr -m elf_i386 --hash-style=both -dynamic-linker /lib/ld-linux.so.2 -o hello /usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib/crt1.o /usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.2.1/crtbegin.o -L/usr/lib/gcc/i486-linux-gnu/4.2.1 -L/usr/lib/gcc/i486-linux-gnu/4.2.1 -L/usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.2.1/../../.. hello.o -lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/i486-linux-gnu/4.2.1/crtend.o /usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib/crtn.o""" +gfortran_link_expected = ['-L/usr/lib/gcc/i486-linux-gnu/4.2.1', + '-L/usr/lib/gcc/i486-linux-gnu/4.2.1', + '-L/usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../lib', '-L/lib/../lib', + '-L/usr/lib/../lib', '-L/usr/lib/gcc/i486-linux-gnu/4.2.1/../../..', + '-lgfortranbegin', '-lgfortran', '-lm'] + sunfort_v12_link_output = """ NOTICE: Invoking /home/david/opt/sun/sunstudio12/bin/f90 -f77 -ftrap=%none -c empty.f ### command line files and options (expanded): @@ -29,9 +41,22 @@ MAIN hello: """ +sunfort_v12_link_expected = ['-R/home/david/opt/sun/sunstudio12/lib:'\ + '/opt/sun/sunstudio12/lib:/home/david/opt/sun/lib/rtlibs:'\ + '/opt/sun/lib/rtlibs', '-L/home/david/opt/sun/sunstudio12/lib', + '-L/home/david/opt/sun/sunstudio12/rtlibs', + '-L/home/david/opt/sun/sunstudio12/prod/lib', '-L/lib', '-L/usr/lib', + '-lfui', '-lfai', '-lfsu', '-lmtsk', '-lpthread', '-lm'] + ifort_v10_link_output = """ ld /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../crt1.o /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../crti.o /usr/lib/gcc/i486-linux-gnu/4.1.3/crtbegin.o --eh-frame-hdr -dynamic-linker /lib/ld-linux.so.2 -m elf_i386 -o a.out /home/david/opt/intel/fc/10.0.023//lib/for_main.o empty.o -L/home/david/opt/intel/fc/10.0.023//lib -L/usr/lib/gcc/i486-linux-gnu/4.1.3/ -L/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../ -Bstatic -lifport -lifcore -limf -Bdynamic -lm -Bstatic -lipgo -lirc -Bdynamic -lc -lgcc_s -lgcc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/lib/gcc/i486-linux-gnu/4.1.3/crtend.o /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../crtn.o """ + +ifort_v10_link_expected = ['-L/home/david/opt/intel/fc/10.0.023//lib', + '-L/usr/lib/gcc/i486-linux-gnu/4.1.3/', + '-L/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../', '-lifport', + '-lifcore', '-limf', '-lm', '-lipgo', '-lirc', '-lirc_s', '-ldl'] + def generate_output(fcomp, verbose): import os os.system('%s -c %s &> /dev/null ' % (fcomp, 'empty.f')) Modified: branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py 2007-10-26 07:18:53 UTC (rev 4304) +++ branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py 2007-10-26 08:06:46 UTC (rev 4305) @@ -1,33 +1,45 @@ -#! Last Change: Tue Oct 23 08:00 PM 2007 J +#! Last Change: Fri Oct 26 04:00 PM 2007 J -import sys -import random +from numpy.testing import NumpyTestCase, set_package_path, restore_path, set_local_path -import unittest +set_package_path() +from scons.fortran import parse_f77link +restore_path() -from fortran import parse_f77link - +set_local_path() from fortran_output import g77_link_output, gfortran_link_output, \ - sunfort_v12_link_output, ifort_v10_link_output + sunfort_v12_link_output, ifort_v10_link_output, \ + g77_link_expected, gfortran_link_expected, \ + sunfort_v12_link_expected, ifort_v10_link_expected +restore_path() -class TestCheckF77Verbose(unittest.TestCase): +class test_CheckF77Verbose(NumpyTestCase): def setUp(self): pass def test_g77(self): - print parse_f77link(g77_link_output.split('\n')) + """Parsing g77 link output.""" + assert parse_f77link(g77_link_output.split('\n')) == g77_link_expected def test_gfortran(self): - print parse_f77link(gfortran_link_output.split('\n')) + """Parsing gfortran link output.""" + assert parse_f77link(gfortran_link_output.split('\n')) == \ + gfortran_link_expected def test_sunf77(self): - print parse_f77link(sunfort_v12_link_output.split('\n')) + """Parsing sunfort link output.""" + assert parse_f77link(sunfort_v12_link_output.split('\n')) == \ + sunfort_v12_link_expected def test_intel_posix(self): - print parse_f77link(ifort_v10_link_output.split('\n')) + """Parsing ifort link output.""" + assert parse_f77link(ifort_v10_link_output.split('\n')) == \ + ifort_v10_link_expected def test_intel_win(self): + """Parsing ifort link output on win32.""" print "FIXME: testing verbose output of win32 intel fortran" if __name__ == '__main__': - unittest.main() + from numpy.testing import NumpyTest + NumpyTest().test() From numpy-svn at scipy.org Fri Oct 26 04:14:12 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 03:14:12 -0500 (CDT) Subject: [Numpy-svn] r4306 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071026081412.9714239C1B6@new.scipy.org> Author: cdavid Date: 2007-10-26 03:14:02 -0500 (Fri, 26 Oct 2007) New Revision: 4306 Added: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py Log: Add scons checkers for fortran related capabilities. Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 08:06:46 UTC (rev 4305) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 08:14:02 UTC (rev 4306) @@ -5,7 +5,7 @@ CheckAccelerate, CheckMKL, CheckSunperf from extension import get_python_inc, get_pythonlib_dir from utils import isstring -import fortran +from fortran_scons import CheckF77Verbose, CheckF77Clib, CheckF77Mangling def test(level=1, verbosity=1): from numpy.testing import NumpyTest Added: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-10-26 08:06:46 UTC (rev 4305) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-10-26 08:14:02 UTC (rev 4306) @@ -0,0 +1,326 @@ +# Last Change: Tue Oct 09 04:00 PM 2007 J +import os +import sys +import string + +from os.path import basename, join as pjoin, dirname +from copy import deepcopy + +from utils import popen_wrapper +from fortran import parse_f77link, check_link_verbose + +#----------------- +# Public functions +#----------------- + +# Getting verbose flag +def _CheckFVerbose(context, fcomp): + flags = ['-v', '--verbose', '-verbose', '-V'] + for flag in flags: + if _check_f_vflag(context, flag, fcomp): + return 1, flag + + return 0, '' + +def CheckF77Verbose(context): + context.Message('Checking F77 %s verbose flag ... ' % context.env['F77'] ) + + res, flag = _CheckFVerbose(context, 'F77') + if res: + context.Result(flag) + context.env['F77LINK_VFLAG'] = flag + else: + context.Result('Failed !') + + return res + +def CheckF90Verbose(context): + context.Message('Checking F90 %s verbose flag ... ' % context.env['F90'] ) + + res, flag = _CheckFVerbose(context, 'F90') + if res: + context.Result(flag) + context.env['F90LINK_VFLAG'] = flag + else: + context.Result('Failed !') + + return res + +# Checking whether the fortran compiler can compile and link a dummy program +def _CheckFDryRun(context, fc = 'F77'): + """Check whether the compiler fc can compile a program.""" + env = context.env + try: + fcomp = env[fc] + except KeyError: + raise RuntimeError("Compiler type %s not known !" % fc) + + context.Message('Checking if %s compiler %s can create executables - ' % (fc, fcomp)) + # We use our own builder as long as I don't resolve the issue of TryLink + # returning 1 when it fails. + result = _build_empty_program(context, fc)[0] + context.Result((result and 'yes' or 'no')) + return result + +def CheckF77DryRun(context): + """Check whether the F77 compiler can compile a program.""" + return _CheckFDryRun(context, 'F77') + +def CheckF90DryRun(context): + """Check whether the F90 compiler can compile a program.""" + return _CheckFDryRun(context, 'F90') + +# Getting fortran support runtime +def CheckF77Clib(context): + """This tries to get Fortran runtime facilities necessary at link stage, + and put the relevant flags in env['F77_LDFLAGS'].""" + if sys.platform[:5] == 'win32': + raise Exception("FIXME: This is not tested on windows.... No chance "\ + "of working if using visual Intel") + fcompiler = 'F77' + # TODO: check that F77 exists, and can be run + if not context.env.has_key(fcompiler): + raise Exception("F77 should be set before calling CheckF77Clib !") + + fflags = 'LINKFLAGS' + env = context.env + config = context.sconf + context.Message('Checking %s C compatibility runtime ...' % env[fcompiler]) + # XXX: check how to get verbose output + verbose = '-v' + + # Convention old* variables MUST be restored in ANY CONDITION. + oldLINKFLAGS = env.has_key(fflags) and deepcopy(env[fflags]) or [] + + try: + context.env.Append(LINKFLAGS = verbose) + res, cnt = _build_empty_program(context, fcompiler) + finally: + env.Replace(LINKFLAGS = oldLINKFLAGS) + + if res == 1: + final_flags = parse_f77link(cnt) + env.Append(F77_LDFLAGS = ' '.join(final_flags)) + context.Result(env['F77_LDFLAGS']) + else: + context.Result('Failed !') + + return res + +# If need a dummy main +def _CheckFDummyMain(context, fcomp): + fcn_tmpl = """ +int %s() { return 0; } +""" + env = context.env + savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] + try: + env['LINK'] = env[fcomp] + mains = ["MAIN__", "__MAIN", "_MAIN", "MAIN_"] + mains.extend([string.lower(m) for m in mains]) + mains.insert(0, "") + mains.append("MAIN") + mains.append("main") + for m in mains: + prog = fcn_tmpl % "dummy" + if m: + prog = fcn_tmpl % m + prog + result = context.TryLink(prog, '.c') + if result: + if not m: + m = None + break + finally: + env.Replace(LINK = savedLINK) + return result, m + +# XXX: refactor those by using function templates +def CheckF77DummyMain(context): + context.Message('Checking if %s needs dummy main - ' % context.env['F77']) + res, m = _CheckFDummyMain(context, 'F77') + if res: + context.Result("%s." % str(m)) + context.env['F77_DUMMY_MAIN'] = m + else: + context.Result("Failed !") + + return res + +def CheckF90DummyMain(context): + context.Message('Checking if %s needs dummy main - ' % context.env['F90']) + res, m = _CheckFDummyMain(context, 'F90') + if res: + context.Result("%s." % str(m)) + context.env['F90_DUMMY_MAIN'] = m + else: + context.Result("Failed !" % str(m)) + + return res + +# Fortran name mangling +def _CheckFMangling(context, fc, dummym, ext): + subr = """ + subroutine foobar() + return + end + subroutine foo_bar() + return + end +""" + main_tmpl = """ +int %s() { return 1; } +""" + prog_tmpl = """ +void %s(void); +void %s(void); +int my_main() { + %s(); + %s(); + return 0; +} +""" + env = context.env + savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] + savedLIBS = env.has_key('LIBS') and deepcopy(env['LIBS']) or [] + # TODO: if does not exist, call the function to get the F77_DUMMY_MAIN + m = dummym + try: + env['LINK'] = env[fc] + # variants: + # lower-case, no underscore, no double underscore: foobar, foo_bar + # ... + # upper-case, underscore, double underscore: FOOBAR_, FOO_BAR__ + context.TryCompile(subr, ext) + obj = context.lastTarget + env.Append(LIBS = env.StaticLibrary(obj)) + under = ['', '_'] + doubleunder = ['', '_'] + casefcn = ["lower", "upper"] + gen = _RecursiveGenerator(under, doubleunder, casefcn) + while True: + try: + u, du, c = gen.next() + def make_mangler(u, du, c): + return lambda n: getattr(string, c)(n) +\ + u + (n.find('_') != -1 and du or '') + mangler = make_mangler(u, du, c) + foobar = mangler("foobar") + foo_bar = mangler("foo_bar") + prog = prog_tmpl % (foobar, foo_bar, foobar, foo_bar) + if m: + prog = main_tmpl % m + prog + result = context.TryLink(prog, '.c') + if result: + break + except StopIteration: + result = mangler = u = du = c = None + break + finally: + env.Replace(LINK = savedLINK) + env.Replace(LIBS = savedLIBS) + return result, mangler, u, du, c + +def CheckF77Mangling(context): + env = context.env + context.Message('Checking %s name mangling - ' % env['F77']) + res, mangler, u, du, c = _CheckFMangling(context, 'F77', env['F77_DUMMY_MAIN'], '.f') + if res: + context.Result("'%s', '%s', %s-case." % (u, du, c)) + env['F77_NAME_MANGLER'] = mangler + else: + context.Result("all variants failed.") + return res + +def CheckF90Mangling(context): + env = context.env + context.Message('Checking %s name mangling - ' % env['F90']) + res, mangler, u, du, c = _CheckFMangling(context, 'F90', env['F90_DUMMY_MAIN'], '.f90') + if res: + context.Result("'%s', '%s', %s-case." % (u, du, c)) + env['F90_NAME_MANGLER'] = mangler + else: + context.Result("all variants failed.") + return res + +#------------------ +# Support functions +#------------------ +def _check_f_vflag(context, flag, fcomp): + """Return True if flag is an acceptable verbose flag for fortran compiler + fcomp.""" + + oldLINKFLAGS = context.env['LINKFLAGS'] + res = 0 + try: + context.env.Append(LINKFLAGS = flag) + res, out = _build_empty_program(context, fcomp) + finally: + context.env['LINKFLAGS'] = oldLINKFLAGS + + return res and check_link_verbose(out) + +def _build_empty_program(context, fcomp): + """Build an empty fortran stand alone program, and capture the output of + the link step. + + Return: + st : 1 on success, 0 on failure. + list : list of lines of the output.""" + cnt = [] + src = """ + PROGRAM MAIN + END""" + # XXX: the logic to choose fortran compiler is bogus... + if fcomp == 'F77': + res = context.TryCompile(src, '.f') + elif fcomp == 'F90': + res = context.TryCompile(src, '.f90') + else: + raise RuntimeError("fcomp %s not implemented..." % fcomp) + return 0 + if res: + oldLINK = context.env['LINK'] + # XXX: get the fortran compiler + context.env['LINK'] = '$' + fcomp + res = 0 + try: + # We always want to do this build, and we do not want scons cache + # to interfer. So we build a command executed directly through our + # popen_wrapper, which output is captured. + + # XXX: does this scheme to get the program name always work ? Can + # we use Scons to get the target name from the object name ? + slast = str(context.lastTarget) + dir = dirname(slast) + test_prog = pjoin(dir, basename(slast).split('.')[0]) + cmd = context.env.subst('$LINKCOM', + target = context.env.File(test_prog), + source = context.lastTarget) + st, out = popen_wrapper(cmd, merge = True) + if st: + res = 0 + else: + res = 1 + cnt = out.split('\n') + finally: + context.env['LINK'] = oldLINK + + return res, cnt + +# Helper to generate combinations of lists +def _RecursiveGenerator(*sets): + """Returns a generator that yields one tuple per element combination. + A set may be any iterable to which the not operator is applicable. + """ + if not sets: return + def calc(sets): + head, tail = sets[0], sets[1:] + if not tail: + for e in head: + yield (e,) + else: + for e in head: + for t in calc(tail): + yield (e,) + t + return calc(sets) + From numpy-svn at scipy.org Fri Oct 26 04:53:37 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 03:53:37 -0500 (CDT) Subject: [Numpy-svn] r4307 - in branches/numpy.scons/numpy/distutils: command scons Message-ID: <20071026085337.60B6639C08E@new.scipy.org> Author: cdavid Date: 2007-10-26 03:53:25 -0500 (Fri, 26 Oct 2007) New Revision: 4307 Modified: branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: F77 support for scons command. Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-26 08:14:02 UTC (rev 4306) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-26 08:53:25 UTC (rev 4307) @@ -6,6 +6,7 @@ from distutils.errors import DistutilsExecError, DistutilsSetupError from numpy.distutils.command.build_ext import build_ext as old_build_ext from numpy.distutils.ccompiler import CCompiler +from numpy.distutils.fcompiler import FCompiler from numpy.distutils.exec_command import find_executable from numpy.distutils import log @@ -53,9 +54,27 @@ else: return compiler.compiler[0] +def dist2sconsfc(compiler): + """This converts the name passed to distutils to scons name convention + (Fortran compiler). The argument should be a FCompiler instance. + + Example: + --fcompiler=intel -> ifort on linux, ifl on windows""" + if compiler.compiler_type == 'intel': + return 'intelc' + elif compiler.compiler_type == 'gnu': + return 'g77' + elif compiler.compiler_type == 'gnu95': + # XXX ? + return 'f95' + else: + return compiler.compiler_type + def get_compiler_executable(compiler): """For any give CCompiler instance, this gives us the name of C compiler - (the actual executable).""" + (the actual executable). + + NOTE: does NOT work with FCompiler instances.""" # Geez, why does distutils has no common way to get the compiler name... if compiler.compiler_type == 'msvc': # this is harcoded in distutils... A bit cleaner way would be to @@ -69,6 +88,11 @@ else: return compiler.compiler[0] +def get_f77_compiler_executable(compiler): + """For any give FCompiler instance, this gives us the name of F77 compiler + (the actual executable).""" + return compiler.compiler_f77[0] + def get_tool_path(compiler): """Given a distutils.ccompiler.CCompiler class, returns the path of the toolset related to C compilation.""" @@ -79,6 +103,17 @@ raise DistutilsSetupError("Could not find compiler executable info for scons") return fullpath +def get_f77_tool_path(compiler): + """Given a distutils.ccompiler.FCompiler class, returns the path of the + toolset related to F77 compilation.""" + fullpath_exec = find_executable(get_f77_compiler_executable(compiler)) + if fullpath_exec: + fullpath = pdirname(fullpath_exec) + else: + raise DistutilsSetupError("Could not find F77 compiler executable "\ + "info for scons") + return fullpath + def protect_path(path): """Convert path (given as a string) to something the shell will have no problem to understand (space, etc... problems).""" @@ -116,7 +151,7 @@ # full path, and add the path to the env['PATH'] variable in env # instance (this is done in numpy.distutils.scons module). compiler_type = self.compiler - from distutils.ccompiler import new_compiler + from numpy.distutils.ccompiler import new_compiler self.compiler = new_compiler(compiler=compiler_type, verbose=self.verbose, dry_run=self.dry_run, @@ -127,6 +162,15 @@ if hasattr(self.compiler, 'initialize'): self.compiler.initialize() + # We do the same for the fortran compiler + fcompiler_type = self.fcompiler + from numpy.distutils.fcompiler import new_fcompiler + self.fcompiler = new_fcompiler(compiler = fcompiler_type, + verbose = self.verbose, + dry_run = self.dry_run, + force = self.force) + self.fcompiler.customize(self.distribution) + def run(self): # XXX: when a scons script is missing, scons only prints warnings, and # does not return a failure (status is 0). We have to detect this from @@ -149,6 +193,10 @@ pdirname(sconscript))) cmd += ' cc_opt=%s ' % dist2sconscc(self.compiler) cmd += ' cc_opt_path=%s ' % protect_path(get_tool_path(self.compiler)) + + cmd += ' f77_opt=%s ' % dist2sconsfc(self.fcompiler) + cmd += ' f77_opt_path=%s ' % protect_path(get_f77_tool_path(self.fcompiler)) + cmd += ' include_bootstrap=%s ' % dirl_to_str(get_numpy_include_dirs()) log.info("Executing scons command: %s ", cmd) st = os.system(cmd) Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-26 08:14:02 UTC (rev 4306) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-26 08:53:25 UTC (rev 4307) @@ -65,6 +65,10 @@ # Add compiler related info opts.Add('cc_opt', 'name of C compiler', '') opts.Add('cc_opt_path', 'path of the C compiler set in cc_opt', '') + + opts.Add('f77_opt', 'name of F77 compiler', '') + opts.Add('f77_opt_path', 'path of the F77 compiler set in cc_opt', '') + return opts def GetNumpyEnvironment(args): @@ -130,6 +134,29 @@ t = Tool(FindTool(DEF_C_COMPILERS)) t(env) + # F77 compiler + if len(env['f77_opt']) > 0: + try: + if len(env['f77_opt_path']) > 0: + # XXX: what is the right way to add one directory in the + # PATH ? (may not work on windows). + t = Tool(env['f77_opt']) + t(env) + if sys.platform == 'win32': + env['ENV']['PATH'] += ';%s' % env['f77_opt_path'] + else: + env['ENV']['PATH'] += ':%s' % env['f77_opt_path'] + except EnvironmentError, e: + # scons could not understand cc_opt (bad name ?) + raise AssertionError("SCONS: Could not initialize tool ? Error is %s" % \ + str(e)) + else: + t = Tool(FindTool(DEF_FORTRAN_COMPILERS)) + t(env) + + # XXX: really have to understand how fortran compilers work in scons... + env['F77'] = env['_FORTRAND'] + # XXX: Really, we should use our own subclass of Environment, instead of # adding Numpy* functions ! @@ -157,8 +184,7 @@ # according to scons, don't ask me why, but this does not work as expected # for this tool. if not env['cc_opt'] == 'mingw': - for i in [DEF_LINKERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS, - DEF_FORTRAN_COMPILERS]: + for i in [DEF_LINKERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS]: t = FindTool(i, env) or i[0] Tool(t)(env) From numpy-svn at scipy.org Fri Oct 26 05:17:33 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 04:17:33 -0500 (CDT) Subject: [Numpy-svn] r4308 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071026091733.B6D4939C042@new.scipy.org> Author: cdavid Date: 2007-10-26 04:17:29 -0500 (Fri, 26 Oct 2007) New Revision: 4308 Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Forgot to add ARS default tool... (Static Builders did not work) Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-26 08:53:25 UTC (rev 4307) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-26 09:17:29 UTC (rev 4308) @@ -184,7 +184,7 @@ # according to scons, don't ask me why, but this does not work as expected # for this tool. if not env['cc_opt'] == 'mingw': - for i in [DEF_LINKERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS]: + for i in [DEF_LINKERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS, DEF_ARS]: t = FindTool(i, env) or i[0] Tool(t)(env) From numpy-svn at scipy.org Fri Oct 26 05:20:22 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 04:20:22 -0500 (CDT) Subject: [Numpy-svn] r4309 - in branches/numpy.scons/numpy: distutils/scons linalg Message-ID: <20071026092022.9284BC7C006@new.scipy.org> Author: cdavid Date: 2007-10-26 04:20:16 -0500 (Fri, 26 Oct 2007) New Revision: 4309 Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py branches/numpy.scons/numpy/linalg/SConstruct Log: Start work on checking BLAS/LAPACK for numpy.linalg Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-10-26 09:17:29 UTC (rev 4308) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-10-26 09:20:16 UTC (rev 4309) @@ -1,4 +1,4 @@ -# Last Change: Tue Oct 09 04:00 PM 2007 J +# Last Change: Fri Oct 26 06:00 PM 2007 J import os import sys import string @@ -222,6 +222,8 @@ def CheckF77Mangling(context): env = context.env + if not env.has_key('F77_DUMMY_MAIN'): + CheckF77DummyMain(context) context.Message('Checking %s name mangling - ' % env['F77']) res, mangler, u, du, c = _CheckFMangling(context, 'F77', env['F77_DUMMY_MAIN'], '.f') if res: Modified: branches/numpy.scons/numpy/linalg/SConstruct =================================================================== --- branches/numpy.scons/numpy/linalg/SConstruct 2007-10-26 09:17:29 UTC (rev 4308) +++ branches/numpy.scons/numpy/linalg/SConstruct 2007-10-26 09:20:16 UTC (rev 4309) @@ -1,11 +1,18 @@ -# Last Change: Thu Oct 18 09:00 PM 2007 J +# Last Change: Fri Oct 26 05:00 PM 2007 J # vim:syntax=python from numpy.distutils.misc_util import get_numpy_include_dirs from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths +from numpy.distutils.scons import CheckF77Mangling env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) +config = env.NumpyConfigure(custom_tests = + {'CheckF77Mangling' : CheckF77Mangling}) + +config.CheckF77Mangling() +config.Finish() + sources = ['lapack_litemodule.c', 'zlapack_lite.c', 'dlapack_lite.c', 'blas_lite.c', 'dlamch.c', 'f2c_lite.c'] lapack_lite = env.NumpyPythonExtension('lapack_lite', source = sources) From numpy-svn at scipy.org Fri Oct 26 08:29:28 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 07:29:28 -0500 (CDT) Subject: [Numpy-svn] r4310 - in branches/numpy.scons/numpy: distutils/scons linalg Message-ID: <20071026122928.CB131C7C00C@new.scipy.org> Author: cdavid Date: 2007-10-26 07:29:20 -0500 (Fri, 26 Oct 2007) New Revision: 4310 Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/fortran_scons.py branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py branches/numpy.scons/numpy/linalg/SConstruct Log: Add preliminary LAPACK checker, used in linalg Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 09:20:16 UTC (rev 4309) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 12:29:20 UTC (rev 4310) @@ -2,7 +2,7 @@ from libinfo_scons import NumpyCheckLib from libinfo import get_paths as scons_get_paths from custom_checkers import CheckMKL, CheckATLAS, CheckCBLAS, \ - CheckAccelerate, CheckMKL, CheckSunperf + CheckAccelerate, CheckMKL, CheckSunperf, CheckLAPACK from extension import get_python_inc, get_pythonlib_dir from utils import isstring from fortran_scons import CheckF77Verbose, CheckF77Clib, CheckF77Mangling Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-26 09:20:16 UTC (rev 4309) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-26 12:29:20 UTC (rev 4310) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Fri Oct 26 02:00 PM 2007 J +# Last Change: Fri Oct 26 09:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -9,8 +9,11 @@ from libinfo import get_config, get_config_from_section from libinfo_scons import NumpyCheckLib -from testcode_snippets import cblas_sgemm as cblas_src, c_sgemm as sunperf_src +from testcode_snippets import cblas_sgemm as cblas_src, \ + c_sgemm as sunperf_src, lapack_sgesv +from fortran_scons import CheckF77Mangling, CheckF77Clib + def _check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath, linkflags, cflags, autoadd = 1): """This is a basic implementation for generic "test include and run" @@ -38,8 +41,8 @@ #---------------------------- oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] - env.Append(CPPPATH = cpppath) - env.Append(CFLAGS = cflags) + env.AppendUnique(CPPPATH = cpppath) + env.AppendUnique(CFLAGS = cflags) # XXX: handle context hcode = ['#include <%s>' % h for h in headers] # HACK: we add cpppath in the command of the source, to add dependency of @@ -62,10 +65,10 @@ # XXX: RPATH, drawbacks using it ? oldRPATH = (env.has_key('RPATH') and deepcopy(env['RPATH'])) or [] oldLINKFLAGS = (env.has_key('LINKFLAGS') and deepcopy(env['LINKFLAGS'])) or [] - env.Append(LIBPATH = libpath) - env.Append(LIBS = libs) - env.Append(RPATH = libpath) - env.Append(LINKFLAGS = linkflags) + env.AppendUnique(LIBPATH = libpath) + env.AppendUnique(LIBS = libs) + env.AppendUnique(RPATH = libpath) + env.AppendUnique(LINKFLAGS = linkflags) # HACK: we add libpath and libs at the end of the source as a comment, to # add dependency of the check on those. @@ -103,6 +106,9 @@ section = "mkl" siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if not found: + # XXX: find exact options to use for the MKL + libs.extend(['lapack', 'mkl', 'guide', 'm']) headers = ['mkl.h'] return _check_include_and_run(context, 'MKL', cpppath, headers, @@ -194,3 +200,52 @@ return st st = CheckSunperf(context, autoadd) return st + +def CheckLAPACK(context, autoadd = 1): + # XXX: this whole thing is ugly. Think more about how to combine checkers + # in 'meta checker' like this. + if sys.platform == 'nt': + import warnings + warning.warn('FIXME: LAPACK checks not implemented yet on win32') + return 0 + else: + # Get fortran stuff + if not CheckF77Mangling(context): + return 0 + if not CheckF77Clib(context): + return 0 + + env = context.env + + # Get the mangled name of our test function + sgesv_string = env['F77_NAME_MANGLER']('sgesv') + test_src = lapack_sgesv % sgesv_string + + # Check MKL + st = CheckMKL(context, autoadd) + if st: + fdict = env.ParseFlags(context.env['F77_LDFLAGS']) + fdict['LIBS'].append('lapack') + if env.has_key('LIBS'): + fdict['LIBS'].extend(context.env['LIBS']) + if env.has_key('LIBPATH'): + fdict['LIBPATH'].extend(context.env['LIBPATH']) + st =_check_include_and_run(context, 'LAPACK (MKL)', [], [], + test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) + return st + + # Check ATLAS + st = CheckATLAS(context, autoadd) + if st: + fdict = env.ParseFlags(context.env['F77_LDFLAGS']) + fdict['LIBS'].append('lapack') + if env.has_key('LIBS'): + fdict['LIBS'].extend(context.env['LIBS']) + if env.has_key('LIBPATH'): + fdict['LIBPATH'].extend(context.env['LIBPATH']) + st =_check_include_and_run(context, 'LAPACK (ATLAS)', [], [], + test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) + # XXX: Check complete LAPACK or not + return st + + return 0 Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-10-26 09:20:16 UTC (rev 4309) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-10-26 12:29:20 UTC (rev 4310) @@ -221,6 +221,10 @@ return result, mangler, u, du, c def CheckF77Mangling(context): + """Find mangling of the F77 compiler. + + If sucessfull, env['F77_NAME_MANGLER'] is a function which given the C + name, returns the F77 name as seen by the linker.""" env = context.env if not env.has_key('F77_DUMMY_MAIN'): CheckF77DummyMain(context) Modified: branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-10-26 09:20:16 UTC (rev 4309) +++ branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-10-26 12:29:20 UTC (rev 4310) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Thu Oct 25 01:00 PM 2007 J +# Last Change: Fri Oct 26 08:00 PM 2007 J # This module should contains useful test code (as strings). They are mainly # useful for checkers who need to run the tests (to check the mere presence of @@ -63,3 +63,43 @@ return 0; } """ + +# Code which try sgesv (the exact symbol has to be given by lapack_sgsev % symbol) +lapack_sgesv = r""" +#define our_fancy_func %s + +extern int our_fancy_func(int *n, int *nrhs, float a[], int *lda, int ipiv[], + float b[], int *ldb, int *info); + +int compare(float A[], float B[], int sz) +{ + int i; + + for(i = 0; i < sz; ++i) { + if ( (A[i] - B[i] > 0.01) || (A[i] - B[i] < -0.01)) { + return -1; + } + } + return 0; +} + +int main(void) +{ + int n = 2; + int nrhs = 2; + int lda = 2; + float A[] = { 1, 3, 2, 4}; + + int ldb = 2; + float B[] = { 1, 0, 0, 1}; + float X[] = { -2, 1.5, 1, -0.5}; + + int ipov[] = {0, 0}; + int info; + + /* Compute X in A * X = B */ + our_fancy_func(&n, &nrhs, A, &lda, ipov, B, &ldb, &info); + + return compare(B, X, 4); +} +""" Modified: branches/numpy.scons/numpy/linalg/SConstruct =================================================================== --- branches/numpy.scons/numpy/linalg/SConstruct 2007-10-26 09:20:16 UTC (rev 4309) +++ branches/numpy.scons/numpy/linalg/SConstruct 2007-10-26 12:29:20 UTC (rev 4310) @@ -1,19 +1,30 @@ -# Last Change: Fri Oct 26 05:00 PM 2007 J +# Last Change: Fri Oct 26 09:00 PM 2007 J # vim:syntax=python -from numpy.distutils.misc_util import get_numpy_include_dirs +from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths -from numpy.distutils.scons import CheckF77Mangling +from numpy.distutils.scons import CheckLAPACK env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) config = env.NumpyConfigure(custom_tests = - {'CheckF77Mangling' : CheckF77Mangling}) + {'CheckLAPACK' : CheckLAPACK}) -config.CheckF77Mangling() +# XXX: this is ugly, better find the mathlibs with a checker +for i in scons_get_paths(env['include_bootstrap']): + try: + mlib = get_mathlibs(i) + break + except IOError: + pass +env.AppendUnique(LIBS = mlib) + +use_lapack = config.CheckLAPACK() config.Finish() -sources = ['lapack_litemodule.c', 'zlapack_lite.c', 'dlapack_lite.c', - 'blas_lite.c', 'dlamch.c', 'f2c_lite.c'] +sources = ['lapack_litemodule.c'] +if not use_lapack: + sources.extend(['zlapack_lite.c', 'dlapack_lite.c', 'blas_lite.c', + 'dlamch.c', 'f2c_lite.c']) lapack_lite = env.NumpyPythonExtension('lapack_lite', source = sources) From numpy-svn at scipy.org Fri Oct 26 08:57:34 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 07:57:34 -0500 (CDT) Subject: [Numpy-svn] r4311 - branches/numpy.scons Message-ID: <20071026125734.DB41A39C1F2@new.scipy.org> Author: cdavid Date: 2007-10-26 07:57:29 -0500 (Fri, 26 Oct 2007) New Revision: 4311 Modified: branches/numpy.scons/site.cfg.example Log: Add mkl example to site.cfg.example Modified: branches/numpy.scons/site.cfg.example =================================================================== --- branches/numpy.scons/site.cfg.example 2007-10-26 12:29:20 UTC (rev 4310) +++ branches/numpy.scons/site.cfg.example 2007-10-26 12:57:29 UTC (rev 4311) @@ -118,3 +118,10 @@ #[djbfft] #include_dirs = /usr/local/djbfft/include #library_dirs = /usr/local/djbfft/lib + +# MKL Library (Intel Math Kernel Library, including blas and lapack) +# ------------------------------------------------------------------ +#[mkl] +#libraries = mkl, guide +#include_dirs = /home/david/opt/intel/mkl/9.1.023/include +#library_dirs = /home/david/opt/intel/mkl/9.1.023/lib/32 From numpy-svn at scipy.org Fri Oct 26 09:19:26 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 08:19:26 -0500 (CDT) Subject: [Numpy-svn] r4312 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071026131926.DB665C7C00D@new.scipy.org> Author: cdavid Date: 2007-10-26 08:19:22 -0500 (Fri, 26 Oct 2007) New Revision: 4312 Modified: branches/numpy.scons/numpy/distutils/scons/TODO Log: Update scons TODO. Modified: branches/numpy.scons/numpy/distutils/scons/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-26 12:57:29 UTC (rev 4311) +++ branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-26 13:19:22 UTC (rev 4312) @@ -1,15 +1,15 @@ Before True milestone: - improve CheckTypeSize for upstream integration - - improve BrokenMathlib and Mathlib in core, and make them available to everyone - - Cblas checker: works for atlas and mkl - - Atlas check - - Mkl check + - improve BrokenMathlib and Mathlib in core, and make them available to + everyone + - show_config implementation : how to do it ? Checker: - improve Fortran runtime detection for upstream integration - improve Fortran mangling and dummy main detection for upstream integration - - Blas/Lapack check + - How to build meta-checkers from simple checkers (for example, BLAS with + MKL, ATLAS, Sunperf, etc...) ? Builder: - Get a PythonExtension builder independant of distutils for upstream @@ -23,8 +23,9 @@ - Default optim, warn and link flags for python extension on at least gcc, g77, gfortran (1st priority), MS and Intel (2d priority), others (3rd: sun, aix, etc...) - - Refactor code for API generation (numpy/core/code_generators) - - Problems of per packages things (config.log, sconsign files, etc....) + - Refactor code for API generation (numpy/core/code_generators) -> Mostly done + - Problems of per packages things (config.log, sconsign files, etc....) -> + Done ! Documentation: - scons / distutils integration From numpy-svn at scipy.org Fri Oct 26 17:26:27 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 16:26:27 -0500 (CDT) Subject: [Numpy-svn] r4313 - trunk/numpy/core/src Message-ID: <20071026212627.7915439C105@new.scipy.org> Author: oliphant Date: 2007-10-26 16:26:22 -0500 (Fri, 26 Oct 2007) New Revision: 4313 Modified: trunk/numpy/core/src/multiarraymodule.c trunk/numpy/core/src/scalartypes.inc.src trunk/numpy/core/src/ucsnarrow.c Log: Fix pickling of numpy.unicode_ objects on narrow builds of Python. Modified: trunk/numpy/core/src/multiarraymodule.c =================================================================== --- trunk/numpy/core/src/multiarraymodule.c 2007-10-26 13:19:22 UTC (rev 4312) +++ trunk/numpy/core/src/multiarraymodule.c 2007-10-26 21:26:22 UTC (rev 4313) @@ -5710,6 +5710,9 @@ return ret; } +/* This function is needed for supporting Pickles of + numpy scalar objects. +*/ static PyObject * array_scalar(PyObject *ignored, PyObject *args, PyObject *kwds) { Modified: trunk/numpy/core/src/scalartypes.inc.src =================================================================== --- trunk/numpy/core/src/scalartypes.inc.src 2007-10-26 13:19:22 UTC (rev 4312) +++ trunk/numpy/core/src/scalartypes.inc.src 2007-10-26 21:26:22 UTC (rev 4313) @@ -1271,9 +1271,41 @@ Py_BuildValue("NO", obj, mod)); } else { +#ifndef Py_UNICODE_WIDE + /* We need to expand the buffer so that we always write + UCS4 to disk for pickle of unicode scalars. + + This could be in a unicode_reduce function, but + that would require re-factoring. + */ + int alloc=0; + char *tmp; + int newlen; + + if (PyArray_IsScalar(self, Unicode)) { + tmp = _pya_malloc(buflen*2); + if (tmp == NULL) { + Py_DECREF(ret); + return Py_NoMemory(); + } + alloc = 1; + newlen = PyUCS2Buffer_AsUCS4((Py_UNICODE *)buffer, + (PyArray_UCS4 *)tmp, + buflen / 2, buflen / 2); + buflen = newlen*4; + buffer = tmp; + } +#endif mod = PyString_FromStringAndSize(buffer, buflen); + if (mod == NULL) { + Py_DECREF(ret); + return Py_NoMemory(); + } PyTuple_SET_ITEM(ret, 1, Py_BuildValue("NN", obj, mod)); +#ifndef Py_UNICODE_WIDE + if (alloc) _pya_free(buffer); +#endif } return ret; } Modified: trunk/numpy/core/src/ucsnarrow.c =================================================================== --- trunk/numpy/core/src/ucsnarrow.c 2007-10-26 13:19:22 UTC (rev 4312) +++ trunk/numpy/core/src/ucsnarrow.c 2007-10-26 21:26:22 UTC (rev 4313) @@ -39,7 +39,7 @@ It converts up to ucs4len characters of UCS2 It returns the number of characters converted which can - be less than ucslen if there are surrogate pairs in ucs2. + be less than ucs2len if there are surrogate pairs in ucs2. The return value is the actual size of the used part of the ucs4 buffer. */ From numpy-svn at scipy.org Fri Oct 26 17:39:11 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 16:39:11 -0500 (CDT) Subject: [Numpy-svn] r4314 - trunk/numpy/core/src Message-ID: <20071026213911.BB4F939C105@new.scipy.org> Author: oliphant Date: 2007-10-26 16:39:08 -0500 (Fri, 26 Oct 2007) New Revision: 4314 Modified: trunk/numpy/core/src/scalartypes.inc.src Log: Finish fixing ticket #600 Modified: trunk/numpy/core/src/scalartypes.inc.src =================================================================== --- trunk/numpy/core/src/scalartypes.inc.src 2007-10-26 21:26:22 UTC (rev 4313) +++ trunk/numpy/core/src/scalartypes.inc.src 2007-10-26 21:39:08 UTC (rev 4314) @@ -1286,7 +1286,7 @@ tmp = _pya_malloc(buflen*2); if (tmp == NULL) { Py_DECREF(ret); - return Py_NoMemory(); + return PyErr_NoMemory(); } alloc = 1; newlen = PyUCS2Buffer_AsUCS4((Py_UNICODE *)buffer, @@ -1299,12 +1299,14 @@ mod = PyString_FromStringAndSize(buffer, buflen); if (mod == NULL) { Py_DECREF(ret); - return Py_NoMemory(); + ret = NULL; + goto fail; } PyTuple_SET_ITEM(ret, 1, Py_BuildValue("NN", obj, mod)); + fail: #ifndef Py_UNICODE_WIDE - if (alloc) _pya_free(buffer); + if (alloc) _pya_free((char *)buffer); #endif } return ret; From numpy-svn at scipy.org Fri Oct 26 17:44:49 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 16:44:49 -0500 (CDT) Subject: [Numpy-svn] r4315 - trunk/numpy/core/tests Message-ID: <20071026214449.6E62939C014@new.scipy.org> Author: oliphant Date: 2007-10-26 16:44:47 -0500 (Fri, 26 Oct 2007) New Revision: 4315 Modified: trunk/numpy/core/tests/test_regression.py Log: Add test for #600 fix. Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2007-10-26 21:39:08 UTC (rev 4314) +++ trunk/numpy/core/tests/test_regression.py 2007-10-26 21:44:47 UTC (rev 4315) @@ -740,5 +740,13 @@ x |= y self.failUnlessRaises(TypeError,rs) + def check_unicode_scalar(self, level=rlevel): + """Ticket #600""" + import cPickle + x = N.array(["DROND", "DROND1"], dtype="U6") + el = x[1] + new = cPickle.loads(cPickle.dumps(el)) + assert_equal(new, el) + if __name__ == "__main__": NumpyTest().run() From numpy-svn at scipy.org Fri Oct 26 18:19:31 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 17:19:31 -0500 (CDT) Subject: [Numpy-svn] r4316 - trunk/numpy/core/src Message-ID: <20071026221931.7108439C014@new.scipy.org> Author: oliphant Date: 2007-10-26 17:19:25 -0500 (Fri, 26 Oct 2007) New Revision: 4316 Modified: trunk/numpy/core/src/scalartypes.inc.src Log: Fix label problem on wide builds. Modified: trunk/numpy/core/src/scalartypes.inc.src =================================================================== --- trunk/numpy/core/src/scalartypes.inc.src 2007-10-26 21:44:47 UTC (rev 4315) +++ trunk/numpy/core/src/scalartypes.inc.src 2007-10-26 22:19:25 UTC (rev 4316) @@ -1299,13 +1299,17 @@ mod = PyString_FromStringAndSize(buffer, buflen); if (mod == NULL) { Py_DECREF(ret); +#ifndef Py_UNICODE_WIDE ret = NULL; goto fail; +#else + return NULL; +#endif } PyTuple_SET_ITEM(ret, 1, Py_BuildValue("NN", obj, mod)); +#ifndef Py_UNICODE_WIDE fail: -#ifndef Py_UNICODE_WIDE if (alloc) _pya_free((char *)buffer); #endif } From numpy-svn at scipy.org Fri Oct 26 18:33:18 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 26 Oct 2007 17:33:18 -0500 (CDT) Subject: [Numpy-svn] r4317 - trunk/numpy/core Message-ID: <20071026223318.477F539C0C1@new.scipy.org> Author: oliphant Date: 2007-10-26 17:33:14 -0500 (Fri, 26 Oct 2007) New Revision: 4317 Modified: trunk/numpy/core/fromnumeric.py Log: Fix ticket #599 Modified: trunk/numpy/core/fromnumeric.py =================================================================== --- trunk/numpy/core/fromnumeric.py 2007-10-26 22:19:25 UTC (rev 4316) +++ trunk/numpy/core/fromnumeric.py 2007-10-26 22:33:14 UTC (rev 4317) @@ -35,7 +35,7 @@ except AttributeError: wrap = None result = getattr(asarray(obj),method)(*args, **kwds) - if wrap and isinstance(result, mu.ndarray): + if wrap: if not isinstance(result, mu.ndarray): result = asarray(result) result = wrap(result) From numpy-svn at scipy.org Sun Oct 28 11:49:36 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 28 Oct 2007 10:49:36 -0500 (CDT) Subject: [Numpy-svn] r4318 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071028154936.7180639C062@new.scipy.org> Author: cdavid Date: 2007-10-28 10:48:59 -0500 (Sun, 28 Oct 2007) New Revision: 4318 Modified: branches/numpy.scons/numpy/distutils/scons/TODO branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: Start hacking on Netlib BLAS/LAPACK checker Modified: branches/numpy.scons/numpy/distutils/scons/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-26 22:33:14 UTC (rev 4317) +++ branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-28 15:48:59 UTC (rev 4318) @@ -1,15 +1,16 @@ Before True milestone: - - improve CheckTypeSize for upstream integration - improve BrokenMathlib and Mathlib in core, and make them available to everyone - show_config implementation : how to do it ? + - How to build meta-checkers from simple checkers (for example, BLAS with + MKL, ATLAS, Sunperf, etc...) ? Checker: - improve Fortran runtime detection for upstream integration - improve Fortran mangling and dummy main detection for upstream integration - - How to build meta-checkers from simple checkers (for example, BLAS with - MKL, ATLAS, Sunperf, etc...) ? + - Netlib BLAS and LAPACK checkers with site.cfg overriding + - Generic BLAS and LAPACK checker with site.cfg overriding Builder: - Get a PythonExtension builder independant of distutils for upstream @@ -24,8 +25,6 @@ g77, gfortran (1st priority), MS and Intel (2d priority), others (3rd: sun, aix, etc...) - Refactor code for API generation (numpy/core/code_generators) -> Mostly done - - Problems of per packages things (config.log, sconsign files, etc....) -> - Done ! Documentation: - scons / distutils integration Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-26 22:33:14 UTC (rev 4317) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-28 15:48:59 UTC (rev 4318) @@ -2,7 +2,8 @@ from libinfo_scons import NumpyCheckLib from libinfo import get_paths as scons_get_paths from custom_checkers import CheckMKL, CheckATLAS, CheckCBLAS, \ - CheckAccelerate, CheckMKL, CheckSunperf, CheckLAPACK + CheckAccelerate, CheckMKL, CheckSunperf, CheckLAPACK, \ + CheckNetlibBLAS, CheckNetlibLAPACK from extension import get_python_inc, get_pythonlib_dir from utils import isstring from fortran_scons import CheckF77Verbose, CheckF77Clib, CheckF77Mangling Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-26 22:33:14 UTC (rev 4317) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-28 15:48:59 UTC (rev 4318) @@ -249,3 +249,21 @@ return st return 0 + +def CheckNetlibBLAS(context): + # XXX: support site.cfg + # Get fortran mangling + if not CheckF77Mangling(context): + return 0 + + env = context.env + test_func_name = env['F77_NAME_MANGLER']('dgemm') + +def CheckNetlibLAPACK(context): + # XXX: support site.cfg + # Get fortran mangling + if not CheckF77Mangling(context): + return 0 + + env = context.env + test_func_name = env['F77_NAME_MANGLER']('dpotri') From numpy-svn at scipy.org Sun Oct 28 21:07:55 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 28 Oct 2007 20:07:55 -0500 (CDT) Subject: [Numpy-svn] r4319 - trunk/numpy/core/src Message-ID: <20071029010755.F1AE739C013@new.scipy.org> Author: oliphant Date: 2007-10-28 20:07:46 -0500 (Sun, 28 Oct 2007) New Revision: 4319 Modified: trunk/numpy/core/src/ufuncobject.c Log: Fix memory leak in seterr exposed during str(a). Fixes #602 Modified: trunk/numpy/core/src/ufuncobject.c =================================================================== --- trunk/numpy/core/src/ufuncobject.c 2007-10-28 15:48:59 UTC (rev 4318) +++ trunk/numpy/core/src/ufuncobject.c 2007-10-29 01:07:46 UTC (rev 4319) @@ -3197,7 +3197,7 @@ static int ufunc_update_use_defaults(void) { - PyObject *errobj; + PyObject *errobj=NULL; int errmask, bufsize; int res; @@ -3206,7 +3206,7 @@ &errobj); PyUFunc_NUM_NODEFAULTS -= 1; - if (res < 0) return -1; + if (res < 0) {Py_XDECREF(errobj); return -1;} if ((errmask != UFUNC_ERR_DEFAULT) || \ (bufsize != PyArray_BUFSIZE) || \ @@ -3216,6 +3216,7 @@ else if (PyUFunc_NUM_NODEFAULTS > 0) { PyUFunc_NUM_NODEFAULTS -= 1; } + Py_XDECREF(errobj); return 0; } #endif From numpy-svn at scipy.org Mon Oct 29 00:21:16 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 28 Oct 2007 23:21:16 -0500 (CDT) Subject: [Numpy-svn] r4320 - in branches/numpy.scons/numpy: core distutils/scons Message-ID: <20071029042116.DF63339C01A@new.scipy.org> Author: cdavid Date: 2007-10-28 23:21:06 -0500 (Sun, 28 Oct 2007) New Revision: 4320 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/libinfo.py branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py Log: Generic BLAS and LAPACK checkers. Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-29 01:07:46 UTC (rev 4319) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-29 04:21:06 UTC (rev 4320) @@ -1,4 +1,4 @@ -# Last Change: Fri Oct 26 02:00 PM 2007 J +# Last Change: Mon Oct 29 01:00 PM 2007 J # vim:syntax=python import os import sys @@ -8,7 +8,7 @@ from numpy.distutils.scons import get_python_inc, get_pythonlib_dir from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons import NumpyCheckLib -from numpy.distutils.scons.custom_checkers import CheckCBLAS, CheckMKL, CheckATLAS +from numpy.distutils.scons.custom_checkers import CheckCBLAS, CheckMKL, CheckATLAS, CheckGenericBLAS, CheckGenericLAPACK from scons_support import CheckBrokenMathlib, define_no_smp, \ generate_config_header, generate_config_header_emitter, \ @@ -29,6 +29,8 @@ config = env.NumpyConfigure(custom_tests = {'CheckBrokenMathlib' : CheckBrokenMathlib, 'CheckMathlib' : CheckMathlib, 'CheckCBLAS' : CheckCBLAS, + 'CheckGenericBLAS' : CheckGenericBLAS, + 'CheckGenericLAPACK' : CheckGenericLAPACK, 'NumpyCheckLib' : NumpyCheckLib}) # Convention: list of tuples (definition, value). value: @@ -139,6 +141,9 @@ #-------------- # Checking Blas #-------------- +config.CheckGenericBLAS() +config.CheckGenericLAPACK() + # TODO if config.CheckCBLAS(): build_blasdot = 1 Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-29 01:07:46 UTC (rev 4319) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-29 04:21:06 UTC (rev 4320) @@ -3,7 +3,7 @@ from libinfo import get_paths as scons_get_paths from custom_checkers import CheckMKL, CheckATLAS, CheckCBLAS, \ CheckAccelerate, CheckMKL, CheckSunperf, CheckLAPACK, \ - CheckNetlibBLAS, CheckNetlibLAPACK + CheckGenericBLAS, CheckGenericLAPACK from extension import get_python_inc, get_pythonlib_dir from utils import isstring from fortran_scons import CheckF77Verbose, CheckF77Clib, CheckF77Mangling Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 01:07:46 UTC (rev 4319) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 04:21:06 UTC (rev 4320) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Fri Oct 26 09:00 PM 2007 J +# Last Change: Mon Oct 29 01:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -7,7 +7,7 @@ from copy import deepcopy from distutils.util import get_platform -from libinfo import get_config, get_config_from_section +from libinfo import get_config, get_config_from_section, get_func_link_src from libinfo_scons import NumpyCheckLib from testcode_snippets import cblas_sgemm as cblas_src, \ c_sgemm as sunperf_src, lapack_sgesv @@ -210,6 +210,7 @@ return 0 else: # Get fortran stuff + # XXX: do not check if env variables are already here if not CheckF77Mangling(context): return 0 if not CheckF77Clib(context): @@ -250,20 +251,60 @@ return 0 -def CheckNetlibBLAS(context): +def _my_try_link(context, src, libs, libpath, autoadd = 0): + """Try to link the given text in src with libs and libpath.""" + env = context.env + + oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] + oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] + + ret = 0 + try: + env.AppendUnique(LIBS = libs, LIBPATH = libpath) + ret = context.TryLink(src, '.c') + finally: + if not ret or not autoadd: + env.Replace(LIBS = oldLIBS, LIBPATH = oldLIBPATH) + + return ret + +def CheckGenericBLAS(context): # XXX: support site.cfg + libs = ['blas'] + libpath = [] + + env = context.env # Get fortran mangling - if not CheckF77Mangling(context): - return 0 + if not env.has_key('F77_NAME_MANGLER'): + if not CheckF77Mangling(context): + return 0 - env = context.env test_func_name = env['F77_NAME_MANGLER']('dgemm') -def CheckNetlibLAPACK(context): + src = get_func_link_src(test_func_name) + context.Message("Checking for Generic BLAS... ") + st = _my_try_link(context, src, libs, libpath, 0) + context.Result(st) + + return st + +def CheckGenericLAPACK(context): # XXX: support site.cfg + libs = ['lapack'] + libpath = [] + + env = context.env # Get fortran mangling - if not CheckF77Mangling(context): - return 0 + if not env.has_key('F77_NAME_MANGLER'): + if not CheckF77Mangling(context): + return 0 - env = context.env test_func_name = env['F77_NAME_MANGLER']('dpotri') + + src = get_func_link_src(test_func_name) + context.Message("Checking for Generic LAPACK... ") + st = _my_try_link(context, src, libs, libpath, 0) + context.Result(st) + + return st + Modified: branches/numpy.scons/numpy/distutils/scons/libinfo.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-10-29 01:07:46 UTC (rev 4319) +++ branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-10-29 04:21:06 UTC (rev 4320) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Fri Oct 26 11:00 AM 2007 J +# Last Change: Mon Oct 29 12:00 PM 2007 J # Module for support to look for external code (replacement of # numpy.distutils.system_info). KEEP THIS INDEPENDANT OF SCONS ! @@ -86,5 +86,31 @@ else: return ([], [], []), 0 +def get_func_link_src(func, includes = None): + """Given a function, return the source code to compile and link to + test for this symbol. + + includes is a list of (optional) headers""" + src = [] + if includes: + src.extend([r'#include <%s>\n' for h in includes]) + + src.append(r""" +#undef %(func)s + +#ifdef __cplusplus +extern "C" +#endif +char %(func)s (); + +int +main () +{ + return %(func)s(); +} +""" % {'func' : func}) + + return '\n'.join(src) + if __name__ == '__main__': pass Modified: branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-10-29 01:07:46 UTC (rev 4319) +++ branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-10-29 04:21:06 UTC (rev 4320) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Fri Oct 26 08:00 PM 2007 J +# Last Change: Mon Oct 29 12:00 PM 2007 J # This module should contains useful test code (as strings). They are mainly # useful for checkers who need to run the tests (to check the mere presence of From numpy-svn at scipy.org Mon Oct 29 03:14:47 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 02:14:47 -0500 (CDT) Subject: [Numpy-svn] r4321 - in branches/numpy.scons/numpy: core distutils/scons linalg Message-ID: <20071029071447.BF94B39C02E@new.scipy.org> Author: cdavid Date: 2007-10-29 02:14:38 -0500 (Mon, 29 Oct 2007) New Revision: 4321 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/fortran_scons.py branches/numpy.scons/numpy/distutils/scons/libinfo.py branches/numpy.scons/numpy/linalg/SConstruct Log: Handle site.cfg in generic BLAS and LAPACK checkers Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-29 04:21:06 UTC (rev 4320) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-29 07:14:38 UTC (rev 4321) @@ -1,4 +1,4 @@ -# Last Change: Mon Oct 29 01:00 PM 2007 J +# Last Change: Mon Oct 29 03:00 PM 2007 J # vim:syntax=python import os import sys @@ -141,21 +141,12 @@ #-------------- # Checking Blas #-------------- -config.CheckGenericBLAS() -config.CheckGenericLAPACK() - -# TODO if config.CheckCBLAS(): build_blasdot = 1 else: build_blasdot = 0 config.Finish() -#config_f = open('config.log', 'r') -#print "++++++++++ config.log dump ++++++++++++++++++" -#for i in config_f: -# print i.strip('\n') -#print "+++++++++++++++++++++++++++++++++++++++++++++" #========== # Build Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 04:21:06 UTC (rev 4320) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 07:14:38 UTC (rev 4321) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Oct 29 01:00 PM 2007 J +# Last Change: Mon Oct 29 03:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -209,21 +209,22 @@ warning.warn('FIXME: LAPACK checks not implemented yet on win32') return 0 else: + env = context.env + # Get fortran stuff - # XXX: do not check if env variables are already here - if not CheckF77Mangling(context): - return 0 - if not CheckF77Clib(context): - return 0 + if not env.has_key('F77_NAME_MANGLER'): + if not CheckF77Mangling(context): + return 0 + if not env.has_key('F77_LDFLAGS'): + if not CheckF77Clib(context): + return 0 - env = context.env - # Get the mangled name of our test function sgesv_string = env['F77_NAME_MANGLER']('sgesv') test_src = lapack_sgesv % sgesv_string # Check MKL - st = CheckMKL(context, autoadd) + st = CheckMKL(context, autoadd = 1) if st: fdict = env.ParseFlags(context.env['F77_LDFLAGS']) fdict['LIBS'].append('lapack') @@ -236,7 +237,7 @@ return st # Check ATLAS - st = CheckATLAS(context, autoadd) + st = CheckATLAS(context, autoadd = 1) if st: fdict = env.ParseFlags(context.env['F77_LDFLAGS']) fdict['LIBS'].append('lapack') @@ -268,11 +269,15 @@ return ret -def CheckGenericBLAS(context): - # XXX: support site.cfg - libs = ['blas'] - libpath = [] +def CheckGenericBLAS(context, autoadd = 1, section = 'blas'): + """Check whether a BLAS library can be found. + Use site.cfg if found.""" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if not found: + libs.extend(['blas']) + env = context.env # Get fortran mangling if not env.has_key('F77_NAME_MANGLER'): @@ -280,19 +285,28 @@ return 0 test_func_name = env['F77_NAME_MANGLER']('dgemm') + src = get_func_link_src(test_func_name) - src = get_func_link_src(test_func_name) context.Message("Checking for Generic BLAS... ") - st = _my_try_link(context, src, libs, libpath, 0) + + st = _my_try_link(context, src, libs, libpath, autoadd) + if st: + env['F77_BLAS_LIBS'] = libs + env['F77_BLAS_LIBPATH'] = libpath + context.Result(st) return st -def CheckGenericLAPACK(context): - # XXX: support site.cfg - libs = ['lapack'] - libpath = [] +def CheckGenericLAPACK(context, autoadd = 1, section = 'lapack'): + """Check whether a LAPACK library can be found. + Use site.cfg if found.""" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if not found: + libs.extend(['lapack']) + env = context.env # Get fortran mangling if not env.has_key('F77_NAME_MANGLER'): @@ -300,11 +314,15 @@ return 0 test_func_name = env['F77_NAME_MANGLER']('dpotri') + src = get_func_link_src(test_func_name) - src = get_func_link_src(test_func_name) context.Message("Checking for Generic LAPACK... ") - st = _my_try_link(context, src, libs, libpath, 0) + + st = _my_try_link(context, src, libs, libpath, autoadd) + if st: + env['F77_LAPACK_LIBS'] = libs + env['F77_LAPACK_LIBPATH'] = libpath + context.Result(st) return st - Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-10-29 04:21:06 UTC (rev 4320) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-10-29 07:14:38 UTC (rev 4321) @@ -1,4 +1,4 @@ -# Last Change: Fri Oct 26 06:00 PM 2007 J +# Last Change: Mon Oct 29 03:00 PM 2007 J import os import sys import string Modified: branches/numpy.scons/numpy/distutils/scons/libinfo.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-10-29 04:21:06 UTC (rev 4320) +++ branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-10-29 07:14:38 UTC (rev 4321) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Oct 29 12:00 PM 2007 J +# Last Change: Mon Oct 29 03:00 PM 2007 J # Module for support to look for external code (replacement of # numpy.distutils.system_info). KEEP THIS INDEPENDANT OF SCONS ! @@ -9,6 +9,7 @@ from numpy.distutils.system_info import default_lib_dirs, \ default_include_dirs, default_src_dirs, get_standard_file +# Think about a cache mechanism, to avoid reparsing the config file everytime. def get_config(): """ This tries to read .cfg files in several locations, and merge its information into a ConfigParser object for the first found file. Modified: branches/numpy.scons/numpy/linalg/SConstruct =================================================================== --- branches/numpy.scons/numpy/linalg/SConstruct 2007-10-29 04:21:06 UTC (rev 4320) +++ branches/numpy.scons/numpy/linalg/SConstruct 2007-10-29 07:14:38 UTC (rev 4321) @@ -1,4 +1,4 @@ -# Last Change: Fri Oct 26 09:00 PM 2007 J +# Last Change: Mon Oct 29 03:00 PM 2007 J # vim:syntax=python from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths @@ -10,6 +10,8 @@ config = env.NumpyConfigure(custom_tests = {'CheckLAPACK' : CheckLAPACK}) +use_lapack = config.CheckLAPACK() + # XXX: this is ugly, better find the mathlibs with a checker for i in scons_get_paths(env['include_bootstrap']): try: @@ -19,7 +21,6 @@ pass env.AppendUnique(LIBS = mlib) -use_lapack = config.CheckLAPACK() config.Finish() sources = ['lapack_litemodule.c'] From numpy-svn at scipy.org Mon Oct 29 04:31:19 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 03:31:19 -0500 (CDT) Subject: [Numpy-svn] r4322 - trunk/numpy/doc Message-ID: <20071029083119.DA6FB39C0B7@new.scipy.org> Author: jarrod.millman Date: 2007-10-29 03:31:02 -0500 (Mon, 29 Oct 2007) New Revision: 4322 Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt Log: added reference to another style guide checking script Modified: trunk/numpy/doc/HOWTO_DOCUMENT.txt =================================================================== --- trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-29 07:14:38 UTC (rev 4321) +++ trunk/numpy/doc/HOWTO_DOCUMENT.txt 2007-10-29 08:31:02 UTC (rev 4322) @@ -17,6 +17,7 @@ Use a code checker: * `pylint `__ + * `pep8.py `__ Docstring Standard ------------------ From numpy-svn at scipy.org Mon Oct 29 04:33:12 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 03:33:12 -0500 (CDT) Subject: [Numpy-svn] r4323 - trunk/numpy/oldnumeric Message-ID: <20071029083312.4EA7E39C0B7@new.scipy.org> Author: jarrod.millman Date: 2007-10-29 03:33:07 -0500 (Mon, 29 Oct 2007) New Revision: 4323 Modified: trunk/numpy/oldnumeric/random_array.py Log: fixed typo Modified: trunk/numpy/oldnumeric/random_array.py =================================================================== --- trunk/numpy/oldnumeric/random_array.py 2007-10-29 08:31:02 UTC (rev 4322) +++ trunk/numpy/oldnumeric/random_array.py 2007-10-29 08:33:07 UTC (rev 4323) @@ -117,7 +117,7 @@ def F(dfn, dfd, shape=[]): """F(dfn, dfd) or F(dfn, dfd, [n, m, ...]) returns array of F distributed random numbers with dfn degrees of freedom in the numerator and dfd degrees of freedom in the denominator.""" if shape == []: - shape == None + shape = None return mt.f(dfn, dfd, shape) def noncentral_F(dfn, dfd, nconc, shape=[]): From numpy-svn at scipy.org Mon Oct 29 05:10:16 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 04:10:16 -0500 (CDT) Subject: [Numpy-svn] r4324 - in trunk/numpy: distutils f2py linalg/lapack_lite Message-ID: <20071029091016.C17C639C0B6@new.scipy.org> Author: jarrod.millman Date: 2007-10-29 04:09:59 -0500 (Mon, 29 Oct 2007) New Revision: 4324 Modified: trunk/numpy/distutils/ccompiler.py trunk/numpy/distutils/core.py trunk/numpy/f2py/crackfortran.py trunk/numpy/f2py/f2py2e.py trunk/numpy/linalg/lapack_lite/make_lite.py Log: Using the in operator to find substrings. It is shorter and easier to understand. Modified: trunk/numpy/distutils/ccompiler.py =================================================================== --- trunk/numpy/distutils/ccompiler.py 2007-10-29 08:33:07 UTC (rev 4323) +++ trunk/numpy/distutils/ccompiler.py 2007-10-29 09:09:59 UTC (rev 4324) @@ -207,7 +207,7 @@ except (AttributeError, ValueError): pass - if hasattr(self,'compiler') and self.compiler[0].find('cc')>=0: + if hasattr(self,'compiler') and 'cc' in self.compiler[0]: if not self.compiler_cxx: if self.compiler[0].startswith('gcc'): a, b = 'gcc', 'g++' Modified: trunk/numpy/distutils/core.py =================================================================== --- trunk/numpy/distutils/core.py 2007-10-29 08:33:07 UTC (rev 4323) +++ trunk/numpy/distutils/core.py 2007-10-29 09:09:59 UTC (rev 4324) @@ -92,7 +92,7 @@ # We can't use isinstance, as the DistributionWithoutHelpCommands # class is local to a function in setuptools.command.easy_install if dist is not None and \ - repr(dist).find('DistributionWithoutHelpCommands') != -1: + 'DistributionWithoutHelpCommands' in repr(dist): dist = None if always and dist is None: dist = distutils.dist.Distribution() Modified: trunk/numpy/f2py/crackfortran.py =================================================================== --- trunk/numpy/f2py/crackfortran.py 2007-10-29 08:33:07 UTC (rev 4323) +++ trunk/numpy/f2py/crackfortran.py 2007-10-29 09:09:59 UTC (rev 4324) @@ -1494,7 +1494,7 @@ for g in block: setmesstext(g) g=postcrack(g,tab=tab+'\t') - if g.has_key('name') and string.find(g['name'],'__user__')>=0: # sort user routines to appear first + if g.has_key('name') and '__user__' in g['name']: # sort user routines to appear first uret.append(g) else: gret.append(g) @@ -1518,7 +1518,7 @@ if block.has_key('use'): useblock=block['use'] for k in useblock.keys(): - if string.find(k,'__user__')>=0: + if '__user__' in k: userisdefined.append(k) ## if useblock[k].has_key('map'): ## for n in useblock[k]['map'].values(): Modified: trunk/numpy/f2py/f2py2e.py =================================================================== --- trunk/numpy/f2py/f2py2e.py 2007-10-29 08:33:07 UTC (rev 4323) +++ trunk/numpy/f2py/f2py2e.py 2007-10-29 09:09:59 UTC (rev 4324) @@ -289,7 +289,7 @@ outmess('Building modules...\n') modules,mnames,isusedby=[],[],{} for i in range(len(list)): - if string.find(list[i]['name'],'__user__')>=0: + if '__user__' in list[i]['name']: cb_rules.buildcallbacks(list[i]) else: if list[i].has_key('use'): Modified: trunk/numpy/linalg/lapack_lite/make_lite.py =================================================================== --- trunk/numpy/linalg/lapack_lite/make_lite.py 2007-10-29 08:33:07 UTC (rev 4323) +++ trunk/numpy/linalg/lapack_lite/make_lite.py 2007-10-29 09:09:59 UTC (rev 4324) @@ -141,7 +141,7 @@ class LapackLibrary(FortranLibrary): def _newFortranRoutine(self, rname, filename): routine = FortranLibrary._newFortranRoutine(self, rname, filename) - if filename.find('BLAS') != -1: + if 'BLAS' in filename routine.type = 'blas' elif rname.startswith('z'): routine.type = 'zlapack' From numpy-svn at scipy.org Mon Oct 29 05:57:57 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 04:57:57 -0500 (CDT) Subject: [Numpy-svn] r4325 - in branches/numpy.scons/numpy: core distutils/scons linalg Message-ID: <20071029095757.26B7139C0EE@new.scipy.org> Author: cdavid Date: 2007-10-29 04:57:43 -0500 (Mon, 29 Oct 2007) New Revision: 4325 Added: branches/numpy.scons/numpy/distutils/scons/configuration.py Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py branches/numpy.scons/numpy/linalg/SConstruct Log: Start working on a system to keep config info for packages Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-29 09:09:59 UTC (rev 4324) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-29 09:57:43 UTC (rev 4325) @@ -1,4 +1,4 @@ -# Last Change: Mon Oct 29 03:00 PM 2007 J +# Last Change: Mon Oct 29 06:00 PM 2007 J # vim:syntax=python import os import sys @@ -9,6 +9,7 @@ from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons import NumpyCheckLib from numpy.distutils.scons.custom_checkers import CheckCBLAS, CheckMKL, CheckATLAS, CheckGenericBLAS, CheckGenericLAPACK +from numpy.distutils.scons.configuration import write_info from scons_support import CheckBrokenMathlib, define_no_smp, \ generate_config_header, generate_config_header_emitter, \ Added: branches/numpy.scons/numpy/distutils/scons/configuration.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-10-29 09:09:59 UTC (rev 4324) +++ branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-10-29 09:57:43 UTC (rev 4325) @@ -0,0 +1,34 @@ +#! /usr/bin/env python +# Last Change: Mon Oct 29 06:00 PM 2007 J + +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 + +def write_info(env): + print "File is %s" % env['NUMPY_PKG_CONFIG_FILE'] + print "Info is %s" % env['NUMPY_PKG_CONFIG'] Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 09:09:59 UTC (rev 4324) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 09:57:43 UTC (rev 4325) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Oct 29 03:00 PM 2007 J +# Last Change: Mon Oct 29 06:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -14,6 +14,8 @@ from fortran_scons import CheckF77Mangling, CheckF77Clib +from configuration import opt_info, add_info + def _check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath, linkflags, cflags, autoadd = 1): """This is a basic implementation for generic "test include and run" @@ -171,6 +173,7 @@ [], linkflags, cflags, autoadd) def CheckCBLAS(context, autoadd = 1): + env = context.env # If section cblas is in site.cfg, use those options. Otherwise, use default section = "cblas" @@ -180,27 +183,43 @@ headers = ['cblas.h'] linkflags = [] cflags = [] - return _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, + st = _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, libs, libpath, linkflags, cflags, autoadd) + if st: + add_info(env, 'cblas', opt_info('cblas', site = 1)) + return st else: if sys.platform == 'darwin': st = CheckAccelerate(context, autoadd) if st: + add_info(env, 'cblas', opt_info('Accelerate')) return st st = CheckVeclib(context, autoadd) - return st + if st: + add_info(env, 'cblas', opt_info('vecLib')) + return st + + add_info(env, 'cblas', opt_info('')) + return 0 else: # Check MKL, then ATLAS, then Sunperf st = CheckMKL(context, autoadd) if st: + add_info(env, 'cblas', opt_info('mkl')) return st st = CheckATLAS(context, autoadd) if st: + add_info(env, 'cblas', opt_info('atlas')) return st st = CheckSunperf(context, autoadd) - return st + if st: + add_info(env, 'cblas', opt_info('sunperf')) + return st + add_info(env, 'cblas', opt_info('')) + return 0 + def CheckLAPACK(context, autoadd = 1): # XXX: this whole thing is ugly. Think more about how to combine checkers # in 'meta checker' like this. @@ -234,6 +253,7 @@ fdict['LIBPATH'].extend(context.env['LIBPATH']) st =_check_include_and_run(context, 'LAPACK (MKL)', [], [], test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) + add_info(env, 'lapack', opt_info('mkl')) return st # Check ATLAS @@ -247,6 +267,7 @@ fdict['LIBPATH'].extend(context.env['LIBPATH']) st =_check_include_and_run(context, 'LAPACK (ATLAS)', [], [], test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) + add_info(env, 'lapack', opt_info('atlas')) # XXX: Check complete LAPACK or not return st Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-29 09:09:59 UTC (rev 4324) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-10-29 09:57:43 UTC (rev 4325) @@ -200,7 +200,6 @@ if env['CC'] == 'gcc': env.Append(CCFLAGS = "-Wall -Wstrict-prototypes -fno-strict-aliasing -O3 -g") - #print Environment().Dump() # Adding custom builder env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary env['BUILDERS']['NumpyCtypes'] = NumpyCtypes @@ -218,6 +217,10 @@ # Getting the config options from *.cfg files config = get_config() - env['NUMPYCONFIG'] = config + env['NUMPY_SITE_CONFIG'] = config + # 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') + return env Modified: branches/numpy.scons/numpy/linalg/SConstruct =================================================================== --- branches/numpy.scons/numpy/linalg/SConstruct 2007-10-29 09:09:59 UTC (rev 4324) +++ branches/numpy.scons/numpy/linalg/SConstruct 2007-10-29 09:57:43 UTC (rev 4325) @@ -1,4 +1,4 @@ -# Last Change: Mon Oct 29 03:00 PM 2007 J +# Last Change: Mon Oct 29 06:00 PM 2007 J # vim:syntax=python from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths From numpy-svn at scipy.org Mon Oct 29 06:02:55 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 05:02:55 -0500 (CDT) Subject: [Numpy-svn] r4326 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071029100255.33BD639C053@new.scipy.org> Author: cdavid Date: 2007-10-29 05:02:27 -0500 (Mon, 29 Oct 2007) New Revision: 4326 Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Log: Trivial docstring fix. Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 09:57:43 UTC (rev 4325) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 10:02:27 UTC (rev 4326) @@ -293,7 +293,7 @@ def CheckGenericBLAS(context, autoadd = 1, section = 'blas'): """Check whether a BLAS library can be found. - Use site.cfg if found.""" + Use site.cfg if found (section given by section argument).""" siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) if not found: @@ -322,7 +322,7 @@ def CheckGenericLAPACK(context, autoadd = 1, section = 'lapack'): """Check whether a LAPACK library can be found. - Use site.cfg if found.""" + Use site.cfg if found (section given by section argument).""" siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) if not found: From numpy-svn at scipy.org Mon Oct 29 06:44:12 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 05:44:12 -0500 (CDT) Subject: [Numpy-svn] r4327 - in branches/numpy.scons/numpy: core distutils/scons distutils/scons/checkers Message-ID: <20071029104412.093E839C075@new.scipy.org> Author: cdavid Date: 2007-10-29 05:43:52 -0500 (Mon, 29 Oct 2007) New Revision: 4327 Added: branches/numpy.scons/numpy/distutils/scons/checkers/ branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py Removed: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons/TODO branches/numpy.scons/numpy/distutils/scons/__init__.py Log: Put custom checkers in separate module Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-29 10:02:27 UTC (rev 4326) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-29 10:43:52 UTC (rev 4327) @@ -1,4 +1,4 @@ -# Last Change: Mon Oct 29 06:00 PM 2007 J +# Last Change: Mon Oct 29 07:00 PM 2007 J # vim:syntax=python import os import sys @@ -8,7 +8,7 @@ from numpy.distutils.scons import get_python_inc, get_pythonlib_dir from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons import NumpyCheckLib -from numpy.distutils.scons.custom_checkers import CheckCBLAS, CheckMKL, CheckATLAS, CheckGenericBLAS, CheckGenericLAPACK +from numpy.distutils.scons import CheckCBLAS, CheckMKL, CheckATLAS, CheckGenericBLAS, CheckGenericLAPACK from numpy.distutils.scons.configuration import write_info from scons_support import CheckBrokenMathlib, define_no_smp, \ Modified: branches/numpy.scons/numpy/distutils/scons/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-29 10:02:27 UTC (rev 4326) +++ branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-29 10:43:52 UTC (rev 4327) @@ -9,8 +9,6 @@ - improve Fortran runtime detection for upstream integration - improve Fortran mangling and dummy main detection for upstream integration - - Netlib BLAS and LAPACK checkers with site.cfg overriding - - Generic BLAS and LAPACK checker with site.cfg overriding Builder: - Get a PythonExtension builder independant of distutils for upstream Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-29 10:02:27 UTC (rev 4326) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-29 10:43:52 UTC (rev 4327) @@ -1,7 +1,7 @@ from numpyenv import GetNumpyEnvironment, GetNumpyOptions from libinfo_scons import NumpyCheckLib from libinfo import get_paths as scons_get_paths -from custom_checkers import CheckMKL, CheckATLAS, CheckCBLAS, \ +from checkers.custom_checkers import CheckMKL, CheckATLAS, CheckCBLAS, \ CheckAccelerate, CheckMKL, CheckSunperf, CheckLAPACK, \ CheckGenericBLAS, CheckGenericLAPACK from extension import get_python_inc, get_pythonlib_dir Added: branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py =================================================================== Copied: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py (from rev 4326, branches/numpy.scons/numpy/distutils/scons/custom_checkers.py) =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 10:02:27 UTC (rev 4326) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-10-29 10:43:52 UTC (rev 4327) @@ -0,0 +1,348 @@ +#! /usr/bin/env python +# Last Change: Mon Oct 29 07:00 PM 2007 J + +# Module for custom, common checkers for numpy (and scipy) +import sys +import os.path +from copy import deepcopy +from distutils.util import get_platform + +from numpy.distutils.scons.libinfo import get_config_from_section, get_config +from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \ + c_sgemm as sunperf_src, lapack_sgesv + +from numpy.distutils.scons.fortran_scons import CheckF77Mangling, CheckF77Clib + +from numpy.distutils.scons.configuration import opt_info, add_info + +def _check_include_and_run(context, name, cpppath, headers, run_src, libs, + libpath, linkflags, cflags, autoadd = 1): + """This is a basic implementation for generic "test include and run" + testers. + + For example, for library foo, which implements function do_foo, and with + include header foo.h, this will: + - test that foo.h is found and compilable by the compiler + - test that the given source code can be compiled. The source code + should contain a simple program with the function. + + Arguments: + - name: name of the library + - cpppath: list of directories + - headers: list of headers + - run_src: the code for the run test + - libs: list of libraries to link + - libpath: list of library path. + - linkflags: list of link flags to add.""" + context.Message('Checking for %s ... ' % name) + env = context.env + + #---------------------------- + # Check headers are available + #---------------------------- + oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] + oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] + env.AppendUnique(CPPPATH = cpppath) + env.AppendUnique(CFLAGS = cflags) + # XXX: handle context + hcode = ['#include <%s>' % h for h in headers] + # HACK: we add cpppath in the command of the source, to add dependency of + # the check on the cpppath. + hcode.extend(['#if 0', '%s' % cpppath, '#endif\n']) + src = '\n'.join(hcode) + + ret = context.TryCompile(src, '.c') + if not ret: + env.Replace(CPPPATH = oldCPPPATH) + env.Replace(CFLAGS = oldCFLAGS) + context.Result('Failed: %s include not found' % name) + return 0 + + #------------------------------ + # Check a simple example works + #------------------------------ + oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] + oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] + # XXX: RPATH, drawbacks using it ? + oldRPATH = (env.has_key('RPATH') and deepcopy(env['RPATH'])) or [] + oldLINKFLAGS = (env.has_key('LINKFLAGS') and deepcopy(env['LINKFLAGS'])) or [] + env.AppendUnique(LIBPATH = libpath) + env.AppendUnique(LIBS = libs) + env.AppendUnique(RPATH = libpath) + env.AppendUnique(LINKFLAGS = linkflags) + + # HACK: we add libpath and libs at the end of the source as a comment, to + # add dependency of the check on those. + src = '\n'.join(['#include <%s>' % h for h in headers] +\ + [run_src, '#if 0', '%s' % libpath, + '%s' % headers, '%s' % libs, '#endif']) + ret = context.TryLink(src, '.c') + if (not ret or not autoadd): + # If test failed or autoadd = 0, restore everything + env.Replace(LIBS = oldLIBS) + env.Replace(LIBPATH = oldLIBPATH) + env.Replace(RPATH = oldRPATH) + env.Replace(LINKFLAGS = oldLINKFLAGS) + + if not ret: + context.Result('Failed: %s test could not be linked and run' % name) + return 0 + + context.Result(ret) + return ret + +#def CheckMKL(context, mkl_dir, nb): +# """mkl_lib is the root path of MKL (the one which contains include, lib, +# etc...). nb is 32, 64, emt, etc...""" +# +# libs = ['mkl'] +# cpppath = os.path.join(mkl_dir, 'include') +# libpath = os.path.join(mkl_dir, 'lib', nb) +# +# return _check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], +# cblas_src, libs, libpath, [], [], autoadd) + +def CheckMKL(context, autoadd = 1): + """Check MKL is usable using a simple cblas example.""" + section = "mkl" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if not found: + # XXX: find exact options to use for the MKL + libs.extend(['lapack', 'mkl', 'guide', 'm']) + headers = ['mkl.h'] + + return _check_include_and_run(context, 'MKL', cpppath, headers, + cblas_src, libs, libpath, [], [], autoadd) + +def CheckATLAS(context, autoadd = 1): + """Check whether ATLAS is usable in C.""" + + libs = ['atlas', 'f77blas', 'cblas'] + libpath = [] + + return _check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h', 'cblas.h'], + cblas_src, libs, libpath, [], [], autoadd) + +def CheckAccelerate(context, autoadd = 1): + """Checker for Accelerate framework (on Mac OS X >= 10.3). Only test from + C.""" + # According to + # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: + # + # This page contains a continually expanding set of vector libraries + # that are available to the AltiVec programmer through the Accelerate + # framework on MacOS X.3, Panther. On earlier versions of MacOS X, + # these were available in vecLib.framework. The currently available + # libraries are described below. + + #XXX: get_platform does not seem to work... + #if get_platform()[-4:] == 'i386': + # is_intel = 1 + # cflags.append('-msse3') + #else: + # is_intel = 0 + # cflags.append('-faltivec') + + # XXX: This double append is not good, any other way ? + linkflags = ['-framework', 'Accelerate'] + + return _check_include_and_run(context, 'FRAMEWORK: Accelerate', None, + ['Accelerate/Accelerate.h'], cblas_src, [], + [], linkflags, [], autoadd) + +def CheckVeclib(context, autoadd = 1): + """Checker for Veclib framework (on Mac OS X < 10.3).""" + # XXX: This double append is not good, any other way ? + linkflags = ['-framework', 'vecLib'] + + return _check_include_and_run(context, 'FRAMEWORK: veclib', None, + ['vecLib/vecLib.h'], cblas_src, [], + [], linkflags, [], autoadd) + +def CheckSunperf(context, autoadd = 1): + """Checker for sunperf using a simple sunperf example""" + + # XXX: Other options needed ? + linkflags = ['-xlic_lib=sunperf'] + cflags = ['-dalign'] + + return _check_include_and_run(context, 'sunperf', None, + ['sunperf.h'], sunperf_src, [], + [], linkflags, cflags, autoadd) + +def CheckCBLAS(context, autoadd = 1): + env = context.env + + # If section cblas is in site.cfg, use those options. Otherwise, use default + section = "cblas" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if found: + headers = ['cblas.h'] + linkflags = [] + cflags = [] + st = _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, + libs, libpath, linkflags, cflags, autoadd) + if st: + add_info(env, 'cblas', opt_info('cblas', site = 1)) + return st + else: + if sys.platform == 'darwin': + st = CheckAccelerate(context, autoadd) + if st: + add_info(env, 'cblas', opt_info('Accelerate')) + return st + st = CheckVeclib(context, autoadd) + if st: + add_info(env, 'cblas', opt_info('vecLib')) + return st + + add_info(env, 'cblas', opt_info('')) + return 0 + + else: + # Check MKL, then ATLAS, then Sunperf + st = CheckMKL(context, autoadd) + if st: + add_info(env, 'cblas', opt_info('mkl')) + return st + st = CheckATLAS(context, autoadd) + if st: + add_info(env, 'cblas', opt_info('atlas')) + return st + st = CheckSunperf(context, autoadd) + if st: + add_info(env, 'cblas', opt_info('sunperf')) + return st + + add_info(env, 'cblas', opt_info('')) + return 0 + +def CheckLAPACK(context, autoadd = 1): + # XXX: this whole thing is ugly. Think more about how to combine checkers + # in 'meta checker' like this. + if sys.platform == 'nt': + import warnings + warning.warn('FIXME: LAPACK checks not implemented yet on win32') + return 0 + else: + env = context.env + + # Get fortran stuff + if not env.has_key('F77_NAME_MANGLER'): + if not CheckF77Mangling(context): + return 0 + if not env.has_key('F77_LDFLAGS'): + if not CheckF77Clib(context): + return 0 + + # Get the mangled name of our test function + sgesv_string = env['F77_NAME_MANGLER']('sgesv') + test_src = lapack_sgesv % sgesv_string + + # Check MKL + st = CheckMKL(context, autoadd = 1) + if st: + fdict = env.ParseFlags(context.env['F77_LDFLAGS']) + fdict['LIBS'].append('lapack') + if env.has_key('LIBS'): + fdict['LIBS'].extend(context.env['LIBS']) + if env.has_key('LIBPATH'): + fdict['LIBPATH'].extend(context.env['LIBPATH']) + st =_check_include_and_run(context, 'LAPACK (MKL)', [], [], + test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) + add_info(env, 'lapack', opt_info('mkl')) + return st + + # Check ATLAS + st = CheckATLAS(context, autoadd = 1) + if st: + fdict = env.ParseFlags(context.env['F77_LDFLAGS']) + fdict['LIBS'].append('lapack') + if env.has_key('LIBS'): + fdict['LIBS'].extend(context.env['LIBS']) + if env.has_key('LIBPATH'): + fdict['LIBPATH'].extend(context.env['LIBPATH']) + st =_check_include_and_run(context, 'LAPACK (ATLAS)', [], [], + test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) + add_info(env, 'lapack', opt_info('atlas')) + # XXX: Check complete LAPACK or not + return st + + return 0 + +def _my_try_link(context, src, libs, libpath, autoadd = 0): + """Try to link the given text in src with libs and libpath.""" + env = context.env + + oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] + oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] + + ret = 0 + try: + env.AppendUnique(LIBS = libs, LIBPATH = libpath) + ret = context.TryLink(src, '.c') + finally: + if not ret or not autoadd: + env.Replace(LIBS = oldLIBS, LIBPATH = oldLIBPATH) + + return ret + +def CheckGenericBLAS(context, autoadd = 1, section = 'blas'): + """Check whether a BLAS library can be found. + + Use site.cfg if found (section given by section argument).""" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if not found: + libs.extend(['blas']) + + env = context.env + # Get fortran mangling + if not env.has_key('F77_NAME_MANGLER'): + if not CheckF77Mangling(context): + return 0 + + test_func_name = env['F77_NAME_MANGLER']('dgemm') + src = get_func_link_src(test_func_name) + + context.Message("Checking for Generic BLAS... ") + + st = _my_try_link(context, src, libs, libpath, autoadd) + if st: + env['F77_BLAS_LIBS'] = libs + env['F77_BLAS_LIBPATH'] = libpath + + context.Result(st) + + return st + +def CheckGenericLAPACK(context, autoadd = 1, section = 'lapack'): + """Check whether a LAPACK library can be found. + + Use site.cfg if found (section given by section argument).""" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if not found: + libs.extend(['lapack']) + + env = context.env + # Get fortran mangling + if not env.has_key('F77_NAME_MANGLER'): + if not CheckF77Mangling(context): + return 0 + + test_func_name = env['F77_NAME_MANGLER']('dpotri') + src = get_func_link_src(test_func_name) + + context.Message("Checking for Generic LAPACK... ") + + st = _my_try_link(context, src, libs, libpath, autoadd) + if st: + env['F77_LAPACK_LIBS'] = libs + env['F77_LAPACK_LIBPATH'] = libpath + + context.Result(st) + + return st Deleted: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 10:02:27 UTC (rev 4326) +++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py 2007-10-29 10:43:52 UTC (rev 4327) @@ -1,349 +0,0 @@ -#! /usr/bin/env python -# Last Change: Mon Oct 29 06:00 PM 2007 J - -# Module for custom, common checkers for numpy (and scipy) -import sys -import os.path -from copy import deepcopy -from distutils.util import get_platform - -from libinfo import get_config, get_config_from_section, get_func_link_src -from libinfo_scons import NumpyCheckLib -from testcode_snippets import cblas_sgemm as cblas_src, \ - c_sgemm as sunperf_src, lapack_sgesv - -from fortran_scons import CheckF77Mangling, CheckF77Clib - -from configuration import opt_info, add_info - -def _check_include_and_run(context, name, cpppath, headers, run_src, libs, - libpath, linkflags, cflags, autoadd = 1): - """This is a basic implementation for generic "test include and run" - testers. - - For example, for library foo, which implements function do_foo, and with - include header foo.h, this will: - - test that foo.h is found and compilable by the compiler - - test that the given source code can be compiled. The source code - should contain a simple program with the function. - - Arguments: - - name: name of the library - - cpppath: list of directories - - headers: list of headers - - run_src: the code for the run test - - libs: list of libraries to link - - libpath: list of library path. - - linkflags: list of link flags to add.""" - context.Message('Checking for %s ... ' % name) - env = context.env - - #---------------------------- - # Check headers are available - #---------------------------- - oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] - oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] - env.AppendUnique(CPPPATH = cpppath) - env.AppendUnique(CFLAGS = cflags) - # XXX: handle context - hcode = ['#include <%s>' % h for h in headers] - # HACK: we add cpppath in the command of the source, to add dependency of - # the check on the cpppath. - hcode.extend(['#if 0', '%s' % cpppath, '#endif\n']) - src = '\n'.join(hcode) - - ret = context.TryCompile(src, '.c') - if not ret: - env.Replace(CPPPATH = oldCPPPATH) - env.Replace(CFLAGS = oldCFLAGS) - context.Result('Failed: %s include not found' % name) - return 0 - - #------------------------------ - # Check a simple example works - #------------------------------ - oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] - oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] - # XXX: RPATH, drawbacks using it ? - oldRPATH = (env.has_key('RPATH') and deepcopy(env['RPATH'])) or [] - oldLINKFLAGS = (env.has_key('LINKFLAGS') and deepcopy(env['LINKFLAGS'])) or [] - env.AppendUnique(LIBPATH = libpath) - env.AppendUnique(LIBS = libs) - env.AppendUnique(RPATH = libpath) - env.AppendUnique(LINKFLAGS = linkflags) - - # HACK: we add libpath and libs at the end of the source as a comment, to - # add dependency of the check on those. - src = '\n'.join(['#include <%s>' % h for h in headers] +\ - [run_src, '#if 0', '%s' % libpath, - '%s' % headers, '%s' % libs, '#endif']) - ret = context.TryLink(src, '.c') - if (not ret or not autoadd): - # If test failed or autoadd = 0, restore everything - env.Replace(LIBS = oldLIBS) - env.Replace(LIBPATH = oldLIBPATH) - env.Replace(RPATH = oldRPATH) - env.Replace(LINKFLAGS = oldLINKFLAGS) - - if not ret: - context.Result('Failed: %s test could not be linked and run' % name) - return 0 - - context.Result(ret) - return ret - -#def CheckMKL(context, mkl_dir, nb): -# """mkl_lib is the root path of MKL (the one which contains include, lib, -# etc...). nb is 32, 64, emt, etc...""" -# -# libs = ['mkl'] -# cpppath = os.path.join(mkl_dir, 'include') -# libpath = os.path.join(mkl_dir, 'lib', nb) -# -# return _check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], -# cblas_src, libs, libpath, [], [], autoadd) - -def CheckMKL(context, autoadd = 1): - """Check MKL is usable using a simple cblas example.""" - section = "mkl" - siteconfig, cfgfiles = get_config() - (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) - if not found: - # XXX: find exact options to use for the MKL - libs.extend(['lapack', 'mkl', 'guide', 'm']) - headers = ['mkl.h'] - - return _check_include_and_run(context, 'MKL', cpppath, headers, - cblas_src, libs, libpath, [], [], autoadd) - -def CheckATLAS(context, autoadd = 1): - """Check whether ATLAS is usable in C.""" - - libs = ['atlas', 'f77blas', 'cblas'] - libpath = [] - - return _check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h', 'cblas.h'], - cblas_src, libs, libpath, [], [], autoadd) - -def CheckAccelerate(context, autoadd = 1): - """Checker for Accelerate framework (on Mac OS X >= 10.3). Only test from - C.""" - # According to - # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: - # - # This page contains a continually expanding set of vector libraries - # that are available to the AltiVec programmer through the Accelerate - # framework on MacOS X.3, Panther. On earlier versions of MacOS X, - # these were available in vecLib.framework. The currently available - # libraries are described below. - - #XXX: get_platform does not seem to work... - #if get_platform()[-4:] == 'i386': - # is_intel = 1 - # cflags.append('-msse3') - #else: - # is_intel = 0 - # cflags.append('-faltivec') - - # XXX: This double append is not good, any other way ? - linkflags = ['-framework', 'Accelerate'] - - return _check_include_and_run(context, 'FRAMEWORK: Accelerate', None, - ['Accelerate/Accelerate.h'], cblas_src, [], - [], linkflags, [], autoadd) - -def CheckVeclib(context, autoadd = 1): - """Checker for Veclib framework (on Mac OS X < 10.3).""" - # XXX: This double append is not good, any other way ? - linkflags = ['-framework', 'vecLib'] - - return _check_include_and_run(context, 'FRAMEWORK: veclib', None, - ['vecLib/vecLib.h'], cblas_src, [], - [], linkflags, [], autoadd) - -def CheckSunperf(context, autoadd = 1): - """Checker for sunperf using a simple sunperf example""" - - # XXX: Other options needed ? - linkflags = ['-xlic_lib=sunperf'] - cflags = ['-dalign'] - - return _check_include_and_run(context, 'sunperf', None, - ['sunperf.h'], sunperf_src, [], - [], linkflags, cflags, autoadd) - -def CheckCBLAS(context, autoadd = 1): - env = context.env - - # If section cblas is in site.cfg, use those options. Otherwise, use default - section = "cblas" - siteconfig, cfgfiles = get_config() - (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) - if found: - headers = ['cblas.h'] - linkflags = [] - cflags = [] - st = _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, - libs, libpath, linkflags, cflags, autoadd) - if st: - add_info(env, 'cblas', opt_info('cblas', site = 1)) - return st - else: - if sys.platform == 'darwin': - st = CheckAccelerate(context, autoadd) - if st: - add_info(env, 'cblas', opt_info('Accelerate')) - return st - st = CheckVeclib(context, autoadd) - if st: - add_info(env, 'cblas', opt_info('vecLib')) - return st - - add_info(env, 'cblas', opt_info('')) - return 0 - - else: - # Check MKL, then ATLAS, then Sunperf - st = CheckMKL(context, autoadd) - if st: - add_info(env, 'cblas', opt_info('mkl')) - return st - st = CheckATLAS(context, autoadd) - if st: - add_info(env, 'cblas', opt_info('atlas')) - return st - st = CheckSunperf(context, autoadd) - if st: - add_info(env, 'cblas', opt_info('sunperf')) - return st - - add_info(env, 'cblas', opt_info('')) - return 0 - -def CheckLAPACK(context, autoadd = 1): - # XXX: this whole thing is ugly. Think more about how to combine checkers - # in 'meta checker' like this. - if sys.platform == 'nt': - import warnings - warning.warn('FIXME: LAPACK checks not implemented yet on win32') - return 0 - else: - env = context.env - - # Get fortran stuff - if not env.has_key('F77_NAME_MANGLER'): - if not CheckF77Mangling(context): - return 0 - if not env.has_key('F77_LDFLAGS'): - if not CheckF77Clib(context): - return 0 - - # Get the mangled name of our test function - sgesv_string = env['F77_NAME_MANGLER']('sgesv') - test_src = lapack_sgesv % sgesv_string - - # Check MKL - st = CheckMKL(context, autoadd = 1) - if st: - fdict = env.ParseFlags(context.env['F77_LDFLAGS']) - fdict['LIBS'].append('lapack') - if env.has_key('LIBS'): - fdict['LIBS'].extend(context.env['LIBS']) - if env.has_key('LIBPATH'): - fdict['LIBPATH'].extend(context.env['LIBPATH']) - st =_check_include_and_run(context, 'LAPACK (MKL)', [], [], - test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) - add_info(env, 'lapack', opt_info('mkl')) - return st - - # Check ATLAS - st = CheckATLAS(context, autoadd = 1) - if st: - fdict = env.ParseFlags(context.env['F77_LDFLAGS']) - fdict['LIBS'].append('lapack') - if env.has_key('LIBS'): - fdict['LIBS'].extend(context.env['LIBS']) - if env.has_key('LIBPATH'): - fdict['LIBPATH'].extend(context.env['LIBPATH']) - st =_check_include_and_run(context, 'LAPACK (ATLAS)', [], [], - test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) - add_info(env, 'lapack', opt_info('atlas')) - # XXX: Check complete LAPACK or not - return st - - return 0 - -def _my_try_link(context, src, libs, libpath, autoadd = 0): - """Try to link the given text in src with libs and libpath.""" - env = context.env - - oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] - oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] - - ret = 0 - try: - env.AppendUnique(LIBS = libs, LIBPATH = libpath) - ret = context.TryLink(src, '.c') - finally: - if not ret or not autoadd: - env.Replace(LIBS = oldLIBS, LIBPATH = oldLIBPATH) - - return ret - -def CheckGenericBLAS(context, autoadd = 1, section = 'blas'): - """Check whether a BLAS library can be found. - - Use site.cfg if found (section given by section argument).""" - siteconfig, cfgfiles = get_config() - (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) - if not found: - libs.extend(['blas']) - - env = context.env - # Get fortran mangling - if not env.has_key('F77_NAME_MANGLER'): - if not CheckF77Mangling(context): - return 0 - - test_func_name = env['F77_NAME_MANGLER']('dgemm') - src = get_func_link_src(test_func_name) - - context.Message("Checking for Generic BLAS... ") - - st = _my_try_link(context, src, libs, libpath, autoadd) - if st: - env['F77_BLAS_LIBS'] = libs - env['F77_BLAS_LIBPATH'] = libpath - - context.Result(st) - - return st - -def CheckGenericLAPACK(context, autoadd = 1, section = 'lapack'): - """Check whether a LAPACK library can be found. - - Use site.cfg if found (section given by section argument).""" - siteconfig, cfgfiles = get_config() - (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) - if not found: - libs.extend(['lapack']) - - env = context.env - # Get fortran mangling - if not env.has_key('F77_NAME_MANGLER'): - if not CheckF77Mangling(context): - return 0 - - test_func_name = env['F77_NAME_MANGLER']('dpotri') - src = get_func_link_src(test_func_name) - - context.Message("Checking for Generic LAPACK... ") - - st = _my_try_link(context, src, libs, libpath, autoadd) - if st: - env['F77_LAPACK_LIBS'] = libs - env['F77_LAPACK_LIBPATH'] = libpath - - context.Result(st) - - return st From numpy-svn at scipy.org Mon Oct 29 07:08:42 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 06:08:42 -0500 (CDT) Subject: [Numpy-svn] r4328 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071029110842.86DC139C075@new.scipy.org> Author: cdavid Date: 2007-10-29 06:08:36 -0500 (Mon, 29 Oct 2007) New Revision: 4328 Modified: branches/numpy.scons/numpy/distutils/scons/utils.py Log: Add a description for utils.py module Modified: branches/numpy.scons/numpy/distutils/scons/utils.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-29 10:43:52 UTC (rev 4327) +++ branches/numpy.scons/numpy/distutils/scons/utils.py 2007-10-29 11:08:36 UTC (rev 4328) @@ -1,3 +1,9 @@ +#! /usr/bin/env python +# Last Change: Mon Oct 29 07:00 PM 2007 J + +# This module defines various utilities used throughout the scons support +# library. + import os import re From numpy-svn at scipy.org Mon Oct 29 07:09:42 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 06:09:42 -0500 (CDT) Subject: [Numpy-svn] r4329 - in branches/numpy.scons/numpy/distutils/scons: . doc Message-ID: <20071029110942.B64ED39C075@new.scipy.org> Author: cdavid Date: 2007-10-29 06:09:37 -0500 (Mon, 29 Oct 2007) New Revision: 4329 Added: branches/numpy.scons/numpy/distutils/scons/doc/ branches/numpy.scons/numpy/distutils/scons/doc/TODO Removed: branches/numpy.scons/numpy/distutils/scons/TODO Log: Move TODO into doc Deleted: branches/numpy.scons/numpy/distutils/scons/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-29 11:08:36 UTC (rev 4328) +++ branches/numpy.scons/numpy/distutils/scons/TODO 2007-10-29 11:09:37 UTC (rev 4329) @@ -1,30 +0,0 @@ -Before True milestone: - - improve BrokenMathlib and Mathlib in core, and make them available to - everyone - - show_config implementation : how to do it ? - - How to build meta-checkers from simple checkers (for example, BLAS with - MKL, ATLAS, Sunperf, etc...) ? - -Checker: - - improve Fortran runtime detection for upstream integration - - improve Fortran mangling and dummy main detection for upstream - integration - -Builder: - - Get a PythonExtension builder independant of distutils for upstream - integration - - Get a CtypesExtension builder independant of distutils for upstream - integration - - Generic Api builders (with dep tracking) - - Generic FromTemplate builder (with dep tracking) - -Implementation details: - - Default optim, warn and link flags for python extension on at least gcc, - g77, gfortran (1st priority), MS and Intel (2d priority), others (3rd: - sun, aix, etc...) - - Refactor code for API generation (numpy/core/code_generators) -> Mostly done - -Documentation: - - scons / distutils integration - - global design (BuildDir, directories, etc...) - - package developers documentation Copied: branches/numpy.scons/numpy/distutils/scons/doc/TODO (from rev 4327, branches/numpy.scons/numpy/distutils/scons/TODO) From numpy-svn at scipy.org Mon Oct 29 10:38:45 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 09:38:45 -0500 (CDT) Subject: [Numpy-svn] r4330 - in trunk/numpy: core core/code_generators distutils f2py f2py/doc f2py/tests/mixed oldnumeric Message-ID: <20071029143845.6A36139C035@new.scipy.org> Author: jarrod.millman Date: 2007-10-29 09:37:37 -0500 (Mon, 29 Oct 2007) New Revision: 4330 Modified: trunk/numpy/core/code_generators/generate_umath.py trunk/numpy/core/defchararray.py trunk/numpy/core/defmatrix.py trunk/numpy/distutils/ccompiler.py trunk/numpy/distutils/misc_util.py trunk/numpy/f2py/auxfuncs.py trunk/numpy/f2py/capi_maps.py trunk/numpy/f2py/cb_rules.py trunk/numpy/f2py/common_rules.py trunk/numpy/f2py/crackfortran.py trunk/numpy/f2py/doc/collectinput.py trunk/numpy/f2py/f2py2e.py trunk/numpy/f2py/f90mod_rules.py trunk/numpy/f2py/func2subr.py trunk/numpy/f2py/rules.py trunk/numpy/f2py/tests/mixed/run.py trunk/numpy/f2py/use_rules.py trunk/numpy/oldnumeric/matrix.py trunk/numpy/oldnumeric/precision.py Log: using faster string methods rather than deprecated string module Modified: trunk/numpy/core/code_generators/generate_umath.py =================================================================== --- trunk/numpy/core/code_generators/generate_umath.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/core/code_generators/generate_umath.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -1,4 +1,3 @@ -import string import re Zero = "PyUFunc_Zero" @@ -484,7 +483,7 @@ def indent(st,spaces): indention = ' '*spaces - indented = indention + string.replace(st,'\n','\n'+indention) + indented = indention + st.replace('\n','\n'+indention) # trim off any trailing spaces indented = re.sub(r' +$',r'',indented) return indented Modified: trunk/numpy/core/defchararray.py =================================================================== --- trunk/numpy/core/defchararray.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/core/defchararray.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -1,7 +1,7 @@ +import sys from numerictypes import string_, unicode_, integer, object_ from numeric import ndarray, broadcast, empty, compare_chararrays from numeric import array as narray -import sys __all__ = ['chararray'] Modified: trunk/numpy/core/defmatrix.py =================================================================== --- trunk/numpy/core/defmatrix.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/core/defmatrix.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -1,9 +1,8 @@ __all__ = ['matrix', 'bmat', 'mat', 'asmatrix'] +import sys import numeric as N from numeric import concatenate, isscalar, binary_repr -import string as str_ -import sys # make translation table _table = [None]*256 @@ -11,8 +10,7 @@ _table[k] = chr(k) _table = ''.join(_table) -_numchars = str_.digits + ".-+jeEL" -del str_ +_numchars = '0123456789.-+jeEL' _todelete = [] for k in _table: if k not in _numchars: Modified: trunk/numpy/distutils/ccompiler.py =================================================================== --- trunk/numpy/distutils/ccompiler.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/distutils/ccompiler.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -400,7 +400,8 @@ ccompiler.gen_preprocess_options = gen_preprocess_options ##Fix distutils.util.split_quoted: -import re,string +import re +import string _wordchars_re = re.compile(r'[^\\\'\"%s ]*' % string.whitespace) _squote_re = re.compile(r"'(?:[^'\\]|\\.)*'") _dquote_re = re.compile(r'"(?:[^"\\]|\\.)*"') Modified: trunk/numpy/distutils/misc_util.py =================================================================== --- trunk/numpy/distutils/misc_util.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/distutils/misc_util.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -5,7 +5,6 @@ import copy import glob import atexit -import string import tempfile try: @@ -1524,8 +1523,8 @@ Possible results are "Intel", "Itanium", or "AMD64". """ prefix = " bit (" - i = string.find(sys.version, prefix) + i = sys.version.find(prefix) if i == -1: return "Intel" - j = string.find(sys.version, ")", i) + j = sys.version.find(")", i) return sys.version[i+len(prefix):j] Modified: trunk/numpy/f2py/auxfuncs.py =================================================================== --- trunk/numpy/f2py/auxfuncs.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/auxfuncs.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -19,7 +19,10 @@ f2py_version = __version__.version import pprint -import sys,string,time,types,os +import sys +import time +import types +import os import cfuncs @@ -254,13 +257,13 @@ for i in range(len(f)): l='%s,f%d=f[%d]'%(l,i,i) l2.append('f%d(v)'%(i)) - return eval('%s:%s'%(l,string.join(l2,' and '))) + return eval('%s:%s'%(l,' and '.join(l2))) def l_or(*f): l,l2='lambda v',[] for i in range(len(f)): l='%s,f%d=f[%d]'%(l,i,i) l2.append('f%d(v)'%(i)) - return eval('%s:%s'%(l,string.join(l2,' or '))) + return eval('%s:%s'%(l,' or '.join(l2))) def l_not(f): return eval('lambda v,f=f:not f(v)') @@ -340,7 +343,7 @@ arg_types2.append('size_t') arg_types.append(ctype) - proto_args = string.join(arg_types+arg_types2,',') + proto_args = ','.join(arg_types+arg_types2) if not proto_args: proto_args = 'void' #print proto_args @@ -411,9 +414,9 @@ else: sep=defaultsep if type(dict[k])==types.ListType: - str=string.replace(str,'#%s#'%(k),string.join(flatlist(dict[k]),sep)) + str=str.replace('#%s#'%(k),sep.join(flatlist(dict[k]))) else: - str=string.replace(str,'#%s#'%(k),dict[k]) + str=str.replace('#%s#'%(k),dict[k]) return str def dictappend(rd,ar): Modified: trunk/numpy/f2py/capi_maps.py =================================================================== --- trunk/numpy/f2py/capi_maps.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/capi_maps.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -16,7 +16,9 @@ import __version__ f2py_version = __version__.version -import string,copy,re,os +import copy +import re +import os from auxfuncs import * from crackfortran import markoutercomma import cb_rules @@ -170,8 +172,8 @@ f.close() for k,d1 in d.items(): for k1 in d1.keys(): - d1[string.lower(k1)] = d1[k1] - d[string.lower(k)] = d[k] + d1[k1.lower()] = d1[k1] + d[k.lower()] = d[k] for k in d.keys(): if not f2cmap_all.has_key(k): f2cmap_all[k]={} for k1 in d[k].keys(): @@ -217,8 +219,8 @@ else: errmess('getctype: function %s has no return value?!\n'%a) elif issubroutine(var): return ctype - elif var.has_key('typespec') and f2cmap_all.has_key(string.lower(var['typespec'])): - typespec = string.lower(var['typespec']) + elif var.has_key('typespec') and f2cmap_all.has_key(var['typespec'].lower()): + typespec = var['typespec'].upper() f2cmap=f2cmap_all[typespec] ctype=f2cmap[''] # default type if var.has_key('kindselector'): @@ -279,10 +281,10 @@ # if not isintent_c(var): # var['dimension'].reverse() dim=copy.copy(var['dimension']) - ret['size']=string.join(dim,'*') + ret['size']='*'.join(dim) try: ret['size']=`eval(ret['size'])` except: pass - ret['dims']=string.join(dim,',') + ret['dims']=','.join(dim) ret['rank']=`len(dim)` ret['rank*[-1]']=`len(dim)*[-1]`[1:-1] for i in range(len(dim)): # solve dim for dependecies @@ -359,13 +361,13 @@ rank=`len(dim)` sig='%s :%s %s rank-%s array(\'%s\') with bounds (%s)'%(a,init,opt,rank, c2pycode_map[ctype], - string.join(dim,',')) + ','.join(dim)) if a==out_a: sigout='%s : rank-%s array(\'%s\') with bounds (%s)'\ - %(a,rank,c2pycode_map[ctype],string.join(dim,',')) + %(a,rank,c2pycode_map[ctype],','.join(dim)) else: sigout='%s : rank-%s array(\'%s\') with bounds (%s) and %s storage'\ - %(out_a,rank,c2pycode_map[ctype],string.join(dim,','),a) + %(out_a,rank,c2pycode_map[ctype],','.join(dim),a) elif isexternal(var): ua='' if lcb_map.has_key(a) and lcb2_map.has_key(lcb_map[a]) and lcb2_map[lcb_map[a]].has_key('argname'): @@ -389,7 +391,7 @@ rank=`len(dim)` sig='%s : rank-%s array(\'%s\') with bounds (%s)'%(a,rank, c2pycode_map[ctype], - string.join(dim,',')) + ','.join(dim)) return sig def getinit(a,var): @@ -404,7 +406,7 @@ try: v = var["="] if ',' in v: - ret['init.r'],ret['init.i']=string.split(markoutercomma(v[1:-1]),'@,@') + ret['init.r'],ret['init.i']=markoutercomma(v[1:-1]).split('@,@') else: v = eval(v,{},{}) ret['init.r'],ret['init.i']=str(v.real),str(v.imag) @@ -414,7 +416,7 @@ elif isstring(var): if not init: init,showinit='""',"''" if init[0]=="'": - init='"%s"'%(string.replace(init[1:-1],'"','\\"')) + init='"%s"'%(init[1:-1].replace('"','\\"')) if init[0]=='"': showinit="'%s'"%(init[1:-1]) return init,showinit @@ -440,7 +442,7 @@ if f(var): intent_flags.append('F2PY_%s'%s) if intent_flags: #XXX: Evaluate intent_flags here. - ret['intent'] = string.join(intent_flags,'|') + ret['intent'] = '|'.join(intent_flags) else: ret['intent'] = 'F2PY_INTENT_IN' if isarray(var): ret['varrformat']='N' @@ -449,7 +451,7 @@ else: ret['varrformat']='O' ret['init'],ret['showinit']=getinit(a,var) if hasinitvalue(var) and iscomplex(var) and not isarray(var): - ret['init.r'],ret['init.i'] = string.split(markoutercomma(ret['init'][1:-1]),'@,@') + ret['init.r'],ret['init.i'] = markoutercomma(ret['init'][1:-1]).split('@,@') if isexternal(var): ret['cbnamekey']=a if lcb_map.has_key(a): @@ -491,14 +493,14 @@ if isarray(var): # if not isintent_c(var): # var['dimension'].reverse() - ddim=string.join(map(lambda x,y:'%s|%s'%(x,y),var['dimension'],dim),',') + ddim=','.join(map(lambda x,y:'%s|%s'%(x,y),var['dimension'],dim)) rl.append('dims(%s)'%ddim) # if not isintent_c(var): # var['dimension'].reverse() if isexternal(var): - ret['vardebuginfo']='debug-capi:%s=>%s:%s'%(a,ret['cbname'],string.join(rl,',')) + ret['vardebuginfo']='debug-capi:%s=>%s:%s'%(a,ret['cbname'],','.join(rl)) else: - ret['vardebuginfo']='debug-capi:%s %s=%s:%s'%(ret['ctype'],a,ret['showinit'],string.join(rl,',')) + ret['vardebuginfo']='debug-capi:%s %s=%s:%s'%(ret['ctype'],a,ret['showinit'],','.join(rl)) if isscalar(var): if cformat_map.has_key(ret['ctype']): ret['vardebugshowvalue']='debug-capi:%s=%s'%(a,cformat_map[ret['ctype']]) @@ -526,13 +528,13 @@ name = rout['name'] fname = getfortranname(rout) ret={'name':name, - 'texname':string.replace(name,'_','\\_'), - 'name_lower':string.lower(name), - 'NAME':string.upper(name), + 'texname':name.replace('_','\\_'), + 'name_lower':name.lower(), + 'NAME':name.upper(), 'begintitle':gentitle(name), 'endtitle':gentitle('end of %s'%name), 'fortranname':fname, - 'FORTRANNAME':string.upper(fname), + 'FORTRANNAME':fname.upper(), 'callstatement':getcallstatement(rout) or '', 'usercode':getusercode(rout) or '', 'usercode1':getusercode1(rout) or '', @@ -595,12 +597,12 @@ """ if ismodule(m): ret={'f90modulename':m['name'], - 'F90MODULENAME':string.upper(m['name']), - 'texf90modulename':string.replace(m['name'],'_','\\_')} + 'F90MODULENAME':m['name'].upper(), + 'texf90modulename':m['name'].replace('_','\\_')} else: ret={'modulename':m['name'], - 'MODULENAME':string.upper(m['name']), - 'texmodulename':string.replace(m['name'],'_','\\_')} + 'MODULENAME':m['name'].upper(), + 'texmodulename':m['name'].replace('_','\\_')} ret['restdoc'] = getrestdoc(m) or [] if hasnote(m): ret['note']=m['note'] Modified: trunk/numpy/f2py/cb_rules.py =================================================================== --- trunk/numpy/f2py/cb_rules.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/cb_rules.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -20,7 +20,10 @@ import pprint -import sys,string,time,types,copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -484,8 +487,8 @@ {'docsign':rd['docsign'], 'docsignopt':optargs, }) - rd['latexdocsignature']=string.replace(rd['docsignature'],'_','\\_') - rd['latexdocsignature']=string.replace(rd['latexdocsignature'],',',', ') + rd['latexdocsignature']=rd['docsignature'].replace('_','\\_') + rd['latexdocsignature']=rd['latexdocsignature'].replace(',',', ') rd['docstrsigns']=[] rd['latexdocstrsigns']=[] for k in ['docstrreq','docstropt','docstrout','docstrcbs']: Modified: trunk/numpy/f2py/common_rules.py =================================================================== --- trunk/numpy/f2py/common_rules.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/common_rules.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -19,7 +19,10 @@ f2py_version = __version__.version import pprint -import sys,string,time,types,copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -63,24 +66,24 @@ doc = [''] def dadd(line,s=doc): s[0] = '%s\n%s'%(s[0],line) for (name,vnames,vars) in findcommonblocks(m): - lower_name = string.lower(name) + lower_name = name.lower() hnames,inames = [],[] for n in vnames: if isintent_hide(vars[n]): hnames.append(n) else: inames.append(n) if hnames: - outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n\t\t Hidden: %s\n'%(name,string.join(inames,','),string.join(hnames,','))) + outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n\t\t Hidden: %s\n'%(name,','.join(inames),','.join(hnames))) else: - outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n'%(name,string.join(inames,','))) + outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n'%(name,','.join(inames))) fadd('subroutine f2pyinit%s(setupfunc)'%name) fadd('external setupfunc') for n in vnames: fadd(func2subr.var2fixfortran(vars,n)) if name=='_BLNK_': - fadd('common %s'%(string.join(vnames,','))) + fadd('common %s'%(','.join(vnames))) else: - fadd('common /%s/ %s'%(name,string.join(vnames,','))) - fadd('call setupfunc(%s)'%(string.join(inames,','))) + fadd('common /%s/ %s'%(name,','.join(vnames))) + fadd('call setupfunc(%s)'%(','.join(inames))) fadd('end\n') cadd('static FortranDataDef f2py_%s_def[] = {'%(name)) idims=[] @@ -90,12 +93,12 @@ dm = capi_maps.getarrdims(n,vars[n]) if dm['dims']: idims.append('(%s)'%(dm['dims'])) else: idims.append('') - dms=string.strip(dm['dims']) + dms=dm['dims'].strip() if not dms: dms='-1' cadd('\t{\"%s\",%s,{{%s}},%s},'%(n,dm['rank'],dms,at)) cadd('\t{NULL}\n};') inames1 = rmbadname(inames) - inames1_tps = string.join(map(lambda s:'char *'+s,inames1),',') + inames1_tps = ','.join(map(lambda s:'char *'+s,inames1)) cadd('static void f2py_setup_%s(%s) {'%(name,inames1_tps)) cadd('\tint i_f2py=0;') for n in inames1: @@ -106,24 +109,24 @@ else: F_FUNC='F_FUNC' cadd('extern void %s(f2pyinit%s,F2PYINIT%s)(void(*)(%s));'\ - %(F_FUNC,lower_name,string.upper(name), - string.join(['char*']*len(inames1),','))) + %(F_FUNC,lower_name,name.upper(), + ','.join(['char*']*len(inames1)))) cadd('static void f2py_init_%s(void) {'%name) cadd('\t%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);'\ - %(F_FUNC,lower_name,string.upper(name),name)) + %(F_FUNC,lower_name,name.upper(),name)) cadd('}\n') iadd('\tF2PyDict_SetItemString(d, \"%s\", PyFortranObject_New(f2py_%s_def,f2py_init_%s));'%(name,name,name)) - tname = string.replace(name,'_','\\_') + tname = name.replace('_','\\_') dadd('\\subsection{Common block \\texttt{%s}}\n'%(tname)) dadd('\\begin{description}') for n in inames: dadd('\\item[]{{}\\verb@%s@{}}'%(capi_maps.getarrdocsign(n,vars[n]))) if hasnote(vars[n]): note = vars[n]['note'] - if type(note) is type([]): note=string.join(note,'\n') + if type(note) is type([]): note='\n'.join(note) dadd('--- %s'%(note)) dadd('\\end{description}') - ret['docs'].append('"\t/%s/ %s\\n"'%(name,string.join(map(lambda v,d:v+d,inames,idims),','))) + ret['docs'].append('"\t/%s/ %s\\n"'%(name,','.join(map(lambda v,d:v+d,inames,idims)))) ret['commonhooks']=chooks ret['initcommonhooks']=ihooks ret['latexdoc']=doc[0] Modified: trunk/numpy/f2py/crackfortran.py =================================================================== --- trunk/numpy/f2py/crackfortran.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/crackfortran.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -15,6 +15,7 @@ __version__ = "$Revision: 1.177 $"[10:-1] import __version__ +import string f2py_version = __version__.version """ @@ -143,7 +144,13 @@ The above may be solved by creating appropriate preprocessor program, for example. """ # -import sys,string,fileinput,re,pprint,os,copy +import sys +import string +import fileinput +import re +import pprint +import os +import copy from auxfuncs import * # Global flags: @@ -222,7 +229,7 @@ def undo_rmbadname(names): return map(undo_rmbadname1,names) def getextension(name): - i=string.rfind(name,'.') + i=name.rfind('.') if i==-1: return '' if '\\' in name[i:]: return '' if '/' in name[i:]: return '' @@ -307,7 +314,7 @@ %(`currentfilename`,sourcecodeform, strictf77 and ',strict' or '')) - l=string.expandtabs(l).replace('\xa0',' ') + l=l.expandtabs().replace('\xa0',' ') while not l=='': # Get rid of newline characters if l[-1] not in "\n\r\f": break l=l[:-1] @@ -316,17 +323,17 @@ if r: l=r.group('line')+' ' # Strip comments starting with `!' rl=r.group('rest') - if string.lower(rl[:4])=='f2py': # f2py directive + if rl[:4].lower()=='f2py': # f2py directive l = l + 4*' ' r=commentline.match(rl[4:]) if r: l=l+r('line') else: l = l + rl[4:] - if string.strip(l)=='': # Skip empty line + if l.strip()=='': # Skip empty line cont=0 continue if sourcecodeform=='fix': if l[0] in ['*','c','!','C','#']: - if string.lower(l[1:5])=='f2py': # f2py directive + if l[1:5].lower()=='f2py': # f2py directive l=' '+l[5:] else: # Skip comment line cont=0 @@ -352,14 +359,14 @@ origfinalline='' else: l=' '+l[5:] # clean up line beginning from possible digits. - if localdolowercase: finalline=string.lower(ll) + if localdolowercase: finalline=ll.lower() else: finalline=ll origfinalline=ll ll=l cont=(r is not None) else: l=' '+l[5:] # clean up line beginning from possible digits. - if localdolowercase: finalline=string.lower(ll) + if localdolowercase: finalline=ll.lower() else: finalline=ll origfinalline =ll ll=l @@ -383,7 +390,7 @@ finalline='' origfinalline='' else: - if localdolowercase: finalline=string.lower(ll) + if localdolowercase: finalline=ll.lower() else: finalline=ll origfinalline =ll ll=l @@ -411,7 +418,7 @@ dowithline(finalline) l1=ll if localdolowercase: - finalline=string.lower(ll) + finalline=ll.lower() else: finalline=ll origfinalline = ll filepositiontext='Line #%d in %s:"%s"\n\t' % (fin.filelineno()-1,currentfilename,l1) @@ -482,11 +489,11 @@ def _simplifyargs(argsline): a = [] - for n in string.split(markoutercomma(argsline),'@,@'): + for n in markoutercomma(argsline).split('@,@'): for r in '(),': - n = string.replace(n,r,'_') + n = n.replace(r,'_') a.append(n) - return string.join(a,',') + return ','.join(a) crackline_re_1 = re.compile(r'\s*(?P\b[a-z]+[\w]*\b)\s*[=].*',re.I) def crackline(line,reset=0): @@ -650,7 +657,7 @@ assert not f,`f,line,l,cc` return l def unmarkouterparen(line): - r = string.replace(string.replace(line,'@(@','('),'@)@',')') + r = line.replace('@(@','(').replace('@)@',')') return r def appenddecl(decl,decl2,force=1): if not decl: decl={} @@ -706,7 +713,7 @@ previous_context = None if expectbegin and case not in ['begin','call','callfun','type'] \ and not skipemptyends and groupcounter<1: - newname=string.split(os.path.basename(currentfilename),'.')[0] + newname=os.path.basename(currentfilename).split('.')[0] outmess('analyzeline: no group yet. Creating program group with name "%s".\n'%newname) gotnextfile=0 groupcounter=groupcounter+1 @@ -734,7 +741,7 @@ outmess('analyzeline: No name/args pattern found for line.\n') previous_context = (block,name,groupcounter) - if args: args=rmbadname(map(string.strip,string.split(markoutercomma(args),'@,@'))) + if args: args=rmbadname([x.strip() for x in markoutercomma(args).split('@,@')]) else: args=[] if '' in args: while '' in args: @@ -851,7 +858,7 @@ name,args,result=_resolvenameargspattern(m.group('after')) if name is not None: if args: - args=rmbadname(map(string.strip,string.split(markoutercomma(args),'@,@'))) + args=rmbadname([x.strip() for x in markoutercomma(args).strip('@,@')]) else: args=[] assert result is None,`result` groupcache[groupcounter]['entry'][name] = args @@ -864,22 +871,22 @@ elif case in ['dimension','intent','optional','required','external','public','private','intrisic']: edecl=groupcache[groupcounter]['vars'] ll=m.group('after').strip() - i=string.find(ll,'::') + i=ll.find('::') if i<0 and case=='intent': - i=string.find(markouterparen(ll),'@)@')-2 + i=markouterparen(ll).find('@)@')-2 ll=ll[:i+1]+'::'+ll[i+1:] - i=string.find(ll,'::') + i=ll.find('::') if ll[i:]=='::' and groupcache[groupcounter].has_key('args'): outmess('All arguments will have attribute %s%s\n'%(m.group('this'),ll[:i])) - ll = ll + string.join(groupcache[groupcounter]['args'],',') + ll = ll + ','.join(groupcache[groupcounter]['args']) if i<0:i=0;pl='' - else: pl=string.strip(ll[:i]);ll=ll[i+2:] - ch = string.split(markoutercomma(pl),'@,@') + else: pl=ll[:i].strip();ll=ll[i+2:] + ch = markoutercomma(pl).split('@,@') if len(ch)>1: pl = ch[0] outmess('analyzeline: cannot handle multiple attributes without type specification. Ignoring %r.\n' % (','.join(ch[1:]))) last_name = None - for e in map(string.strip,string.split(markoutercomma(ll),'@,@')): + for e in [x.strip() for x in markoutercomma(ll).split('@,@')]: m1=namepattern.match(e) if not m1: if case in ['public','private']: k='' @@ -896,8 +903,7 @@ if _intentcallbackpattern.match(ap): if k not in groupcache[groupcounter]['args']: if groupcounter>1 and \ - string.find(groupcache[groupcounter-2]['name'], - '__user__')==-1: + '__user__' in groupcache[groupcounter-2]['name']: outmess('analyzeline: appending intent(callback) %s'\ ' to %s arguments\n' % (k,groupcache[groupcounter]['name'])) groupcache[groupcounter]['args'].append(k) @@ -923,11 +929,11 @@ previous_context = ('variable',last_name,groupcounter) elif case=='parameter': edecl=groupcache[groupcounter]['vars'] - ll=string.strip(m.group('after'))[1:-1] + ll=m.group('after').strip()[1:-1] last_name = None - for e in string.split(markoutercomma(ll),'@,@'): + for e in markoutercomma(ll).split('@,@'): try: - k,initexpr=map(string.strip,string.split(e,'=')) + k,initexpr=[x.strip() for x in e.split('=')] except: outmess('analyzeline: could not extract name,expr in parameter statement "%s" of "%s"\n'%(e,ll));continue params = get_parameters(edecl) @@ -942,7 +948,7 @@ for m in real16pattern.finditer(initexpr): tt[m.start():m.end()] = list(\ initexpr[m.start():m.end()].lower().replace('d', 'e')) - initexpr = "".join(tt) + initexpr = ''.join(tt) elif t.get('typespec')=='complex': initexpr = initexpr[1:].lower().replace('d','e').\ replace(',','+1j*(') @@ -961,7 +967,7 @@ if last_name is not None: previous_context = ('variable',last_name,groupcounter) elif case=='implicit': - if string.lower(string.strip(m.group('after')))=='none': + if m.group('after').strip().lower()=='none': groupcache[groupcounter]['implicit']=None elif m.group('after'): if groupcache[groupcounter].has_key('implicit'): @@ -970,7 +976,7 @@ if impl is None: outmess('analyzeline: Overwriting earlier "implicit none" statement.\n') impl={} - for e in string.split(markoutercomma(m.group('after')),'@,@'): + for e in markoutercomma(m.group('after')).split('@,@'): decl={} m1=re.match(r'\s*(?P.*?)\s*(\(\s*(?P[a-z-, ]+)\s*\)\s*|)\Z',e,re.I) if not m1: @@ -986,12 +992,12 @@ decl['typename']=typename for k in decl.keys(): if not decl[k]: del decl[k] - for r in string.split(markoutercomma(m1.group('after')),'@,@'): + for r in markoutercomma(m1.group('after')).split('@,@'): if '-' in r: - try: begc,endc=map(string.strip,string.split(r,'-')) + try: begc,endc=[x.strip() for x in r.split('-')] except: outmess('analyzeline: expected "-" instead of "%s" in range list of implicit statement\n'%r);continue - else: begc=endc=string.strip(r) + else: begc=endc=r.strip() if not len(begc)==len(endc)==1: outmess('analyzeline: expected "-" instead of "%s" in range list of implicit statement (2)\n'%r);continue for o in range(ord(begc),ord(endc)+1): @@ -1024,7 +1030,7 @@ vars=groupcache[groupcounter]['vars'] last_name = None for l in ll: - l=map(string.strip,l) + l=[x.strip() for x in l] if l[0][0]==',':l[0]=l[0][1:] if l[0][0]=='(': outmess('analyzeline: implied-DO list "%s" is not supported. Skipping.\n'%l[0]) @@ -1033,7 +1039,7 @@ # #outmess('analyzeline: ignoring this data statement.\n') # continue i=0;j=0;llen=len(l[1]) - for v in rmbadname(map(string.strip,string.split(markoutercomma(l[0]),'@,@'))): + for v in rmbadname([x.strip() for x in markoutercomma(l[0]).split('@,@')]): if v[0]=='(': outmess('analyzeline: implied-DO list "%s" is not supported. Skipping.\n'%v) # XXX: subsequent init expressions may get wrong values. @@ -1056,20 +1062,20 @@ if last_name is not None: previous_context = ('variable',last_name,groupcounter) elif case=='common': - line=string.strip(m.group('after')) + line=m.group('after').strip() if not line[0]=='/':line='//'+line cl=[] f=0;bn='';ol='' for c in line: if c=='/':f=f+1;continue if f>=3: - bn = string.strip(bn) + bn = bn.strip() if not bn: bn='_BLNK_' cl.append([bn,ol]) f=f-2;bn='';ol='' if f%2: bn=bn+c else: ol=ol+c - bn = string.strip(bn) + bn = bn.strip() if not bn: bn='_BLNK_' cl.append([bn,ol]) commonkey={} @@ -1080,7 +1086,7 @@ outmess('analyzeline: previously defined common block encountered. Skipping.\n') continue commonkey[c[0]]=[] - for i in map(string.strip,string.split(markoutercomma(c[1]),'@,@')): + for i in [x.strip() for x in markoutercomma(c[1]).split('@,@')]: if i: commonkey[c[0]].append(i) groupcache[groupcounter]['common']=commonkey previous_context = ('common',bn,groupcounter) @@ -1095,12 +1101,12 @@ if mm.has_key('list') and mm['list'] is not None: if mm.has_key('notonly') and mm['notonly'] is None:isonly=1 groupcache[groupcounter]['use'][name]['only']=isonly - ll=map(string.strip,string.split(mm['list'],',')) + ll=[x.strip() for x in mm['list'].split(',')] rl={} for l in ll: if '=' in l: m2=re.match(r'\A\s*(?P\b[\w]+\b)\s*=\s*>\s*(?P\b[\w]+\b)\s*\Z',l,re.I) - if m2: rl[string.strip(m2.group('local'))]=string.strip(m2.group('use')) + if m2: rl[m2.group('local').strip()]=m2.group('use').strip() else: outmess('analyzeline: Not local=>use pattern found in %s\n'%`l`) else: @@ -1151,7 +1157,7 @@ attr=None if re.match(r'double\s*complex',typespec,re.I): typespec='double complex' elif re.match(r'double\s*precision',typespec,re.I): typespec='double precision' - else: typespec=string.lower(string.strip(typespec)) + else: typespec=typespec.strip().lower() m1=selectpattern.match(markouterparen(ll)) if not m1: outmess('cracktypespec0: no kind/char_selector pattern found for line.\n') @@ -1161,9 +1167,9 @@ if typespec in ['complex','integer','logical','real','character','type']: selector=d['this'] ll=d['after'] - i=string.find(ll,'::') + i=ll.find('::') if i>=0: - attr=string.strip(ll[:i]) + attr=ll[:i].strip() ll=ll[i+2:] return typespec,selector,attr,ll ##### @@ -1173,7 +1179,7 @@ lenkindpattern=re.compile(r'\s*(kind\s*=\s*(?P.*?)\s*(@,@\s*len\s*=\s*(?P.*)|)|(len\s*=\s*|)(?P.*?)\s*(@,@\s*(kind\s*=\s*|)(?P.*)|))\s*\Z',re.I) lenarraypattern=re.compile(r'\s*(@\(@\s*(?!/)\s*(?P.*?)\s*@\)@\s*[*]\s*(?P.*?)|([*]\s*(?P.*?)|)\s*(@\(@\s*(?!/)\s*(?P.*?)\s*@\)@|))\s*(=\s*(?P.*?)|(@\(@|)/\s*(?P.*?)\s*/(@\)@|)|)\s*\Z',re.I) def removespaces(expr): - expr=string.strip(expr) + expr=expr.strip() if len(expr)<=1: return expr expr2=expr[0] for i in range(1,len(expr)-1): @@ -1203,21 +1209,21 @@ last_name = None kindselect,charselect,typename=cracktypespec(typespec,selector) if attrspec: - attrspec=map(string.strip,string.split(markoutercomma(attrspec),'@,@')) + attrspec=[x.strip() for x in markoutercomma(attrspec).split('@,@')] l = [] c = re.compile(r'(?P[a-zA-Z]+)') for a in attrspec: m = c.match(a) if m: - s = string.lower(m.group('start')) + s = m.group('start').lower() a = s + a[len(s):] l.append(a) attrspec = l - el=map(string.strip,string.split(markoutercomma(entitydecl),'@,@')) + el=[x.strip() for x in markoutercomma(entitydecl).split('@,@')] el1=[] for e in el: - for e1 in map(string.strip,string.split(markoutercomma(removespaces(markinnerspaces(e)),comma=' '),'@ @')): - if e1: el1.append(string.replace(e1,'@_@',' ')) + for e1 in [x.strip() for x in markoutercomma(removespaces(markinnerspaces(e)),comma=' ').split('@ @')]: + if e1: el1.append(e1.replace('@_@',' ')) for e in el1: m=namepattern.match(e) if not m: @@ -1430,7 +1436,7 @@ if not usedict: return param_map for usename,mapping in usedict.items(): - usename = string.lower(usename) + usename = usename.lower() if not f90modulevars.has_key(usename): continue mvars = f90modulevars[usename] @@ -1594,7 +1600,7 @@ if i>n: errmess('sortvarnames: failed to compute dependencies because' ' of cyclic dependencies between ' - +string.join(dep,', ')+'\n') + +', '.join(dep)+'\n') indep = indep + dep break else: @@ -1615,16 +1621,16 @@ if m: dims=[] if m.group('dims'): - dims=map(string.strip,string.split(markoutercomma(m.group('dims')),'@,@')) - n=string.strip(m.group('name')) + dims=[x.strip() for x in markoutercomma(m.group('dims')).split('@,@')] + n=m.group('name').strip() if block['vars'].has_key(n): if block['vars'][n].has_key('attrspec'): - block['vars'][n]['attrspec'].append('dimension(%s)'%(string.join(dims,','))) + block['vars'][n]['attrspec'].append('dimension(%s)'%(','.join(dims))) else: - block['vars'][n]['attrspec']=['dimension(%s)'%(string.join(dims,','))] + block['vars'][n]['attrspec']=['dimension(%s)'%(','.join(dims))] else: if dims: - block['vars'][n]={'attrspec':['dimension(%s)'%(string.join(dims,','))]} + block['vars'][n]={'attrspec':['dimension(%s)'%(','.join(dims))]} else: block['vars'][n]={} if n not in commonvars: commonvars.append(n) else: @@ -1657,7 +1663,7 @@ if b['block']=='interface' and not b['body']: if not b.has_key('f2pyenhancements'): continue - if string.replace(b['block'],' ','')=='pythonmodule': + if b['block'].replace(' ','')=='pythonmodule': usermodules.append(b) else: if b['block']=='module': @@ -1926,7 +1932,7 @@ for m in real16pattern.finditer(v): tt[m.start():m.end()] = list(\ v[m.start():m.end()].lower().replace('d', 'e')) - v = string.join(tt,'') + v = ''.join(tt) if iscomplex(vars[n]): if v[0]=='(' and v[-1]==')': l = markoutercomma(v[1:-1]).split('@,@') @@ -1939,7 +1945,7 @@ outmess('get_parameters: got "%s" on %s\n' % (msg,`v`)) if isstring(vars[n]) and type(params[n]) is type(0): params[n] = chr(params[n]) - nl = string.lower(n) + nl = n.lower() if nl!=n: params[nl] = params[n] else: @@ -2011,7 +2017,7 @@ if not vars[n].has_key('typespec'): if not(vars[n].has_key('attrspec') and 'external' in vars[n]['attrspec']): if implicitrules: - ln0 = string.lower(n[0]) + ln0 = n[0].lower() for k in implicitrules[ln0].keys(): if k=='typespec' and implicitrules[ln0][k]=='undefined': continue @@ -2048,39 +2054,39 @@ vars[n]['attrspec']=[] dim,intent,depend,check,note=None,None,None,None,None for a in attr: - if a[:9]=='dimension': dim=(string.strip(a[9:]))[1:-1] - elif a[:6]=='intent': intent=(string.strip(a[6:]))[1:-1] - elif a[:6]=='depend': depend=(string.strip(a[6:]))[1:-1] - elif a[:5]=='check': check=(string.strip(a[5:]))[1:-1] - elif a[:4]=='note': note=(string.strip(a[4:]))[1:-1] + if a[:9]=='dimension': dim=(a[9:].strip())[1:-1] + elif a[:6]=='intent': intent=(a[6:].strip())[1:-1] + elif a[:6]=='depend': depend=(a[6:].strip())[1:-1] + elif a[:5]=='check': check=(a[5:].strip())[1:-1] + elif a[:4]=='note': note=(a[4:].strip())[1:-1] else: vars[n]=setattrspec(vars[n],a) if intent: if not vars[n].has_key('intent'): vars[n]['intent']=[] - for c in map(string.strip,string.split(markoutercomma(intent),'@,@')): + for c in [x.strip() for x in markoutercomma(intent).split('@,@')]: if not c in vars[n]['intent']: vars[n]['intent'].append(c) intent=None if note: - note=string.replace(note,'\\n\\n','\n\n') - note=string.replace(note,'\\n ','\n') + note=note.replace('\\n\\n','\n\n') + note=note.replace('\\n ','\n') if not vars[n].has_key('note'): vars[n]['note']=[note] else: vars[n]['note'].append(note) note=None if depend is not None: if not vars[n].has_key('depend'): vars[n]['depend']=[] - for c in rmbadname(map(string.strip,string.split(markoutercomma(depend),'@,@'))): + for c in rmbadname([x.strip() for x in markoutercomma(depend).split('@,@')]): if c not in vars[n]['depend']: vars[n]['depend'].append(c) depend=None if check is not None: if not vars[n].has_key('check'): vars[n]['check']=[] - for c in map(string.strip,string.split(markoutercomma(check),'@,@')): + for c in [x.strip() for x in markoutercomma(check).split('@,@')]: if not c in vars[n]['check']: vars[n]['check'].append(c) check=None if dim and not vars[n].has_key('dimension'): vars[n]['dimension']=[] - for d in rmbadname(map(string.strip,string.split(markoutercomma(dim),'@,@'))): + for d in rmbadname([x.strip() for x in markoutercomma(dim).split('@,@')]): star = '*' if d==':': star=':' if params.has_key(d): @@ -2093,7 +2099,7 @@ if d==star: dl = [star] else: - dl=string.split(markoutercomma(d,':'),'@:@') + dl=markoutercomma(d,':').split('@:@') if len(dl)==2 and '*' in dl: # e.g. dimension(5:*) dl = ['*'] d = '*' @@ -2153,7 +2159,7 @@ if vars[d].has_key('attrspec'): for aa in vars[d]['attrspec']: if aa[:6]=='depend': - ddeps=ddeps+string.split((string.strip(aa[6:]))[1:-1],',') + ddeps += aa[6:].strip()[1:-1].split(',') if vars[d].has_key('depend'): ddeps=ddeps+vars[d]['depend'] i=i+1 @@ -2223,9 +2229,9 @@ vars[n]=appenddecl(vars[n],vars[block['result']]) if block.has_key('prefix'): pr=block['prefix']; ispure=0; isrec=1 - pr1=string.replace(pr,'pure','') + pr1=pr.replace('pure','') ispure=(not pr==pr1) - pr=string.replace(pr1,'recursive','') + pr=pr1.replace('recursive','') isrec=(not pr==pr1) m=typespattern[0].match(pr) if m: @@ -2332,7 +2338,7 @@ def determineexprtype(expr,vars,rules={}): if vars.has_key(expr): return _ensure_exprdict(vars[expr]) - expr=string.strip(expr) + expr=expr.strip() if determineexprtype_re_1.match(expr): return {'typespec':'complex'} m=determineexprtype_re_2.match(expr) @@ -2346,7 +2352,7 @@ outmess('determineexprtype: selected kind types not supported (%s)\n'%`expr`) return {'typespec':'real'} for op in ['+','-','*','/']: - for e in map(string.strip,string.split(markoutercomma(expr,comma=op),'@'+op+'@')): + for e in [x.strip() for x in markoutercomma(expr,comma=op).split('@'+op+'@')]: if vars.has_key(e): return _ensure_exprdict(vars[e]) t={} @@ -2391,7 +2397,7 @@ vars = block['vars'] al = [a for a in block['args'] if not isintent_callback(vars[a])] if block['block']=='function' or al: - args='(%s)'%string.join(al,',') + args='(%s)'%','.join(al) f2pyenhancements = '' if block.has_key('f2pyenhancements'): for k in block['f2pyenhancements'].keys(): @@ -2402,7 +2408,7 @@ if intent_lst: f2pyenhancements = '%s%sintent(%s) %s'%\ (f2pyenhancements,tab+tabchar, - string.join(intent_lst,','),name) + ','.join(intent_lst),name) use='' if block.has_key('use'): use=use2fortran(block['use'],tab+tabchar) @@ -2425,7 +2431,7 @@ entry_stmts = '' for k,i in block['entry'].items(): entry_stmts = '%s%sentry %s(%s)' \ - % (entry_stmts,tab+tabchar,k,string.join(i,',')) + % (entry_stmts,tab+tabchar,k,','.join(i)) body = body + entry_stmts if blocktype=='block data' and name=='_BLOCK_DATA_': name = '' @@ -2435,9 +2441,9 @@ ret='' for k in common.keys(): if k=='_BLNK_': - ret='%s%scommon %s'%(ret,tab,string.join(common[k],',')) + ret='%s%scommon %s'%(ret,tab,','.join(common[k])) else: - ret='%s%scommon /%s/ %s'%(ret,tab,k,string.join(common[k],',')) + ret='%s%scommon /%s/ %s'%(ret,tab,k,','.join(common[k])) return ret def use2fortran(use,tab=''): ret='' @@ -2546,23 +2552,23 @@ if l not in ['external']: attr.append(l) if attr: - vardef='%s %s'%(vardef,string.join(attr,',')) + vardef='%s %s'%(vardef,','.join(attr)) c=',' if vars[a].has_key('dimension'): # if not isintent_c(vars[a]): # vars[a]['dimension'].reverse() - vardef='%s%sdimension(%s)'%(vardef,c,string.join(vars[a]['dimension'],',')) + vardef='%s%sdimension(%s)'%(vardef,c,','.join(vars[a]['dimension'])) c=',' if vars[a].has_key('intent'): lst = true_intent_list(vars[a]) if lst: - vardef='%s%sintent(%s)'%(vardef,c,string.join(lst,',')) + vardef='%s%sintent(%s)'%(vardef,c,','.join(lst)) c=',' if vars[a].has_key('check'): - vardef='%s%scheck(%s)'%(vardef,c,string.join(vars[a]['check'],',')) + vardef='%s%scheck(%s)'%(vardef,c,','.join(vars[a]['check'])) c=',' if vars[a].has_key('depend'): - vardef='%s%sdepend(%s)'%(vardef,c,string.join(vars[a]['depend'],',')) + vardef='%s%sdepend(%s)'%(vardef,c,','.join(vars[a]['depend'])) c=',' if vars[a].has_key('='): v = vars[a]['='] Modified: trunk/numpy/f2py/doc/collectinput.py =================================================================== --- trunk/numpy/f2py/doc/collectinput.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/doc/collectinput.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -22,7 +22,11 @@ __version__ = "0.0" stdoutflag=0 -import sys,os,string,fileinput,re,commands +import sys +import os +import fileinput +import re +import commands try: fn=sys.argv[2] except: @@ -46,7 +50,7 @@ l=l[:m.end()-1] m=input.match(l) if m: - l=string.strip(l) + l=l.strip() if l[-1]=='}': l=l[:-1] i=m.end()-2 sys.stderr.write('>>>>>>') Modified: trunk/numpy/f2py/f2py2e.py =================================================================== --- trunk/numpy/f2py/f2py2e.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/f2py2e.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -18,7 +18,12 @@ import __version__ f2py_version = __version__.version -import sys,os,string,pprint,shutil,types,re +import sys +import os +import pprint +import shutil +import types +import re errmess=sys.stderr.write #outmess=sys.stdout.write show=pprint.pprint @@ -301,7 +306,7 @@ ret = {} for i in range(len(mnames)): if isusedby.has_key(mnames[i]): - outmess('\tSkipping module "%s" which is used by %s.\n'%(mnames[i],string.join(map(lambda s:'"%s"'%s,isusedby[mnames[i]]),','))) + outmess('\tSkipping module "%s" which is used by %s.\n'%(mnames[i],','.join(map(lambda s:'"%s"'%s,isusedby[mnames[i]])))) else: um=[] if modules[i].has_key('use'): @@ -341,10 +346,10 @@ if not isusedby.has_key(u): isusedby[u]=[] isusedby[u].append(postlist[i]['name']) for i in range(len(postlist)): - if postlist[i]['block']=='python module' and string.find(postlist[i]['name'],'__user__')<0: + if postlist[i]['block']=='python module' and '__user__' in postlist[i]['name']: if isusedby.has_key(postlist[i]['name']): #if not quiet: - outmess('Skipping Makefile build for module "%s" which is used by %s\n'%(postlist[i]['name'],string.join(map(lambda s:'"%s"'%s,isusedby[postlist[i]['name']]),','))) + outmess('Skipping Makefile build for module "%s" which is used by %s\n'%(postlist[i]['name'],','.join(map(lambda s:'"%s"'%s,isusedby[postlist[i]['name']])))) if options.has_key('signsfile'): if options['verbose']>1: outmess('Stopping. Edit the signature file and then run f2py on the signature file: ') @@ -375,7 +380,7 @@ ind = len(prefix) else: ind = 0 - for file in map(string.strip,files): + for file in [x.strip() for x in files]: if match(file): filtered.append(file[ind:]) else: rest.append(file) return filtered,rest @@ -485,7 +490,7 @@ using_numarray = 0 using_numeric = 0 for i in range(len(define_macros)): - name_value = string.split(define_macros[i],'=',1) + name_value = define_macros[i].split('=',1) if len(name_value)==1: name_value.append(None) if len(name_value)==2: Modified: trunk/numpy/f2py/f90mod_rules.py =================================================================== --- trunk/numpy/f2py/f90mod_rules.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/f90mod_rules.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -18,7 +18,10 @@ f2py_version='See `f2py -v`' import pprint -import sys,string,time,types,copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -107,7 +110,7 @@ mfargs.append(n) outmess('\t\tConstructing F90 module support for "%s"...\n'%(m['name'])) if onlyvars: - outmess('\t\t Variables: %s\n'%(string.join(onlyvars))) + outmess('\t\t Variables: %s\n'%(' '.join(onlyvars))) chooks=[''] def cadd(line,s=chooks): s[0] = '%s\n%s'%(s[0],line) ihooks=[''] @@ -118,7 +121,7 @@ dadd('\\subsection{Fortran 90/95 module \\texttt{%s}}\n'%(m['name'])) if hasnote(m): note = m['note'] - if type(note) is type([]): note=string.join(note,'\n') + if type(note) is type([]): note='\n'.join(note) dadd(note) if onlyvars: dadd('\\begin{description}') @@ -128,8 +131,8 @@ ct = capi_maps.getctype(var) at = capi_maps.c2capi_map[ct] dm = capi_maps.getarrdims(n,var) - dms = string.strip(string.replace(dm['dims'],'*','-1')) - dms = string.strip(string.replace(dms,':','-1')) + dms = dm['dims'].replace('*','-1').strip() + dms = dms.replace(':','-1').strip() if not dms: dms='-1' use_fgetdims2 = fgetdims2 if isstringarray(var): @@ -144,7 +147,7 @@ dadd('\\item[]{{}\\verb@%s@{}}'%(capi_maps.getarrdocsign(n,var))) if hasnote(var): note = var['note'] - if type(note) is type([]): note=string.join(note,'\n') + if type(note) is type([]): note='\n'.join(note) dadd('--- %s'%(note)) if isallocatable(var): fargs.append('f2py_%s_getdims_%s'%(m['name'],n)) @@ -157,7 +160,7 @@ fadd('integer flag\n') fhooks[0]=fhooks[0]+fgetdims1 dms = eval('range(1,%s+1)'%(dm['rank'])) - fadd(' allocate(d(%s))\n'%(string.join(map(lambda i:'s(%s)'%i,dms),','))) + fadd(' allocate(d(%s))\n'%(','.join(map(lambda i:'s(%s)'%i,dms)))) fhooks[0]=fhooks[0]+use_fgetdims2 fadd('end subroutine %s'%(fargs[-1])) else: @@ -197,16 +200,16 @@ iadd('\tf2py_%s_def[i_f2py++].data = %s;'%(m['name'],b['name'])) cadd('\t{NULL}\n};\n') iadd('}') - ihooks[0]='static void f2py_setup_%s(%s) {\n\tint i_f2py=0;%s'%(m['name'],string.join(sargs,','),ihooks[0]) + ihooks[0]='static void f2py_setup_%s(%s) {\n\tint i_f2py=0;%s'%(m['name'],','.join(sargs),ihooks[0]) if '_' in m['name']: F_FUNC='F_FUNC_US' else: F_FUNC='F_FUNC' iadd('extern void %s(f2pyinit%s,F2PYINIT%s)(void (*)(%s));'\ - %(F_FUNC,m['name'],string.upper(m['name']),string.join(sargsp,','))) + %(F_FUNC,m['name'],m['name'].upper(),','.join(sargsp))) iadd('static void f2py_init_%s(void) {'%(m['name'])) iadd('\t%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);'\ - %(F_FUNC,m['name'],string.upper(m['name']),m['name'])) + %(F_FUNC,m['name'],m['name'].upper(),m['name'])) iadd('}\n') ret['f90modhooks']=ret['f90modhooks']+chooks+ihooks ret['initf90modhooks']=['\tPyDict_SetItemString(d, "%s", PyFortranObject_New(f2py_%s_def,f2py_init_%s));'%(m['name'],m['name'],m['name'])]+ret['initf90modhooks'] @@ -217,20 +220,20 @@ for a in undo_rmbadname(mfargs): fadd('use %s, only : %s'%(m['name'],a)) if ifargs: - fadd(string.join(['interface']+ifargs)) + fadd(' '.join(['interface']+ifargs)) fadd('end interface') fadd('external f2pysetupfunc') if efargs: for a in undo_rmbadname(efargs): fadd('external %s'%(a)) - fadd('call f2pysetupfunc(%s)'%(string.join(undo_rmbadname(fargs),','))) + fadd('call f2pysetupfunc(%s)'%(','.join(undo_rmbadname(fargs)))) fadd('end subroutine f2pyinit%s\n'%(m['name'])) - dadd(string.replace(string.join(ret['latexdoc'],'\n'),r'\subsection{',r'\subsubsection{')) + dadd('\n'.join(ret['latexdoc']).replace(r'\subsection{',r'\subsubsection{')) ret['latexdoc']=[] ret['docs'].append('"\t%s --- %s"'%(m['name'], - string.join(undo_rmbadname(modobjs),','))) + ','.join(undo_rmbadname(modobjs)))) ret['routine_defs']='' ret['doc']=[] Modified: trunk/numpy/f2py/func2subr.py =================================================================== --- trunk/numpy/f2py/func2subr.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/func2subr.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -17,8 +17,12 @@ f2py_version='See `f2py -v`' -import pprint,copy -import sys,string,time,types,copy +import pprint +import copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -69,7 +73,7 @@ vardef='%s %s'%(vardef,fa) if vars[a].has_key('dimension'): - vardef='%s(%s)'%(vardef,string.join(vars[a]['dimension'],',')) + vardef='%s(%s)'%(vardef,','.join(vars[a]['dimension'])) return vardef def createfuncwrapper(rout,signature=0): @@ -98,12 +102,12 @@ if charselect.get('*','')=='(*)': charselect['*'] = '10' if f90mode: - sargs = string.join(args,', ') + sargs = ', '.join(args) add('subroutine f2pywrap_%s_%s (%s)'%(rout['modulename'],name,sargs)) if not signature: add('use %s, only : %s'%(rout['modulename'],fortranname)) else: - add('subroutine f2pywrap%s (%s)'%(name,string.join(args,', '))) + add('subroutine f2pywrap%s (%s)'%(name,', '.join(args))) add('external %s'%(fortranname)) #if not return_char_star: l = l + ', '+fortranname @@ -126,9 +130,9 @@ if not signature: if islogicalfunction(rout): - add('%s = .not.(.not.%s(%s))'%(newname,fortranname,string.join(args,', '))) + add('%s = .not.(.not.%s(%s))'%(newname,fortranname,', '.join(args))) else: - add('%s = %s(%s)'%(newname,fortranname,string.join(args,', '))) + add('%s = %s(%s)'%(newname,fortranname,', '.join(args))) if f90mode: add('end subroutine f2pywrap_%s_%s'%(rout['modulename'],name)) else: Modified: trunk/numpy/f2py/rules.py =================================================================== --- trunk/numpy/f2py/rules.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/rules.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -57,7 +57,10 @@ f2py_version = __version__.version import pprint -import sys,string,time,types,copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -1166,7 +1169,7 @@ fn = os.path.join(options['buildpath'],vrd['modulename']+'module.c') ret['csrc'] = fn f=open(fn,'w') - f.write(string.replace(ar['modulebody'],'\t',2*' ')) + f.write(ar['modulebody'].replace('\t',2*' ')) f.close() outmess('\tWrote C/API module "%s" to file "%s/%smodule.c"\n'%(m['name'],options['buildpath'],vrd['modulename'])) @@ -1174,7 +1177,7 @@ fn = os.path.join(options['buildpath'],vrd['modulename']+'module.rest') f=open(fn,'w') f.write('.. -*- rest -*-\n') - f.write(string.join(ar['restdoc'],'\n')) + f.write('\n'.join(ar['restdoc'])) f.close() outmess('\tReST Documentation is saved to file "%s/%smodule.rest"\n'%(options['buildpath'],vrd['modulename'])) if options['dolatexdoc']: @@ -1184,7 +1187,7 @@ f.write('%% This file is auto-generated with f2py (version:%s)\n'%(f2py_version)) if not options.has_key('shortlatex'): f.write('\\documentclass{article}\n\\usepackage{a4wide}\n\\begin{document}\n\\tableofcontents\n\n') - f.write(string.join(ar['latexdoc'],'\n')) + f.write('\n'.join(ar['latexdoc'])) if not options.has_key('shortlatex'): f.write('\\end{document}') f.close() @@ -1197,14 +1200,14 @@ f.write('C This file is autogenerated with f2py (version:%s)\n'%(f2py_version)) f.write('C It contains Fortran 77 wrappers to fortran functions.\n') lines = [] - for l in string.split(string.join(funcwrappers,'\n\n')+'\n','\n'): + for l in '\n\n'.join(funcwrappers)+'\n'.split('\n'): if l and l[0]==' ': while len(l)>=66: lines.append(l[:66]+'\n &') l = l[66:] lines.append(l+'\n') else: lines.append(l+'\n') - lines = string.join(lines,'').replace('\n &\n','\n') + lines = ''.join(lines).replace('\n &\n','\n') f.write(lines) f.close() outmess('\tFortran 77 wrappers are saved to "%s"\n'%(wn)) @@ -1216,7 +1219,7 @@ f.write('! This file is autogenerated with f2py (version:%s)\n'%(f2py_version)) f.write('! It contains Fortran 90 wrappers to fortran functions.\n') lines = [] - for l in string.split(string.join(funcwrappers2,'\n\n')+'\n','\n'): + for l in '\n\n'.join(funcwrappers2)+'\n'.split('\n'): if len(l)>72 and l[0]==' ': lines.append(l[:72]+'&\n &') l = l[72:] @@ -1225,7 +1228,7 @@ l = l[66:] lines.append(l+'\n') else: lines.append(l+'\n') - lines = string.join(lines,'').replace('\n &\n','\n') + lines = ''.join(lines).replace('\n &\n','\n') f.write(lines) f.close() outmess('\tFortran 90 wrappers are saved to "%s"\n'%(wn)) @@ -1313,8 +1316,8 @@ {'docsign':rd['docsign'], 'docsignopt':optargs, }) - rd['latexdocsignatureshort']=string.replace(rd['docsignatureshort'],'_','\\_') - rd['latexdocsignatureshort']=string.replace(rd['latexdocsignatureshort'],',',', ') + rd['latexdocsignatureshort']=rd['docsignatureshort'].replace('_','\\_') + rd['latexdocsignatureshort']=rd['latexdocsignatureshort'].replace(',',', ') cfs=stripcomma(replace('#callfortran##callfortranappend#',{'callfortran':rd['callfortran'],'callfortranappend':rd['callfortranappend']})) if len(rd['callfortranappend'])>1: rd['callcompaqfortran']=stripcomma(replace('#callfortran# 0,#callfortranappend#',{'callfortran':rd['callfortran'],'callfortranappend':rd['callfortranappend']})) Modified: trunk/numpy/f2py/tests/mixed/run.py =================================================================== --- trunk/numpy/f2py/tests/mixed/run.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/tests/mixed/run.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -8,7 +8,6 @@ import os import sys -import string import f2py2e from Numeric import array @@ -19,7 +18,7 @@ d,b=os.path.split(sys.argv[0]) files = ['foo.f','foo_fixed.f90','foo_free.f90'] files = [os.path.join(d,f) for f in files] - files = string.join(files) + files = ' '.join(files) args = ' -c -m mixed_f77_f90 %s %s'%(files,f2py_opts) c = '%s -c "import f2py2e;f2py2e.main()" %s' %(sys.executable,args) s = os.system(c) Modified: trunk/numpy/f2py/use_rules.py =================================================================== --- trunk/numpy/f2py/use_rules.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/f2py/use_rules.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -20,7 +20,10 @@ f2py_version='See `f2py -v`' import pprint -import sys,string,time,types,copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -88,10 +91,10 @@ ret={} vrd={'name':name, 'realname':realname, - 'REALNAME':string.upper(realname), + 'REALNAME':realname.upper(), 'usemodulename':usemodulename, - 'USEMODULENAME':string.upper(usemodulename), - 'texname':string.replace(name,'_','\\_'), + 'USEMODULENAME':usemodulename.upper(), + 'texname':name.replace('_','\\_'), 'begintitle':gentitle('%s=>%s'%(name,realname)), 'endtitle':gentitle('end of %s=>%s'%(name,realname)), 'apiname':'#modulename#_use_%s_from_%s'%(realname,usemodulename) @@ -99,7 +102,7 @@ nummap={0:'Ro',1:'Ri',2:'Rii',3:'Riii',4:'Riv',5:'Rv',6:'Rvi',7:'Rvii',8:'Rviii',9:'Rix'} vrd['texnamename']=name for i in nummap.keys(): - vrd['texnamename']=string.replace(vrd['texnamename'],`i`,nummap[i]) + vrd['texnamename']=vrd['texnamename'].replace(`i`,nummap[i]) if hasnote(vars[realname]): vrd['note']=vars[realname]['note'] rd=dictappend({},vrd) var=vars[realname] Modified: trunk/numpy/oldnumeric/matrix.py =================================================================== --- trunk/numpy/oldnumeric/matrix.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/oldnumeric/matrix.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -2,7 +2,6 @@ __all__ = ['UserArray', 'squeeze', 'Matrix', 'asarray', 'dot', 'k', 'Numeric', 'LinearAlgebra', 'identity', 'multiply', 'types', 'string'] -import string import types from user_array import UserArray, asarray import numpy.oldnumeric as Numeric @@ -17,7 +16,7 @@ _table[k] = chr(k) _table = ''.join(_table) -_numchars = string.digits + ".-+jeEL" +_numchars = '0123456789.-+jeEL' _todelete = [] for k in _table: if k not in _numchars: Modified: trunk/numpy/oldnumeric/precision.py =================================================================== --- trunk/numpy/oldnumeric/precision.py 2007-10-29 11:09:37 UTC (rev 4329) +++ trunk/numpy/oldnumeric/precision.py 2007-10-29 14:37:37 UTC (rev 4330) @@ -7,8 +7,8 @@ 'PrecisionError', 'PyObject', 'Int', 'UInt', 'UnsignedInteger', 'string', 'typecodes', 'zeros'] -import string from functions import zeros +import string # for backwards compatibility typecodes = {'Character':'c', 'Integer':'bhil', 'UnsignedInteger':'BHI', 'Float':'fd', 'Complex':'FD'} From numpy-svn at scipy.org Mon Oct 29 10:43:52 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 09:43:52 -0500 (CDT) Subject: [Numpy-svn] r4331 - trunk/numpy Message-ID: <20071029144352.1A2F639C053@new.scipy.org> Author: jarrod.millman Date: 2007-10-29 09:43:48 -0500 (Mon, 29 Oct 2007) New Revision: 4331 Modified: trunk/numpy/matlib.py Log: typo Modified: trunk/numpy/matlib.py =================================================================== --- trunk/numpy/matlib.py 2007-10-29 14:37:37 UTC (rev 4330) +++ trunk/numpy/matlib.py 2007-10-29 14:43:48 UTC (rev 4331) @@ -40,7 +40,7 @@ def rand(*args): if isinstance(args[0], tuple): - args = args[0] + args = args[0] return asmatrix(N.random.rand(*args)) def randn(*args): From numpy-svn at scipy.org Mon Oct 29 10:58:54 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 09:58:54 -0500 (CDT) Subject: [Numpy-svn] r4332 - in trunk: . numpy numpy/core numpy/core/tests numpy/distutils numpy/distutils/command numpy/distutils/fcompiler numpy/doc numpy/f2py numpy/f2py/lib numpy/f2py/lib/extgen numpy/f2py/lib/tests numpy/lib numpy/lib/tests numpy/linalg/lapack_lite numpy/numarray numpy/oldnumeric numpy/testing Message-ID: <20071029145854.1947839C10C@new.scipy.org> Author: jarrod.millman Date: 2007-10-29 09:58:18 -0500 (Mon, 29 Oct 2007) New Revision: 4332 Modified: trunk/numpy/core/memmap.py trunk/numpy/core/numeric.py trunk/numpy/core/records.py trunk/numpy/core/setup.py trunk/numpy/core/tests/test_numeric.py trunk/numpy/distutils/ccompiler.py trunk/numpy/distutils/command/build_src.py trunk/numpy/distutils/command/config.py trunk/numpy/distutils/core.py trunk/numpy/distutils/fcompiler/__init__.py trunk/numpy/distutils/misc_util.py trunk/numpy/distutils/system_info.py trunk/numpy/doc/example.py trunk/numpy/f2py/cb_rules.py trunk/numpy/f2py/lib/extgen/base.py trunk/numpy/f2py/lib/extgen/c_support.py trunk/numpy/f2py/lib/extgen/py_support.py trunk/numpy/f2py/lib/extgen/setup_py.py trunk/numpy/f2py/lib/extgen/utils.py trunk/numpy/f2py/lib/main.py trunk/numpy/f2py/lib/py_wrap_type.py trunk/numpy/f2py/lib/tests/test_module_module.py trunk/numpy/lib/function_base.py trunk/numpy/lib/index_tricks.py trunk/numpy/lib/shape_base.py trunk/numpy/lib/tests/test_shape_base.py trunk/numpy/lib/twodim_base.py trunk/numpy/lib/type_check.py trunk/numpy/lib/utils.py trunk/numpy/linalg/lapack_lite/clapack_scrub.py trunk/numpy/matlib.py trunk/numpy/numarray/image.py trunk/numpy/numarray/matrix.py trunk/numpy/numarray/numerictypes.py trunk/numpy/oldnumeric/arrayfns.py trunk/numpy/oldnumeric/ma.py trunk/numpy/oldnumeric/random_array.py trunk/numpy/testing/numpytest.py trunk/setup.py Log: ran reindent.py to clean up whitespace Modified: trunk/numpy/core/memmap.py =================================================================== --- trunk/numpy/core/memmap.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/core/memmap.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -100,5 +100,4 @@ try: self.close() except ValueError: - pass - + pass Modified: trunk/numpy/core/numeric.py =================================================================== --- trunk/numpy/core/numeric.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/core/numeric.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -658,8 +658,8 @@ dtype - the data-type of the resulting array. If this is a record data-type, the the resulting array will be 1-d and each row will be interpreted as an element of the array. The number of columns - used must match the number of fields in the data-type in this case. - + used must match the number of fields in the data-type in this case. + comments - the character used to indicate the start of a comment in the file @@ -699,21 +699,21 @@ dtype = multiarray.dtype(dtype) defconv = _getconv(dtype) - converterseq = None + converterseq = None if converters is None: converters = {} if dtype.names is not None: converterseq = [_getconv(dtype.fields[name][0]) \ for name in dtype.names] - + for i,line in enumerate(fh): if i>> seterr(over='raise') # doctest: +SKIP {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'} - + >>> seterr(all='warn', over='raise') # doctest: +SKIP {'over': 'raise', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'} - + >>> int16(32000) * int16(3) # doctest: +SKIP Traceback (most recent call last): File "", line 1, in ? Modified: trunk/numpy/core/records.py =================================================================== --- trunk/numpy/core/records.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/core/records.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -375,7 +375,7 @@ >>> r.col1 array([456, 2]) >>> r.col2 - chararray(['dbe', 'de'], + chararray(['dbe', 'de'], dtype='|S3') >>> import cPickle >>> print cPickle.loads(cPickle.dumps(r)) Modified: trunk/numpy/core/setup.py =================================================================== --- trunk/numpy/core/setup.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/core/setup.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -345,4 +345,3 @@ if __name__=='__main__': from numpy.distutils.core import setup setup(configuration=configuration) - Modified: trunk/numpy/core/tests/test_numeric.py =================================================================== --- trunk/numpy/core/tests/test_numeric.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/core/tests/test_numeric.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -275,13 +275,13 @@ # use slow-clip selector = less(a, m)+2*greater(a, M) return selector.choose((a, m, M), out=out) - + # Handy functions def _generate_data(self, n, m): return randn(n, m) def _generate_data_complex(self, n, m): - return randn(n, m) + 1.j *rand(n, m) + return randn(n, m) + 1.j *rand(n, m) def _generate_flt_data(self, n, m): return (randn(n, m)).astype(float32) @@ -320,7 +320,7 @@ def test_simple_int(self): """Test native int input with scalar min/max.""" a = self._generate_int_data(self.nr, self.nc) - a = a.astype(int) + a = a.astype(int) m = -2 M = 4 ac = self.fastclip(a, m, M) @@ -484,7 +484,7 @@ def test_type_cast_02(self): "Test native int32 input with int32 scalar min/max." a = self._generate_int_data(self.nr, self.nc) - a = a.astype(int32) + a = a.astype(int32) m = -2 M = 4 ac = self.fastclip(a, m, M) @@ -507,7 +507,7 @@ M = float32(4) act = self.fastclip(a,m,M) ac = self.clip(a,m,M) - assert_array_strict_equal(ac, act) + assert_array_strict_equal(ac, act) def test_type_cast_04(self): "Test native int32 with double arrays min/max." Modified: trunk/numpy/distutils/ccompiler.py =================================================================== --- trunk/numpy/distutils/ccompiler.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/distutils/ccompiler.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -217,7 +217,7 @@ + self.compiler[1:] else: if hasattr(self,'compiler'): - log.warn("#### %s #######" % (self.compiler,)) + log.warn("#### %s #######" % (self.compiler,)) log.warn('Missing compiler_cxx fix for '+self.__class__.__name__) return Modified: trunk/numpy/distutils/command/build_src.py =================================================================== --- trunk/numpy/distutils/command/build_src.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/distutils/command/build_src.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -116,7 +116,7 @@ self.swig_cpp = build_ext.swig_cpp for c in ['swig','swig_opt']: o = '--'+c.replace('_','-') - v = getattr(build_ext,c,None) + v = getattr(build_ext,c,None) if v: if getattr(self,c): log.warn('both build_src and build_ext define %s option' % (o)) Modified: trunk/numpy/distutils/command/config.py =================================================================== --- trunk/numpy/distutils/command/config.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/distutils/command/config.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -156,4 +156,3 @@ self._clean() return exitcode, output - Modified: trunk/numpy/distutils/core.py =================================================================== --- trunk/numpy/distutils/core.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/distutils/core.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -98,23 +98,23 @@ dist = distutils.dist.Distribution() return dist -def _exit_interactive_session(_cache=[]): - if _cache: - return # been here - _cache.append(1) - print '-'*72 - raw_input('Press ENTER to close the interactive session..') - print '='*72 +def _exit_interactive_session(_cache=[]): + if _cache: + return # been here + _cache.append(1) + print '-'*72 + raw_input('Press ENTER to close the interactive session..') + print '='*72 def setup(**attr): - if len(sys.argv)<=1 and not attr.get('script_args',[]): - from interactive import interactive_sys_argv - import atexit - atexit.register(_exit_interactive_session) - sys.argv[:] = interactive_sys_argv(sys.argv) - if len(sys.argv)>1: - return setup(**attr) + if len(sys.argv)<=1 and not attr.get('script_args',[]): + from interactive import interactive_sys_argv + import atexit + atexit.register(_exit_interactive_session) + sys.argv[:] = interactive_sys_argv(sys.argv) + if len(sys.argv)>1: + return setup(**attr) cmdclass = numpy_cmdclass.copy() Modified: trunk/numpy/distutils/fcompiler/__init__.py =================================================================== --- trunk/numpy/distutils/fcompiler/__init__.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/distutils/fcompiler/__init__.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -207,7 +207,7 @@ # This will be set by new_fcompiler when called in # command/{build_ext.py, build_clib.py, config.py} files. c_compiler = None - + def __init__(self, *args, **kw): CCompiler.__init__(self, *args, **kw) self.distutils_vars = self.distutils_vars.clone(self._environment_hook) Modified: trunk/numpy/distutils/misc_util.py =================================================================== --- trunk/numpy/distutils/misc_util.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/distutils/misc_util.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -1519,7 +1519,7 @@ #copied from python 2.5.1 distutils/msvccompiler.py def get_build_architecture(): """Return the processor architecture. - + Possible results are "Intel", "Itanium", or "AMD64". """ prefix = " bit (" Modified: trunk/numpy/distutils/system_info.py =================================================================== --- trunk/numpy/distutils/system_info.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/distutils/system_info.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -841,7 +841,7 @@ lapack_libs = self.get_libs('lapack_libs',['mkl_lapack']) else: lapack_libs = self.get_libs('lapack_libs',['mkl_lapack32','mkl_lapack64']) - + info = {'libraries': lapack_libs} dict_append(info,**mkl) self.set_info(**info) @@ -1083,7 +1083,7 @@ tgexc tgsen tgsja tgsna tgsy2 tgsyl tpcon tprfs tptri tptrs trcon trevc trexc trrfs trsen trsna trsyl trti2 trtri trtrs tzrqf tzrzf - + lacn2 lahr2 stemr laqr0 laqr1 laqr2 laqr3 laqr4 laqr5 ''' # [s|c|d|z]*.f sd_lasrc = ''' Modified: trunk/numpy/doc/example.py =================================================================== --- trunk/numpy/doc/example.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/doc/example.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -96,4 +96,3 @@ """ pass - Modified: trunk/numpy/f2py/cb_rules.py =================================================================== --- trunk/numpy/f2py/cb_rules.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/f2py/cb_rules.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -293,7 +293,7 @@ }, 'strarglens':{isstring:',int #varname#_cb_len'}, # untested with multiple args 'strarglens_td':{isstring:',int'}, # untested with multiple args - 'strarglens_nm':{isstring:',#varname#_cb_len'}, # untested with multiple args + 'strarglens_nm':{isstring:',#varname#_cb_len'}, # untested with multiple args }, { # Scalars 'decl':{l_not(isintent_c):'\t#ctype# #varname#=(*#varname#_cb_capi);'}, Modified: trunk/numpy/f2py/lib/extgen/base.py =================================================================== --- trunk/numpy/f2py/lib/extgen/base.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/f2py/lib/extgen/base.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -65,7 +65,7 @@ return l return self._components components = property(components) - + def initialize(self, *components, **options): """ Set additional attributes, add components to instance, etc. @@ -86,7 +86,7 @@ def provides(self): """ Return a code idiom name that the current class defines. - + Used in avoiding redefinitions of functions and variables. """ if self._provides is None: @@ -123,7 +123,7 @@ r += Component._get_class_names(b) return r _get_class_names = staticmethod(_get_class_names) - + def add(self, component, container_label=None): """ Append component and its target container label to components list. @@ -205,7 +205,7 @@ return evaluated template strings. """ #self.finalize() - + # clean up containers self.containers = {} for n in dir(self): @@ -249,7 +249,7 @@ container = component.get_container(k) container.add(r, component.provides) else: - + self.warning('%s: no container label specified for component providing %r'\ % (self.__class__.__name__,component.provides)) component.parent = old_parent @@ -284,7 +284,7 @@ def get_container(self, name): """ Return named container. - + Rules for returning containers: (1) return local container if exists (2) return parent container if exists @@ -295,7 +295,7 @@ return self.containers[name] except KeyError: pass - + # parent container parent = self.parent while parent is not None: @@ -380,7 +380,7 @@ import numpy return numpy.__version__ numpy_version = property(numpy_version) - + class Container(object): """ Container of a list of named strings. @@ -401,7 +401,7 @@ >>> c += c2 >>> print c "hey, hoo, bar" - + """ __metaclass__ = ComponentMetaClass @@ -435,7 +435,7 @@ self.replace_map = replace_map self.ignore_empty_content = ignore_empty_content self.skip_prefix_suffix_when_single = skip_prefix_suffix_when_single - + def __nonzero__(self): return bool(self.list) @@ -452,7 +452,7 @@ for i,l in lst: self.add(other.list[i], l) else: - self.add(other) + self.add(other) return self __iadd__ = __add__ @@ -532,12 +532,12 @@ lst = [(i,l) for (l,i) in self.label_map.items()] lst.sort() for i,l in lst: - cpy.add(mapping(other.list[i]), l) + cpy.add(mapping(other.list[i]), l) return cpy def _test(): import doctest doctest.testmod() - + if __name__ == "__main__": _test() Modified: trunk/numpy/f2py/lib/extgen/c_support.py =================================================================== --- trunk/numpy/f2py/lib/extgen/c_support.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/f2py/lib/extgen/c_support.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -177,7 +177,7 @@ %(CDeclaration)s %(CBody)s }''' - + container_options = dict( CArgument = dict(separator=', ', default='void'), CDeclaration = dict(default='', use_indent=True, ignore_empty_content=True, @@ -215,7 +215,7 @@ >>> h = CHeader('noddy.h') >>> print h.generate() #include "noddy.h" - + """ template = '#include "%(line)s"' @@ -288,6 +288,6 @@ def _test(): import doctest doctest.testmod() - + if __name__ == "__main__": _test() Modified: trunk/numpy/f2py/lib/extgen/py_support.py =================================================================== --- trunk/numpy/f2py/lib/extgen/py_support.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/f2py/lib/extgen/py_support.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -80,7 +80,7 @@ self.cdecl = PyCModuleCDeclaration(pyname) self += self.cdecl - + self.main = PyCModuleInitFunction(pyname) self += self.main map(self.add, components) @@ -93,7 +93,7 @@ def update_SetupPy(self, parent): parent.setup_py += self.evaluate(' config.add_extension(%(pyname)r, sources = ["%(extmodulesrc)s"])', extmodulesrc = self.path) - parent.init_py += 'import %s' % (self.pyname) + parent.init_py += 'import %s' % (self.pyname) def finalize(self): if self.need_numpy_support: @@ -113,7 +113,7 @@ def build(self, build_dir=None, clean_at_exit=None): """ build(build_dir=None, clean_at_exit=None) - + A convenience function to build, import, an return an extension module object. """ @@ -123,7 +123,7 @@ packagename = 'extgen_' + str(hex(int(time.time()*10000000)))[2:] build_dir = os.path.join(tempfile.gettempdir(), packagename) clean_at_exit = True - + setup = Component.SetupPy(build_dir) setup += self s,o = setup.execute('build_ext','--inplace') @@ -185,7 +185,7 @@ ) default_component_class_name = 'Line' - + def initialize(self, pyname): self.pyname = pyname return self @@ -225,8 +225,8 @@ } return; } - """ - + """ + template = '''\ %(CSpecifier)s %(CTypeSpec)s @@ -320,7 +320,7 @@ map(self.add, components) return self def update_containers(self): - self.container_OptExtArg += self.container_OptArg + self.container_ExtArg + self.container_OptExtArg += self.container_OptArg + self.container_ExtArg class PyCFunction(CFunction): @@ -329,7 +329,7 @@ >>> f = PyCFunction('foo') >>> print f.generate() static - char pyc_function_foo_doc[] = + char pyc_function_foo_doc[] = \" foo() -> None\" \"\\n\\n:Returns:\\n None\" ; @@ -366,7 +366,7 @@ template = '''\ static -char %(name)s_doc[] = +char %(name)s_doc[] = " %(FunctionSignature)s" %(Title)s %(Description)s @@ -399,7 +399,7 @@ }''' container_options = CFunction.container_options.copy() - + container_options.update(\ TMP = dict(), @@ -429,13 +429,13 @@ ReqKWList = ReqKWList.parent_container_options, OptKWList = OptKWList.parent_container_options, ExtKWList = ExtKWList.parent_container_options, - + ReqArgFmt = ReqArgFmt.parent_container_options, OptArgFmt = OptArgFmt.parent_container_options, ExtArgFmt = ExtArgFmt.parent_container_options, OptExtArgFmt = OptExtArgFmt.ExtArgFmt.parent_container_options, RetArgFmt = ExtArgFmt.parent_container_options, - + ReqArgObj = ReqArgObj.parent_container_options, OptArgObj = OptArgObj.parent_container_options, ExtArgObj = ExtArgObj.parent_container_options, @@ -443,7 +443,7 @@ FromPyObj = CCode.parent_container_options, PyObjFrom = CCode.parent_container_options, - + CleanPyObjFrom = dict(default='', reverse=True, use_indent=True, ignore_empty_content=True), CleanCBody = dict(default='', reverse=True, use_indent=True, ignore_empty_content=True), CleanFromPyObj = dict(default='', reverse=True, use_indent=True, ignore_empty_content=True), @@ -457,7 +457,7 @@ PyCArgument = 'TMP', CCode = 'CBody', ) - + def initialize(self, pyname, *components, **options): self.pyname = pyname self.title = options.pop('title', None) @@ -483,7 +483,7 @@ t = ' {"%(pyname)s", (PyCFunction)%(name)s, METH_VARARGS | METH_KEYWORDS, %(name)s_doc}' parent.cdecl.add(self.evaluate(t),'PyMethodDef') parent.cdecl.add(self.signature,'FunctionSignature') - + def update_containers(self): self.container_OptExtArg += self.container_OptArg + self.container_ExtArg self.container_OptExtArgFmt += self.container_OptArgFmt + self.container_ExtArgFmt @@ -585,7 +585,7 @@ if self.output_description is None: self.output_description = description if options: self.warning('%s unused options: %s\n' % (self.__class__.__name__, options)) - + self.name = name self.ctype = ctype = PyCTypeSpec(ctype) self += ctype @@ -613,8 +613,8 @@ self.retpycvar = name + '_pyc_r' ctype.set_titles(self) - - map(self.add, components) + + map(self.add, components) return self def __repr__(self): @@ -668,7 +668,7 @@ pass else: raise NotImplementedError('input_intent=%r' % (self.input_intent)) - + if self.output_intent=='return': parent += RetArg(self.name) parent.signature += RetArg(self.name) @@ -679,11 +679,11 @@ elif self.output_intent=='hide': pass else: - raise NotImplementedError('output_intent=%r' % (self.output_intent)) + raise NotImplementedError('output_intent=%r' % (self.output_intent)) class PyCReturn(PyCArgument): - def initialize(self, name, ctype = object, *components, **options): + def initialize(self, name, ctype = object, *components, **options): return PyCArgument(name, ctype, input_intent='hide', output_intent='return', *components, **options) class PyCTypeSpec(CTypeSpec): @@ -898,7 +898,7 @@ c_long = (None,'long', 'l', 'l', '0'), c_unsigned_long = (None,'unsigned long', 'k', 'k', '0'), c_long_long = (None,'PY_LONG_LONG', 'L', 'L', '0'), - c_unsigned_long_long = (None,'unsigned PY_LONG_LONG', 'K', 'K', '0'), + c_unsigned_long_long = (None,'unsigned PY_LONG_LONG', 'K', 'K', '0'), c_Py_ssize_t = (None,'Py_ssize_t', 'n', 'n', '0'), c_char1 = (None,'char', 'c', 'c', '"\\0"'), c_float = (None,'float', 'f', 'f', '0.0'), @@ -911,7 +911,7 @@ def initialize(self, typeobj): if isinstance(typeobj, self.__class__): return typeobj - + m = self.typeinfo_map key = None @@ -955,7 +955,7 @@ #self.add(Component.get('import_array'), 'ModuleInit') if key.startswith('numeric_'): raise NotImplementedError(self.__class__.__name__ + ': Numeric support') - + return self def finalize(self): @@ -1099,6 +1099,6 @@ def _test(): import doctest doctest.testmod() - + if __name__ == "__main__": _test() Modified: trunk/numpy/f2py/lib/extgen/setup_py.py =================================================================== --- trunk/numpy/f2py/lib/extgen/setup_py.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/f2py/lib/extgen/setup_py.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -51,7 +51,7 @@ >>> import SetupPy_doctest as mypackage >>> print mypackage.foo.__doc__ #doctest: +ELLIPSIS This module 'foo' is generated with ExtGen from NumPy version... - + """ template_setup_py_start = '''\ def configuration(parent_package='', top_path = ''): @@ -88,7 +88,7 @@ self += init_py self += setup_py - + map(self.add, components) return self @@ -115,10 +115,10 @@ self.info('leaving %r directory' % (self.path)) return r - + def _test(): import doctest doctest.testmod() - + if __name__ == "__main__": _test() Modified: trunk/numpy/f2py/lib/extgen/utils.py =================================================================== --- trunk/numpy/f2py/lib/extgen/utils.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/f2py/lib/extgen/utils.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -104,7 +104,7 @@ Line = 'Content', Code = 'Content', ) - + def initialize(self, path, *components, **options): self.path = path map(self.add, components) @@ -121,6 +121,6 @@ def _test(): import doctest doctest.testmod() - + if __name__ == "__main__": _test() Modified: trunk/numpy/f2py/lib/main.py =================================================================== --- trunk/numpy/f2py/lib/main.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/f2py/lib/main.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -418,7 +418,7 @@ '--build-clib',build_dir_clib_clib, ] temp_dirs = [build_dir_ext_temp, build_dir_clib_temp, build_dir_clib_clib] - + if fc_flags: new_sys_argv += ['config_fc'] + fc_flags sys.argv[:] = new_sys_argv @@ -492,7 +492,7 @@ if source_ext is None: reader = get_reader(source) source_ext = {'free90':'.f90','fix90':'.f90','fix77':'.f','pyf':'.pyf'}[reader.mode] - + if modulenames is None: modulenames = jobname, if os.path.isdir(tmpdir): Modified: trunk/numpy/f2py/lib/py_wrap_type.py =================================================================== --- trunk/numpy/f2py/lib/py_wrap_type.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/f2py/lib/py_wrap_type.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -453,12 +453,12 @@ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ "Fortran derived type %(name)s objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ %(otype)s_methods, /* tp_methods */ 0 /*%(otype)s_members*/, /* tp_members */ %(otype)s_getseters, /* tp_getset */ Modified: trunk/numpy/f2py/lib/tests/test_module_module.py =================================================================== --- trunk/numpy/f2py/lib/tests/test_module_module.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/f2py/lib/tests/test_module_module.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -42,7 +42,7 @@ type(rat) a print*,"In bar,a=",a end subroutine bar -end module test_module_module_ext +end module test_module_module_ext ''' m,m2 = compile(fortran_code, modulenames=['test_module_module_ext', Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/lib/function_base.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -1,7 +1,7 @@ __docformat__ = "restructuredtext en" __all__ = ['logspace', 'linspace', 'select', 'piecewise', 'trim_zeros', - 'copy', 'iterable', + 'copy', 'iterable', 'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp', 'unique', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax', 'nanargmin', 'nanmin', 'vectorize', 'asarray_chkfinite', 'average', Modified: trunk/numpy/lib/index_tricks.py =================================================================== --- trunk/numpy/lib/index_tricks.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/lib/index_tricks.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -125,7 +125,7 @@ [2], [3], [4]]), array([[0, 1, 2, 3, 4]])] - + """ def __init__(self, sparse=False): self.sparse = sparse @@ -319,7 +319,7 @@ For example: >>> r_[array([1,2,3]), 0, 0, array([4,5,6])] array([1, 2, 3, 0, 0, 4, 5, 6]) - + """ def __init__(self): concatenator.__init__(self, 0) Modified: trunk/numpy/lib/shape_base.py =================================================================== --- trunk/numpy/lib/shape_base.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/lib/shape_base.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -299,7 +299,7 @@ [[2, 3]], [[3, 4]]]) - + """ return _nx.concatenate(map(atleast_3d,tup),2) Modified: trunk/numpy/lib/tests/test_shape_base.py =================================================================== --- trunk/numpy/lib/tests/test_shape_base.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/lib/tests/test_shape_base.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -410,4 +410,3 @@ if __name__ == "__main__": NumpyTest().run() - Modified: trunk/numpy/lib/twodim_base.py =================================================================== --- trunk/numpy/lib/twodim_base.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/lib/twodim_base.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -143,7 +143,7 @@ X[:,i] = x**(N-i-1) return X - + def histogram2d(x,y, bins=10, range=None, normed=False, weights=None): """histogram2d(x,y, bins=10, range=None, normed=False) -> H, xedges, yedges @@ -151,27 +151,27 @@ :Parameters: - `x,y` : Sample arrays (1D). - - `bins` : Number of bins -or- [nbin x, nbin y] -or- + - `bins` : Number of bins -or- [nbin x, nbin y] -or- [bin edges] -or- [x bin edges, y bin edges]. - `range` : A sequence of lower and upper bin edges (default: [min, max]). - `normed` : Boolean, if False, return the number of samples in each bin, if True, returns the density. - - `weights` : An array of weights. The weights are normed only if normed + - `weights` : An array of weights. The weights are normed only if normed is True. Should weights.sum() not equal N, the total bin count \ will not be equal to the number of samples. - + :Return: - `hist` : Histogram array. - - `xedges, yedges` : Arrays defining the bin edges. - + - `xedges, yedges` : Arrays defining the bin edges. + Example: >>> x = random.randn(100,2) >>> hist2d, xedges, yedges = histogram2d(x, bins = (6, 7)) - + :SeeAlso: histogramdd """ from numpy import histogramdd - + try: N = len(bins) except TypeError: Modified: trunk/numpy/lib/type_check.py =================================================================== --- trunk/numpy/lib/type_check.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/lib/type_check.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -7,7 +7,7 @@ import numpy.core.numeric as _nx from numpy.core.numeric import asarray, asanyarray, array, isnan, \ - obj2sctype, zeros + obj2sctype, zeros from ufunclike import isneginf, isposinf _typecodes_by_elsize = 'GDFgdfQqLlIiHhBb?' Modified: trunk/numpy/lib/utils.py =================================================================== --- trunk/numpy/lib/utils.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/lib/utils.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -118,7 +118,7 @@ high is just *past* the last byte If the array is not single-segment, then it may not actually - use every byte between these bounds. + use every byte between these bounds. The array provided must conform to the Python-side of the array interface """ @@ -140,8 +140,8 @@ a_high += (shape-1)*stride a_high += bytes_a return a_low, a_high - + def may_share_memory(a, b): """Determine if two arrays can share memory @@ -275,7 +275,7 @@ Example: >>> from numpy import * >>> info(polyval) # doctest: +SKIP - + polyval(p, x) Evaluate the polymnomial p at x. Modified: trunk/numpy/linalg/lapack_lite/clapack_scrub.py =================================================================== --- trunk/numpy/linalg/lapack_lite/clapack_scrub.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/linalg/lapack_lite/clapack_scrub.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -273,4 +273,3 @@ writefo = open(outfilename, 'w') writefo.write(source) writefo.close() - Modified: trunk/numpy/matlib.py =================================================================== --- trunk/numpy/matlib.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/matlib.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -45,7 +45,7 @@ def randn(*args): if isinstance(args[0], tuple): - args = args[0] + args = args[0] return asmatrix(N.random.randn(*args)) def repmat(a, m, n): Modified: trunk/numpy/numarray/image.py =================================================================== --- trunk/numpy/numarray/image.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/numarray/image.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -12,4 +12,3 @@ installing all of SciPy from http://www.scipy.org. """ raise ImportError(msg) - Modified: trunk/numpy/numarray/matrix.py =================================================================== --- trunk/numpy/numarray/matrix.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/numarray/matrix.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -5,4 +5,3 @@ def Matrix(data, typecode=None, copy=1, savespace=0): return _matrix(data, typecode, copy=copy) - Modified: trunk/numpy/numarray/numerictypes.py =================================================================== --- trunk/numpy/numarray/numerictypes.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/numarray/numerictypes.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -472,25 +472,25 @@ Complex64 : Complex64 } else: - _MaximumType = { - Bool : Int64, + _MaximumType = { + Bool : Int64, - Int8 : Int64, - Int16 : Int64, - Int32 : Int64, - Int64 : Int64, + Int8 : Int64, + Int16 : Int64, + Int32 : Int64, + Int64 : Int64, - UInt8 : Int64, - UInt16 : Int64, - UInt32 : Int64, - UInt8 : Int64, + UInt8 : Int64, + UInt16 : Int64, + UInt32 : Int64, + UInt8 : Int64, - Float32 : Float64, - Float64 : Float64, + Float32 : Float64, + Float64 : Float64, - Complex32 : Complex64, - Complex64 : Complex64 - } + Complex32 : Complex64, + Complex64 : Complex64 + } def MaximumType(t): """returns the type of highest precision of the same general kind as 't'""" Modified: trunk/numpy/oldnumeric/arrayfns.py =================================================================== --- trunk/numpy/oldnumeric/arrayfns.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/oldnumeric/arrayfns.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -94,5 +94,3 @@ def construct3(mask, itype): raise NotImplementedError - - Modified: trunk/numpy/oldnumeric/ma.py =================================================================== --- trunk/numpy/oldnumeric/ma.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/oldnumeric/ma.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -12,4 +12,3 @@ def take(a, indices, axis=0): return nca.average(a, indices, axis=0) - Modified: trunk/numpy/oldnumeric/random_array.py =================================================================== --- trunk/numpy/oldnumeric/random_array.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/oldnumeric/random_array.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -81,13 +81,13 @@ """multivariate_normal(mean, cov) or multivariate_normal(mean, cov, [m, n, ...]) returns an array containing multivariate normally distributed random numbers with specified mean and covariance. - + mean must be a 1 dimensional array. cov must be a square two dimensional array with the same number of rows and columns as mean has elements. - + The first form returns a single 1-D array containing a multivariate normal. - + The second form returns an array of shape (m, n, ..., cov.shape[0]). In this case, output[i,j,...,:] is a 1-D array containing a multivariate normal.""" Modified: trunk/numpy/testing/numpytest.py =================================================================== --- trunk/numpy/testing/numpytest.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/numpy/testing/numpytest.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -296,10 +296,10 @@ def rename(self, **kws): """Apply renaming submodule test file test_.py to test_.py. - + Usage: self.rename(name='newname') before calling the self.test() method. - + If 'newname' is None, then no tests will be executed for a given module. """ Modified: trunk/setup.py =================================================================== --- trunk/setup.py 2007-10-29 14:43:48 UTC (rev 4331) +++ trunk/setup.py 2007-10-29 14:58:18 UTC (rev 4332) @@ -45,12 +45,12 @@ assume_default_configuration=True, delegate_options_to_subpackages=True, quiet=True) - + config.add_subpackage('numpy') - + config.add_data_files(('numpy','*.txt'), ('numpy','COMPATIBILITY'), - ('numpy','scipy_compatibility'), + ('numpy','scipy_compatibility'), ('numpy','site.cfg.example')) config.get_version('numpy/version.py') # sets config.version @@ -79,7 +79,7 @@ classifiers=filter(None, CLASSIFIERS.split('\n')), author = "Travis E. Oliphant, et.al.", author_email = "oliphant at ee.byu.edu", - platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], + platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], configuration=configuration ) finally: del sys.path[0] From numpy-svn at scipy.org Mon Oct 29 11:16:38 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 10:16:38 -0500 (CDT) Subject: [Numpy-svn] r4333 - trunk/numpy/numarray Message-ID: <20071029151638.3E6A539C080@new.scipy.org> Author: jarrod.millman Date: 2007-10-29 10:16:34 -0500 (Mon, 29 Oct 2007) New Revision: 4333 Modified: trunk/numpy/numarray/numerictypes.py Log: cleaning up after reindent.py Modified: trunk/numpy/numarray/numerictypes.py =================================================================== --- trunk/numpy/numarray/numerictypes.py 2007-10-29 14:58:18 UTC (rev 4332) +++ trunk/numpy/numarray/numerictypes.py 2007-10-29 15:16:34 UTC (rev 4333) @@ -473,25 +473,25 @@ } else: _MaximumType = { - Bool : Int64, + Bool : Int64, + + Int8 : Int64, + Int16 : Int64, + Int32 : Int64, + Int64 : Int64, + + UInt8 : Int64, + UInt16 : Int64, + UInt32 : Int64, + UInt8 : Int64, + + Float32 : Float64, + Float64 : Float64, + + Complex32 : Complex64, + Complex64 : Complex64 + } - Int8 : Int64, - Int16 : Int64, - Int32 : Int64, - Int64 : Int64, - - UInt8 : Int64, - UInt16 : Int64, - UInt32 : Int64, - UInt8 : Int64, - - Float32 : Float64, - Float64 : Float64, - - Complex32 : Complex64, - Complex64 : Complex64 - } - def MaximumType(t): """returns the type of highest precision of the same general kind as 't'""" return _MaximumType[t] From numpy-svn at scipy.org Mon Oct 29 11:37:14 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 10:37:14 -0500 (CDT) Subject: [Numpy-svn] r4334 - trunk/numpy/f2py Message-ID: <20071029153714.7106539C11D@new.scipy.org> Author: jarrod.millman Date: 2007-10-29 10:37:11 -0500 (Mon, 29 Oct 2007) New Revision: 4334 Modified: trunk/numpy/f2py/capi_maps.py Log: typo Modified: trunk/numpy/f2py/capi_maps.py =================================================================== --- trunk/numpy/f2py/capi_maps.py 2007-10-29 15:16:34 UTC (rev 4333) +++ trunk/numpy/f2py/capi_maps.py 2007-10-29 15:37:11 UTC (rev 4334) @@ -220,7 +220,7 @@ elif issubroutine(var): return ctype elif var.has_key('typespec') and f2cmap_all.has_key(var['typespec'].lower()): - typespec = var['typespec'].upper() + typespec = var['typespec'].lower() f2cmap=f2cmap_all[typespec] ctype=f2cmap[''] # default type if var.has_key('kindselector'): From numpy-svn at scipy.org Mon Oct 29 11:48:14 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 10:48:14 -0500 (CDT) Subject: [Numpy-svn] r4335 - trunk/numpy/f2py Message-ID: <20071029154814.E242339C11C@new.scipy.org> Author: jarrod.millman Date: 2007-10-29 10:48:12 -0500 (Mon, 29 Oct 2007) New Revision: 4335 Modified: trunk/numpy/f2py/rules.py Log: another typo Modified: trunk/numpy/f2py/rules.py =================================================================== --- trunk/numpy/f2py/rules.py 2007-10-29 15:37:11 UTC (rev 4334) +++ trunk/numpy/f2py/rules.py 2007-10-29 15:48:12 UTC (rev 4335) @@ -1200,7 +1200,7 @@ f.write('C This file is autogenerated with f2py (version:%s)\n'%(f2py_version)) f.write('C It contains Fortran 77 wrappers to fortran functions.\n') lines = [] - for l in '\n\n'.join(funcwrappers)+'\n'.split('\n'): + for l in ('\n\n'.join(funcwrappers)+'\n').split('\n'): if l and l[0]==' ': while len(l)>=66: lines.append(l[:66]+'\n &') From numpy-svn at scipy.org Mon Oct 29 12:41:08 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 11:41:08 -0500 (CDT) Subject: [Numpy-svn] r4336 - branches/numpy.scons/numpy/distutils/scons/doc Message-ID: <20071029164108.2EBBE39C12F@new.scipy.org> Author: cdavid Date: 2007-10-29 11:40:12 -0500 (Mon, 29 Oct 2007) New Revision: 4336 Added: branches/numpy.scons/numpy/distutils/scons/doc/DESIGN Log: Add preliminary design document Added: branches/numpy.scons/numpy/distutils/scons/doc/DESIGN =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/DESIGN 2007-10-29 15:48:12 UTC (rev 4335) +++ branches/numpy.scons/numpy/distutils/scons/doc/DESIGN 2007-10-29 16:40:12 UTC (rev 4336) @@ -0,0 +1,60 @@ +.. Last Change: . +.. vim:syntax=rest + +numpy.distutils.scons is basically an extension of numpy.distutils to use scons +for building extensions instead of distutils. Some of the advantages: + + - fine grained control of compilation environement (compiler options, + etc...) + - ability to build shared, static libraries in a cross platform manner + - ability to build standard C python extension and Ctypes-based extensions + in a cross platform manner + - support library for high level system capabilities cheks, including + availability of MKL, ATLAS, etc... and more generic framework to build + your own, cross platform checks (think autoconf, but with python instead + of M4) + +How does it work ? +================== + +The basic scheme is easy: + + - an add_sconscript function has been added to + numpy.distutils.Configuration. When called, this registers the sconscript + given as an argument. + - a scons command has been added as a distutils command. When called + through python setup.py scons, scons is called for every SConscript + registered by add_sconscript function (numpy/distutils/command/scons.py) + - In the SConscript files, basic environments are obtained from the factory + numpy.distutils.scons.GetNumpyEnvironment. Those objects are true scons + Environment, but correctly initialized with basic tools (C and fortran + compilers, etc...), python and numpy specific builders (to build python + extension, etc...), and some information necessary for scons <-> distutils + interoperability. + - As in standard scons, code is built using builders. However, for + interoperability with distutils, special builders are provided to put any + generated code in seperate directories, install built code in directories where + distutils will find them (for install command), etc... + +While not the most efficient (scons is launched as a new process for every +package registering a SConscript), this enables truly independant packages. +Basic build parameters (compiler, build directories, etc...) are passed to +scons through command lines argument, but generally, you don't need to +understand how exactly to use it. + +Distutils <-> scons interoperability +==================================== + +Once you get an Environment instance from GetNumpyEnvironment, you can use any +facility provided by scons. However, following the distutils tradition, some +special facilities are provided to avoid cluttering the source tree, and +putting any generated files (object code, libraries, etc...) inside a separate +build directory. Special builders which take care of the gory details are +provided. They are prefixed by Numpy to differentiate them from the standard +scons builders. For example, NumpySharedLibrary will builds a shared library +with the same api than scons' SharedLibrary, but will take care of setting +build directories, and install the built code in directories where distutils +will find them for later installation. + +For now, builders to build Ctypes extensions, shared libraries and python +extensions are provided. From numpy-svn at scipy.org Mon Oct 29 12:44:34 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 11:44:34 -0500 (CDT) Subject: [Numpy-svn] r4337 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071029164434.AB75A39C12E@new.scipy.org> Author: cdavid Date: 2007-10-29 11:43:53 -0500 (Mon, 29 Oct 2007) New Revision: 4337 Modified: branches/numpy.scons/numpy/distutils/scons/configuration.py Log: Write config info in a file. Modified: branches/numpy.scons/numpy/distutils/scons/configuration.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-10-29 16:40:12 UTC (rev 4336) +++ branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-10-29 16:43:53 UTC (rev 4337) @@ -32,3 +32,8 @@ def write_info(env): print "File is %s" % env['NUMPY_PKG_CONFIG_FILE'] print "Info is %s" % env['NUMPY_PKG_CONFIG'] + f = open(env['NUMPY_PKG_CONFIG_FILE'], 'w') + f.writelines("config = %s" % str(env['NUMPY_PKG_CONFIG'])) + f.close() + + From numpy-svn at scipy.org Mon Oct 29 12:52:48 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 11:52:48 -0500 (CDT) Subject: [Numpy-svn] r4338 - in branches/numpy.scons/numpy/distutils/scons: . checkers doc tests Message-ID: <20071029165248.0025239C110@new.scipy.org> Author: cdavid Date: 2007-10-29 11:52:37 -0500 (Mon, 29 Oct 2007) New Revision: 4338 Modified: branches/numpy.scons/numpy/distutils/scons/ branches/numpy.scons/numpy/distutils/scons/checkers/ branches/numpy.scons/numpy/distutils/scons/doc/ branches/numpy.scons/numpy/distutils/scons/tests/ Log: Ignore junk files Property changes on: branches/numpy.scons/numpy/distutils/scons ___________________________________________________________________ Name: svn:ignore - *.pyc + configuration.pyc Property changes on: branches/numpy.scons/numpy/distutils/scons/checkers ___________________________________________________________________ Name: svn:ignore + *.pyc Property changes on: branches/numpy.scons/numpy/distutils/scons/doc ___________________________________________________________________ Name: svn:ignore + configuration.pyc Property changes on: branches/numpy.scons/numpy/distutils/scons/tests ___________________________________________________________________ Name: svn:ignore + configuration.pyc From numpy-svn at scipy.org Mon Oct 29 21:22:03 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 20:22:03 -0500 (CDT) Subject: [Numpy-svn] r4339 - branches/numpy.scons/numpy/distutils/scons/doc Message-ID: <20071030012203.270BB39C06C@new.scipy.org> Author: cdavid Date: 2007-10-29 20:21:53 -0500 (Mon, 29 Oct 2007) New Revision: 4339 Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO Log: Update TODO Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-10-29 16:52:37 UTC (rev 4338) +++ branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-10-30 01:21:53 UTC (rev 4339) @@ -1,11 +1,27 @@ -Before True milestone: +Before second alpha (in order of priority): + - support sdist: how to add files to distutils distribution ? ~ 2 hours + - support sdist: examples and numpy (~ 1 hour) + - show_config implementation : show libs, libpath and cpppath for each + configuration (~ 2-3 hours) + - BLAS, CBLAS and LAPACK meta checkers: overridable, support at least + ATLAS, Accelerate, and MKL (~ 2-3 hours) + - Basic warn, debug and optim flags : at least gcc+linux, mingw, VS, gcc+mac + os x, and posix ? (~ 2 hours). + +Before first beta: + - f2py and scipy interoperability: N hours + +Design questions: - improve BrokenMathlib and Mathlib in core, and make them available to everyone - - show_config implementation : how to do it ? - How to build meta-checkers from simple checkers (for example, BLAS with MKL, ATLAS, Sunperf, etc...) ? + - How to gather informations from checkers for config info ? + - How to provide a usable framework for checks (+ doc) + - overriding compilation flags: env variables, site.cfg ? (autotools + convention ?) -Checker: +Code cleaning: - improve Fortran runtime detection for upstream integration - improve Fortran mangling and dummy main detection for upstream integration @@ -19,12 +35,13 @@ - Generic FromTemplate builder (with dep tracking) Implementation details: - - Default optim, warn and link flags for python extension on at least gcc, - g77, gfortran (1st priority), MS and Intel (2d priority), others (3rd: - sun, aix, etc...) - Refactor code for API generation (numpy/core/code_generators) -> Mostly done + - Refactor code organization in numpy/distutils/scons +Tests: + - What can be tested ? + Documentation: - - scons / distutils integration - - global design (BuildDir, directories, etc...) - - package developers documentation + - scons / distutils integration, global design (BuildDir, directories, etc...) + - use cases: package developers (examples, etc...), numpy developers, + building numpy with scons, etc... From numpy-svn at scipy.org Mon Oct 29 22:29:26 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 21:29:26 -0500 (CDT) Subject: [Numpy-svn] r4340 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071030022926.6882D39C074@new.scipy.org> Author: cdavid Date: 2007-10-29 21:29:23 -0500 (Mon, 29 Oct 2007) New Revision: 4340 Modified: branches/numpy.scons/numpy/distutils/scons/ Log: fix typo in svn:ignore Property changes on: branches/numpy.scons/numpy/distutils/scons ___________________________________________________________________ Name: svn:ignore - configuration.pyc + *.pyc From numpy-svn at scipy.org Mon Oct 29 23:57:18 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 22:57:18 -0500 (CDT) Subject: [Numpy-svn] r4341 - branches/numpy.scons/numpy/distutils/scons/doc Message-ID: <20071030035718.8F9F439C040@new.scipy.org> Author: cdavid Date: 2007-10-29 22:57:14 -0500 (Mon, 29 Oct 2007) New Revision: 4341 Modified: branches/numpy.scons/numpy/distutils/scons/doc/DESIGN Log: update design document Modified: branches/numpy.scons/numpy/distutils/scons/doc/DESIGN =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/DESIGN 2007-10-30 02:29:23 UTC (rev 4340) +++ branches/numpy.scons/numpy/distutils/scons/doc/DESIGN 2007-10-30 03:57:14 UTC (rev 4341) @@ -1,4 +1,4 @@ -.. Last Change: . +.. Last Change: Tue Oct 30 12:00 PM 2007 J .. vim:syntax=rest numpy.distutils.scons is basically an extension of numpy.distutils to use scons @@ -10,9 +10,9 @@ - ability to build standard C python extension and Ctypes-based extensions in a cross platform manner - support library for high level system capabilities cheks, including - availability of MKL, ATLAS, etc... and more generic framework to build - your own, cross platform checks (think autoconf, but with python instead - of M4) + availability of MKL, ATLAS, etc. and more generic framework to build your + own, cross platform checks (think autoconf, but using python instead of + M4) How does it work ? ================== @@ -33,8 +33,8 @@ interoperability. - As in standard scons, code is built using builders. However, for interoperability with distutils, special builders are provided to put any - generated code in seperate directories, install built code in directories where - distutils will find them (for install command), etc... + generated code in seperate directories, install built code in directories + where distutils will find them (for install command), etc... While not the most efficient (scons is launched as a new process for every package registering a SConscript), this enables truly independant packages. @@ -42,6 +42,16 @@ scons through command lines argument, but generally, you don't need to understand how exactly to use it. +Pro of per module scons call: + - independant configuration and build + - simplicity + +Cons: + - communication between scons and distutils is cumbersome (since they are + in different processes). Passing info from distutils -> scons is doable, + since scons is always called at the same point from distutils, but the + contrary is more difficult. + Distutils <-> scons interoperability ==================================== @@ -57,4 +67,6 @@ will find them for later installation. For now, builders to build Ctypes extensions, shared libraries and python -extensions are provided. +extensions are provided. I don't think static builders are necessary, since the +code is unusable for any python extension, hence not really making sense for +our usage. From numpy-svn at scipy.org Tue Oct 30 00:04:38 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 23:04:38 -0500 (CDT) Subject: [Numpy-svn] r4342 - in branches/numpy.scons/numpy/distutils: . command Message-ID: <20071030040438.4398539C040@new.scipy.org> Author: cdavid Date: 2007-10-29 23:04:21 -0500 (Mon, 29 Oct 2007) New Revision: 4342 Modified: branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/command/sdist.py branches/numpy.scons/numpy/distutils/numpy_distribution.py Log: Make SConscripts files known to sdist command Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-30 03:57:14 UTC (rev 4341) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-30 04:04:21 UTC (rev 4342) @@ -61,7 +61,8 @@ Example: --fcompiler=intel -> ifort on linux, ifl on windows""" if compiler.compiler_type == 'intel': - return 'intelc' + raise NotImplementedError('FIXME: intel fortran compiler name ?') + #return 'intelc' elif compiler.compiler_type == 'gnu': return 'g77' elif compiler.compiler_type == 'gnu95': @@ -122,8 +123,8 @@ return '"' + path + '"' class scons(old_build_ext): - # XXX: I really do not like the way distutils add attributes "on the fly". - # We should eally avoid that and remove all the code which does it before + # XXX: I really do not like the way distutils overuses monkey patch. We + # should eally avoid that and remove all the code which does it before # release. # XXX: add an option to the scons command for configuration (auto/force/cache). description = "Scons builder" Modified: branches/numpy.scons/numpy/distutils/command/sdist.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/sdist.py 2007-10-30 03:57:14 UTC (rev 4341) +++ branches/numpy.scons/numpy/distutils/command/sdist.py 2007-10-30 04:04:21 UTC (rev 4342) @@ -24,4 +24,7 @@ else: headers.append(h[1]) self.filelist.extend(headers) + if dist.has_scons_scripts(): + self.filelist.extend(dist.get_scons_scripts()) + return Modified: branches/numpy.scons/numpy/distutils/numpy_distribution.py =================================================================== --- branches/numpy.scons/numpy/distutils/numpy_distribution.py 2007-10-30 03:57:14 UTC (rev 4341) +++ branches/numpy.scons/numpy/distutils/numpy_distribution.py 2007-10-30 04:04:21 UTC (rev 4342) @@ -7,3 +7,6 @@ def has_scons_scripts(self): return bool(self.scons_scripts) + + def get_scons_scripts(self): + return [i[0] for i in self.scons_scripts] From numpy-svn at scipy.org Tue Oct 30 00:12:42 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 23:12:42 -0500 (CDT) Subject: [Numpy-svn] r4343 - branches/numpy.scons Message-ID: <20071030041242.99A3939C040@new.scipy.org> Author: cdavid Date: 2007-10-29 23:12:38 -0500 (Mon, 29 Oct 2007) New Revision: 4343 Added: branches/numpy.scons/testsdist.sh Log: Add a test script for sdist command Added: branches/numpy.scons/testsdist.sh =================================================================== --- branches/numpy.scons/testsdist.sh 2007-10-30 04:04:21 UTC (rev 4342) +++ branches/numpy.scons/testsdist.sh 2007-10-30 04:12:38 UTC (rev 4343) @@ -0,0 +1,8 @@ +PREFIX=$PWD +SVNVER=4342 +rm -rf $PREFIX/build +rm -rf $PREFIX/dist +python setup.py sdist +(cd $PREFIX/dist && tar -xzf numpy-1.0.4.dev$SVNVER.tar.gz) +(cd $PREFIX/dist/numpy-1.0.4.dev$SVNVER && python setup.py scons) + From numpy-svn at scipy.org Tue Oct 30 00:17:40 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 29 Oct 2007 23:17:40 -0500 (CDT) Subject: [Numpy-svn] r4344 - in branches/numpy.scons/numpy: . core distutils f2py fft lib linalg numarray oldnumeric random scons_fake testing Message-ID: <20071030041740.444E439C040@new.scipy.org> Author: cdavid Date: 2007-10-29 23:16:43 -0500 (Mon, 29 Oct 2007) New Revision: 4344 Added: branches/numpy.scons/numpy/core/setup.old.py branches/numpy.scons/numpy/core/setup.py branches/numpy.scons/numpy/distutils/setup.old.py branches/numpy.scons/numpy/distutils/setup.py branches/numpy.scons/numpy/f2py/setup.old.py branches/numpy.scons/numpy/f2py/setup.py branches/numpy.scons/numpy/fft/setup.old.py branches/numpy.scons/numpy/fft/setup.py branches/numpy.scons/numpy/lib/setup.old.py branches/numpy.scons/numpy/lib/setup.py branches/numpy.scons/numpy/linalg/setup.old.py branches/numpy.scons/numpy/linalg/setup.py branches/numpy.scons/numpy/numarray/setup.old.py branches/numpy.scons/numpy/numarray/setup.py branches/numpy.scons/numpy/oldnumeric/setup.old.py branches/numpy.scons/numpy/oldnumeric/setup.py branches/numpy.scons/numpy/random/setup.old.py branches/numpy.scons/numpy/random/setup.py branches/numpy.scons/numpy/scons_fake/setup.old.py branches/numpy.scons/numpy/scons_fake/setup.py branches/numpy.scons/numpy/setup.old.py branches/numpy.scons/numpy/setup.py branches/numpy.scons/numpy/testing/setup.old.py branches/numpy.scons/numpy/testing/setup.py Removed: branches/numpy.scons/numpy/core/setup.py branches/numpy.scons/numpy/core/setupscons.py branches/numpy.scons/numpy/distutils/setup.py branches/numpy.scons/numpy/distutils/setupscons.py branches/numpy.scons/numpy/f2py/setup.py branches/numpy.scons/numpy/f2py/setupscons.py branches/numpy.scons/numpy/fft/setup.py branches/numpy.scons/numpy/fft/setupscons.py branches/numpy.scons/numpy/lib/setup.py branches/numpy.scons/numpy/lib/setupscons.py branches/numpy.scons/numpy/linalg/setup.py branches/numpy.scons/numpy/linalg/setupscons.py branches/numpy.scons/numpy/numarray/setup.py branches/numpy.scons/numpy/numarray/setupscons.py branches/numpy.scons/numpy/oldnumeric/setup.py branches/numpy.scons/numpy/oldnumeric/setupscons.py branches/numpy.scons/numpy/random/setup.py branches/numpy.scons/numpy/random/setupscons.py branches/numpy.scons/numpy/scons_fake/setup.py branches/numpy.scons/numpy/scons_fake/setupscons.py branches/numpy.scons/numpy/setup.py branches/numpy.scons/numpy/setupscons.py branches/numpy.scons/numpy/testing/setup.py branches/numpy.scons/numpy/testing/setupscons.py Log: setupscons.py are now setup.py, move old setup.py as setup.old.py Copied: branches/numpy.scons/numpy/core/setup.old.py (from rev 4342, branches/numpy.scons/numpy/core/setup.py) Deleted: branches/numpy.scons/numpy/core/setup.py =================================================================== --- branches/numpy.scons/numpy/core/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/core/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,466 +0,0 @@ -import imp -import os -import sys -from os.path import join -from numpy.distutils import log -from distutils.dep_util import newer - -FUNCTIONS_TO_CHECK = [ - ('expl', 'HAVE_LONGDOUBLE_FUNCS'), - ('expf', 'HAVE_FLOAT_FUNCS'), - ('log1p', 'HAVE_LOG1P'), - ('expm1', 'HAVE_EXPM1'), - ('asinh', 'HAVE_INVERSE_HYPERBOLIC'), - ('atanhf', 'HAVE_INVERSE_HYPERBOLIC_FLOAT'), - ('atanhl', 'HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE'), - ('isnan', 'HAVE_ISNAN'), - ('isinf', 'HAVE_ISINF'), - ('rint', 'HAVE_RINT'), - ] - -def is_npy_no_signal(): - """Return True if the NPY_NO_SIGNAL symbol must be defined in configuration - header.""" - return sys.platform == 'win32' - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration,dot_join - from numpy.distutils.system_info import get_info, default_lib_dirs - - config = Configuration('core',parent_package,top_path) - local_dir = config.local_path - codegen_dir = join(local_dir,'code_generators') - - generate_umath_py = join(codegen_dir,'generate_umath.py') - n = dot_join(config.name,'generate_umath') - generate_umath = imp.load_module('_'.join(n.split('.')), - open(generate_umath_py,'U'),generate_umath_py, - ('.py','U',1)) - - header_dir = 'include/numpy' # this is relative to config.path_in_package - - def generate_config_h(ext, build_dir): - target = join(build_dir,'config.h') - if newer(__file__,target): - config_cmd = config.get_config_cmd() - log.info('Generating %s',target) - tc = generate_testcode(target) - from distutils import sysconfig - python_include = sysconfig.get_python_inc() - python_h = join(python_include, 'Python.h') - if not os.path.isfile(python_h): - raise SystemError,\ - "Non-existing %s. Perhaps you need to install"\ - " python-dev|python-devel." % (python_h) - result = config_cmd.try_run(tc,include_dirs=[python_include], - library_dirs = default_lib_dirs) - if not result: - raise SystemError,"Failed to test configuration. "\ - "See previous error messages for more information." - - # Python 2.3 causes a segfault when - # trying to re-acquire the thread-state - # which is done in error-handling - # ufunc code. NPY_ALLOW_C_API and friends - # cause the segfault. So, we disable threading - # for now. - if sys.version[:5] < '2.4.2': - nosmp = 1 - else: - # Perhaps a fancier check is in order here. - # so that threads are only enabled if there - # are actually multiple CPUS? -- but - # threaded code can be nice even on a single - # CPU so that long-calculating code doesn't - # block. - try: - nosmp = os.environ['NPY_NOSMP'] - nosmp = 1 - except KeyError: - nosmp = 0 - moredefs = [] - # - mathlibs = [] - tc = testcode_mathlib() - mathlibs_choices = [[],['m'],['cpml']] - mathlib = os.environ.get('MATHLIB') - if mathlib: - mathlibs_choices.insert(0,mathlib.split(',')) - for libs in mathlibs_choices: - if config_cmd.try_run(tc,libraries=libs): - mathlibs = libs - break - else: - raise EnvironmentError("math library missing; rerun " - "setup.py after setting the " - "MATHLIB env variable") - ext.libraries.extend(mathlibs) - moredefs.append(('MATHLIB',','.join(mathlibs))) - - def check_func(func_name): - return config_cmd.check_func(func_name, - libraries=mathlibs, decl=False, - headers=['math.h']) - - for func_name, defsymbol in FUNCTIONS_TO_CHECK: - if check_func(func_name): - moredefs.append(defsymbol) - - if is_npy_no_signal(): - moredefs.append('NPY_NO_SIGNAL') - - if sys.platform=='win32' or os.name=='nt': - from distutils.msvccompiler import get_build_architecture - a = get_build_architecture() - print 'BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % (a, os.name, sys.platform) - if a == 'AMD64': - moredefs.append('DISTUTILS_USE_SDK') - - if sys.version[:3] < '2.4': - if config_cmd.check_func('strtod', decl=False, - headers=['stdlib.h']): - moredefs.append(('PyOS_ascii_strtod', 'strtod')) - - target_f = open(target,'a') - for d in moredefs: - if isinstance(d,str): - target_f.write('#define %s\n' % (d)) - else: - target_f.write('#define %s %s\n' % (d[0],d[1])) - # Define NPY_NOSMP to 1 if explicitely requested, or if we cannot - # support thread support reliably - if nosmp: - target_f.write('#define NPY_NOSMP 1\n') - else: - target_f.write('#define NPY_NOSMP 0\n') - target_f.close() - print 'File:',target - target_f = open(target) - print target_f.read() - target_f.close() - print 'EOF' - else: - mathlibs = [] - target_f = open(target) - for line in target_f.readlines(): - s = '#define MATHLIB' - if line.startswith(s): - value = line[len(s):].strip() - if value: - mathlibs.extend(value.split(',')) - target_f.close() - - ext.libraries.extend(mathlibs) - - incl_dir = os.path.dirname(target) - if incl_dir not in config.numpy_include_dirs: - config.numpy_include_dirs.append(incl_dir) - - config.add_data_files((header_dir,target)) - return target - - def generate_numpyconfig_h(ext, build_dir): - """Depends on config.h: generate_config_h has to be called before !""" - target = join(build_dir,'numpyconfig.h') - if newer(__file__,target): - config_cmd = config.get_config_cmd() - log.info('Generating %s',target) - testcode = generate_numpyconfig_code(target) - - from distutils import sysconfig - python_include = sysconfig.get_python_inc() - python_h = join(python_include, 'Python.h') - if not os.path.isfile(python_h): - raise SystemError,\ - "Non-existing %s. Perhaps you need to install"\ - " python-dev|python-devel." % (python_h) - - config.numpy_include_dirs - result = config_cmd.try_run(testcode, - include_dirs = [python_include] + \ - config.numpy_include_dirs, - library_dirs = default_lib_dirs) - - if not result: - raise SystemError,"Failed to generate numpy configuration. "\ - "See previous error messages for more information." - - print 'File: %s' % target - target_f = open(target) - print target_f.read() - target_f.close() - print 'EOF' - return target - - def generate_api_func(module_name): - def generate_api(ext, build_dir): - script = join(codegen_dir, module_name + '.py') - sys.path.insert(0, codegen_dir) - try: - m = __import__(module_name) - log.info('executing %s', script) - h_file, c_file, doc_file = m.generate_api(build_dir) - finally: - del sys.path[0] - config.add_data_files((header_dir, h_file), - (header_dir, doc_file)) - return (h_file,) - return generate_api - - generate_array_api = generate_api_func('generate_array_api') - generate_ufunc_api = generate_api_func('generate_ufunc_api') - - def generate_umath_c(ext,build_dir): - target = join(build_dir,'__umath_generated.c') - script = generate_umath_py - if newer(script,target): - f = open(target,'w') - f.write(generate_umath.make_code(generate_umath.defdict, - generate_umath.__file__)) - f.close() - return [] - - config.add_data_files('include/numpy/*.h') - config.add_include_dirs('src') - - config.numpy_include_dirs.extend(config.paths('include')) - - deps = [join('src','arrayobject.c'), - join('src','arraymethods.c'), - join('src','scalartypes.inc.src'), - join('src','arraytypes.inc.src'), - join('src','_signbit.c'), - join('src','_isnan.c'), - join('src','ucsnarrow.c'), - join('include','numpy','*object.h'), - 'include/numpy/fenv/fenv.c', - 'include/numpy/fenv/fenv.h', - join(codegen_dir,'genapi.py'), - join(codegen_dir,'*.txt') - ] - - # Don't install fenv unless we need them. - if sys.platform == 'cygwin': - config.add_data_dir('include/numpy/fenv') - - config.add_extension('multiarray', - sources = [join('src','multiarraymodule.c'), - generate_config_h, - generate_numpyconfig_h, - generate_array_api, - join('src','scalartypes.inc.src'), - join('src','arraytypes.inc.src'), - join(codegen_dir,'generate_array_api.py'), - join('*.py') - ], - depends = deps, - ) - - config.add_extension('umath', - sources = [generate_config_h, - generate_numpyconfig_h, - join('src','umathmodule.c.src'), - generate_umath_c, - generate_ufunc_api, - join('src','scalartypes.inc.src'), - join('src','arraytypes.inc.src'), - ], - depends = [join('src','ufuncobject.c'), - generate_umath_py, - join(codegen_dir,'generate_ufunc_api.py'), - ]+deps, - ) - - config.add_extension('_sort', - sources=[join('src','_sortmodule.c.src'), - generate_config_h, - generate_numpyconfig_h, - generate_array_api, - ], - ) - - config.add_extension('scalarmath', - sources=[join('src','scalarmathmodule.c.src'), - generate_config_h, - generate_numpyconfig_h, - generate_array_api, - generate_ufunc_api], - ) - - # Configure blasdot - blas_info = get_info('blas_opt',0) - #blas_info = {} - def get_dotblas_sources(ext, build_dir): - if blas_info: - if ('NO_ATLAS_INFO',1) in blas_info.get('define_macros',[]): - return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient. - return ext.depends[:1] - return None # no extension module will be built - - config.add_extension('_dotblas', - sources = [get_dotblas_sources], - depends=[join('blasdot','_dotblas.c'), - join('blasdot','cblas.h'), - ], - include_dirs = ['blasdot'], - extra_info = blas_info - ) - - - config.add_data_dir('tests') - config.make_svn_version_py() - - return config - -def testcode_mathlib(): - return """\ -/* check whether libm is broken */ -#include -int main(int argc, char *argv[]) -{ - return exp(-720.) > 1.0; /* typically an IEEE denormal */ -} -""" - -import sys -def generate_testcode(target): - if sys.platform == 'win32': - target = target.replace('\\','\\\\') - testcode = [r''' -#include -#include -#include - -int main(int argc, char **argv) -{ - - FILE *fp; - - fp = fopen("'''+target+'''","w"); - '''] - - c_size_test = r''' -#ifndef %(sz)s - fprintf(fp,"#define %(sz)s %%d\n", sizeof(%(type)s)); -#else - fprintf(fp,"/* #define %(sz)s %%d */\n", %(sz)s); -#endif -''' - for sz, t in [('SIZEOF_SHORT', 'short'), - ('SIZEOF_INT', 'int'), - ('SIZEOF_LONG', 'long'), - ('SIZEOF_FLOAT', 'float'), - ('SIZEOF_DOUBLE', 'double'), - ('SIZEOF_LONG_DOUBLE', 'long double'), - ('SIZEOF_PY_INTPTR_T', 'Py_intptr_t'), - ]: - testcode.append(c_size_test % {'sz' : sz, 'type' : t}) - - testcode.append('#ifdef PY_LONG_LONG') - testcode.append(c_size_test % {'sz' : 'SIZEOF_LONG_LONG', - 'type' : 'PY_LONG_LONG'}) - testcode.append(c_size_test % {'sz' : 'SIZEOF_PY_LONG_LONG', - 'type' : 'PY_LONG_LONG'}) - - - testcode.append(r''' -#else - fprintf(fp, "/* PY_LONG_LONG not defined */\n"); -#endif -#ifndef CHAR_BIT - { - unsigned char var = 2; - int i=0; - while (var >= 2) { - var = var << 1; - i++; - } - fprintf(fp,"#define CHAR_BIT %d\n", i+1); - } -#else - fprintf(fp, "/* #define CHAR_BIT %d */\n", CHAR_BIT); -#endif - fclose(fp); - return 0; -} -''') - testcode = '\n'.join(testcode) - return testcode - -def generate_numpyconfig_code(target): - """Return the source code as a string of the code to generate the - numpyconfig header file.""" - if sys.platform == 'win32': - target = target.replace('\\','\\\\') - # Config symbols to prepend - prepends = [('NPY_SIZEOF_SHORT', 'SIZEOF_SHORT'), - ('NPY_SIZEOF_INT', 'SIZEOF_INT'), - ('NPY_SIZEOF_LONG', 'SIZEOF_LONG'), - ('NPY_SIZEOF_FLOAT', 'SIZEOF_FLOAT'), - ('NPY_SIZEOF_DOUBLE', 'SIZEOF_DOUBLE'), - ('NPY_SIZEOF_LONGDOUBLE', 'SIZEOF_LONG_DOUBLE'), - ('NPY_SIZEOF_PY_INTPTR_T', 'SIZEOF_PY_INTPTR_T'), - ('NPY_NOSMP', 'NPY_NOSMP'),] - - testcode = [""" -#include -#include "config.h" - -int main() -{ - FILE* f; - - f = fopen("%s", "w"); - if (f == NULL) { - return -1; - } -""" % target] - - testcode.append(r""" - fprintf(f, "/*\n * This file is generated by %s. DO NOT EDIT \n */\n"); -""" % __file__) - - # Prepend NPY_ to any SIZEOF defines - testcode.extend([r' fprintf(f, "#define ' + i + r' %%d \n", %s);' % j for i, j in prepends]) - - # Conditionally define NPY_NO_SIGNAL - if is_npy_no_signal(): - testcode.append(r' fprintf(f, "\n#define NPY_NO_SIGNAL\n");') - - tmpcode = r""" - #ifdef PY_LONG_LONG - fprintf(f, "\n#define %s %%d \n", %s); - fprintf(f, "#define %s %%d \n", %s); - #else - fprintf(f, "/* PY_LONG_LONG not defined */ \n"); - #endif""" - testcode.append(tmpcode % ('NPY_SIZEOF_LONGLONG', 'SIZEOF_LONG_LONG', - 'NPY_SIZEOF_PY_LONG_LONG', 'SIZEOF_PY_LONG_LONG')) - - testcode.append(r""" -#ifndef CHAR_BIT - { - unsigned char var = 2; - int i = 0; - while (var >= 2) { - var = var << 1; - i++; - } - fprintf(f,"#define CHAR_BIT %d\n", i+1); - } -#else - fprintf(f, "/* #define CHAR_BIT %d */\n", CHAR_BIT); -#endif""") - - testcode.append(""" - fclose(f); - - return 0; -} -""") - return "\n".join(testcode) - -if __name__=='__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) - Copied: branches/numpy.scons/numpy/core/setup.py (from rev 4342, branches/numpy.scons/numpy/core/setupscons.py) Deleted: branches/numpy.scons/numpy/core/setupscons.py =================================================================== --- branches/numpy.scons/numpy/core/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,84 +0,0 @@ -import imp -import os -import sys -from os.path import join -from numpy.distutils import log -from distutils.dep_util import newer - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration,dot_join - from numpy.distutils.system_info import get_info, default_lib_dirs - - config = Configuration('core',parent_package,top_path) - local_dir = config.local_path - - header_dir = 'include/numpy' # this is relative to config.path_in_package - - # Add generated files to distutils... - def add_config_header(): - scons_build_dir = config.get_scons_build_dir() - # XXX: I really have to think about how to communicate path info - # between scons and distutils, and set the options at one single - # location. - target = join(scons_build_dir, local_dir, 'config.h') - incl_dir = os.path.dirname(target) - if incl_dir not in config.numpy_include_dirs: - config.numpy_include_dirs.append(incl_dir) - #config.add_data_files((header_dir, target)) - - def add_numpyconfig_header(): - scons_build_dir = config.get_scons_build_dir() - # XXX: I really have to think about how to communicate path info - # between scons and distutils, and set the options at one single - # location. - target = join(scons_build_dir, local_dir, 'numpyconfig.h') - incl_dir = os.path.dirname(target) - if incl_dir not in config.numpy_include_dirs: - config.numpy_include_dirs.append(incl_dir) - config.add_data_files((header_dir, target)) - - def add_array_api(): - scons_build_dir = config.get_scons_build_dir() - # XXX: I really have to think about how to communicate path info - # between scons and distutils, and set the options at one single - # location. - h_file = join(scons_build_dir, local_dir, '__multiarray_api.h') - t_file = join(scons_build_dir, local_dir, 'multiarray_api.txt') - config.add_data_files((header_dir, h_file), - (header_dir, t_file)) - - def add_ufunc_api(): - scons_build_dir = config.get_scons_build_dir() - # XXX: I really have to think about how to communicate path info - # between scons and distutils, and set the options at one single - # location. - h_file = join(scons_build_dir, local_dir, '__ufunc_api.h') - t_file = join(scons_build_dir, local_dir, 'ufunc_api.txt') - config.add_data_files((header_dir, h_file), - (header_dir, t_file)) - - def add_generated_files(): - add_config_header() - add_numpyconfig_header() - add_array_api() - add_ufunc_api() - - config.add_sconscript('SConstruct', post_hook = add_generated_files) - - config.add_data_files('include/numpy/*.h') - config.add_include_dirs('src') - - config.numpy_include_dirs.extend(config.paths('include')) - - # Don't install fenv unless we need them. - if sys.platform == 'cygwin': - config.add_data_dir('include/numpy/fenv') - - config.add_data_dir('tests') - config.make_svn_version_py() - - return config - -if __name__=='__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/distutils/setup.old.py (from rev 4342, branches/numpy.scons/numpy/distutils/setup.py) Deleted: branches/numpy.scons/numpy/distutils/setup.py =================================================================== --- branches/numpy.scons/numpy/distutils/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/distutils/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('distutils',parent_package,top_path) - config.add_subpackage('command') - config.add_subpackage('scons') - config.add_subpackage('fcompiler') - config.add_data_dir('tests') - config.add_data_files('site.cfg') - config.make_config_py() - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/distutils/setup.py (from rev 4342, branches/numpy.scons/numpy/distutils/setupscons.py) Deleted: branches/numpy.scons/numpy/distutils/setupscons.py =================================================================== --- branches/numpy.scons/numpy/distutils/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/distutils/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('distutils',parent_package,top_path) - config.add_subpackage('command') - config.add_subpackage('scons') - config.add_subpackage('fcompiler') - config.add_data_dir('tests') - config.add_data_files('site.cfg') - config.make_config_py() - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/f2py/setup.old.py (from rev 4342, branches/numpy.scons/numpy/f2py/setup.py) Deleted: branches/numpy.scons/numpy/f2py/setup.py =================================================================== --- branches/numpy.scons/numpy/f2py/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/f2py/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,130 +0,0 @@ -#!/usr/bin/env python -""" -setup.py for installing F2PY - -Usage: - python setup.py install - -Copyright 2001-2005 Pearu Peterson all rights reserved, -Pearu Peterson -Permission to use, modify, and distribute this software is given under the -terms of the NumPy License. - -NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. -$Revision: 1.32 $ -$Date: 2005/01/30 17:22:14 $ -Pearu Peterson -""" - -__version__ = "$Id: setup.py,v 1.32 2005/01/30 17:22:14 pearu Exp $" - -import os -import sys -from distutils.dep_util import newer -from numpy.distutils import log -from numpy.distutils.core import setup -from numpy.distutils.misc_util import Configuration - -from __version__ import version - -def configuration(parent_package='',top_path=None): - config = Configuration('f2py', parent_package, top_path) - - config.add_subpackage('lib') - - config.add_data_dir('docs') - - config.add_data_files('src/fortranobject.c', - 'src/fortranobject.h', - 'f2py.1' - ) - - config.make_svn_version_py() - - def generate_f2py_py(build_dir): - f2py_exe = 'f2py'+os.path.basename(sys.executable)[6:] - if f2py_exe[-4:]=='.exe': - f2py_exe = f2py_exe[:-4] + '.py' - if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py': - f2py_exe = f2py_exe + '.py' - target = os.path.join(build_dir,f2py_exe) - if newer(__file__,target): - log.info('Creating %s', target) - f = open(target,'w') - f.write('''\ -#!/usr/bin/env %s -# See http://cens.ioc.ee/projects/f2py2e/ -import os, sys -for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]: - try: - i=sys.argv.index("--"+mode) - del sys.argv[i] - break - except ValueError: pass -os.environ["NO_SCIPY_IMPORT"]="f2py" -if mode=="g3-numpy": - try: - from main import main - except ImportError: - from numpy.f2py.lib.api import main -elif mode=="2e-numeric": - from f2py2e import main -elif mode=="2e-numarray": - sys.argv.append("-DNUMARRAY") - from f2py2e import main -elif mode=="2e-numpy": - from numpy.f2py import main -else: - print >> sys.stderr, "Unknown mode:",`mode` - sys.exit(1) -main() -'''%(os.path.basename(sys.executable))) - f.close() - return target - - config.add_scripts(generate_f2py_py) - - log.info('F2PY Version %s', config.get_version()) - - return config - -if __name__ == "__main__": - - config = configuration(top_path='') - version = config.get_version() - print 'F2PY Version',version - config = config.todict() - - if sys.version[:3]>='2.3': - config['download_url'] = "http://cens.ioc.ee/projects/f2py2e/2.x"\ - "/F2PY-2-latest.tar.gz" - config['classifiers'] = [ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: NumPy License', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: C', - 'Programming Language :: Fortran', - 'Programming Language :: Python', - 'Topic :: Scientific/Engineering', - 'Topic :: Software Development :: Code Generators', - ] - setup(version=version, - description = "F2PY - Fortran to Python Interface Generaton", - author = "Pearu Peterson", - author_email = "pearu at cens.ioc.ee", - maintainer = "Pearu Peterson", - maintainer_email = "pearu at cens.ioc.ee", - license = "BSD", - platforms = "Unix, Windows (mingw|cygwin), Mac OSX", - long_description = """\ -The Fortran to Python Interface Generator, or F2PY for short, is a -command line tool (f2py) for generating Python C/API modules for -wrapping Fortran 77/90/95 subroutines, accessing common blocks from -Python, and calling Python functions from Fortran (call-backs). -Interfacing subroutines/data from Fortran 90/95 modules is supported.""", - url = "http://cens.ioc.ee/projects/f2py2e/", - keywords = ['Fortran','f2py'], - **config) Copied: branches/numpy.scons/numpy/f2py/setup.py (from rev 4342, branches/numpy.scons/numpy/f2py/setupscons.py) Deleted: branches/numpy.scons/numpy/f2py/setupscons.py =================================================================== --- branches/numpy.scons/numpy/f2py/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/f2py/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,130 +0,0 @@ -#!/usr/bin/env python -""" -setup.py for installing F2PY - -Usage: - python setup.py install - -Copyright 2001-2005 Pearu Peterson all rights reserved, -Pearu Peterson -Permission to use, modify, and distribute this software is given under the -terms of the NumPy License. - -NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. -$Revision: 1.32 $ -$Date: 2005/01/30 17:22:14 $ -Pearu Peterson -""" - -__version__ = "$Id: setup.py,v 1.32 2005/01/30 17:22:14 pearu Exp $" - -import os -import sys -from distutils.dep_util import newer -from numpy.distutils import log -from numpy.distutils.core import setup -from numpy.distutils.misc_util import Configuration - -from __version__ import version - -def configuration(parent_package='',top_path=None): - config = Configuration('f2py', parent_package, top_path) - - config.add_subpackage('lib') - - config.add_data_dir('docs') - - config.add_data_files('src/fortranobject.c', - 'src/fortranobject.h', - 'f2py.1' - ) - - config.make_svn_version_py() - - def generate_f2py_py(build_dir): - f2py_exe = 'f2py'+os.path.basename(sys.executable)[6:] - if f2py_exe[-4:]=='.exe': - f2py_exe = f2py_exe[:-4] + '.py' - if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py': - f2py_exe = f2py_exe + '.py' - target = os.path.join(build_dir,f2py_exe) - if newer(__file__,target): - log.info('Creating %s', target) - f = open(target,'w') - f.write('''\ -#!/usr/bin/env %s -# See http://cens.ioc.ee/projects/f2py2e/ -import os, sys -for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]: - try: - i=sys.argv.index("--"+mode) - del sys.argv[i] - break - except ValueError: pass -os.environ["NO_SCIPY_IMPORT"]="f2py" -if mode=="g3-numpy": - try: - from main import main - except ImportError: - from numpy.f2py.lib.api import main -elif mode=="2e-numeric": - from f2py2e import main -elif mode=="2e-numarray": - sys.argv.append("-DNUMARRAY") - from f2py2e import main -elif mode=="2e-numpy": - from numpy.f2py import main -else: - print >> sys.stderr, "Unknown mode:",`mode` - sys.exit(1) -main() -'''%(os.path.basename(sys.executable))) - f.close() - return target - - config.add_scripts(generate_f2py_py) - - log.info('F2PY Version %s', config.get_version()) - - return config - -if __name__ == "__main__": - - config = configuration(top_path='') - version = config.get_version() - print 'F2PY Version',version - config = config.todict() - - if sys.version[:3]>='2.3': - config['download_url'] = "http://cens.ioc.ee/projects/f2py2e/2.x"\ - "/F2PY-2-latest.tar.gz" - config['classifiers'] = [ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: NumPy License', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: C', - 'Programming Language :: Fortran', - 'Programming Language :: Python', - 'Topic :: Scientific/Engineering', - 'Topic :: Software Development :: Code Generators', - ] - setup(version=version, - description = "F2PY - Fortran to Python Interface Generaton", - author = "Pearu Peterson", - author_email = "pearu at cens.ioc.ee", - maintainer = "Pearu Peterson", - maintainer_email = "pearu at cens.ioc.ee", - license = "BSD", - platforms = "Unix, Windows (mingw|cygwin), Mac OSX", - long_description = """\ -The Fortran to Python Interface Generator, or F2PY for short, is a -command line tool (f2py) for generating Python C/API modules for -wrapping Fortran 77/90/95 subroutines, accessing common blocks from -Python, and calling Python functions from Fortran (call-backs). -Interfacing subroutines/data from Fortran 90/95 modules is supported.""", - url = "http://cens.ioc.ee/projects/f2py2e/", - keywords = ['Fortran','f2py'], - **config) Copied: branches/numpy.scons/numpy/fft/setup.old.py (from rev 4342, branches/numpy.scons/numpy/fft/setup.py) Deleted: branches/numpy.scons/numpy/fft/setup.py =================================================================== --- branches/numpy.scons/numpy/fft/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/fft/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,19 +0,0 @@ - - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('fft',parent_package,top_path) - - config.add_data_dir('tests') - - # Configure fftpack_lite - config.add_extension('fftpack_lite', - sources=['fftpack_litemodule.c', 'fftpack.c'] - ) - - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/fft/setup.py (from rev 4342, branches/numpy.scons/numpy/fft/setupscons.py) Deleted: branches/numpy.scons/numpy/fft/setupscons.py =================================================================== --- branches/numpy.scons/numpy/fft/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/fft/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,14 +0,0 @@ -def configuration(parent_package = '', top_path = None): - from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs - config = Configuration('fft', parent_package, top_path) - - config.add_data_dir('tests') - - # Configure fftpack_lite - config.add_sconscript('SConstruct') - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/lib/setup.old.py (from rev 4342, branches/numpy.scons/numpy/lib/setup.py) Deleted: branches/numpy.scons/numpy/lib/setup.py =================================================================== --- branches/numpy.scons/numpy/lib/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/lib/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,21 +0,0 @@ -from os.path import join - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - - config = Configuration('lib',parent_package,top_path) - - config.add_include_dirs(join('..','core','include')) - - - config.add_extension('_compiled_base', - sources=[join('src','_compiled_base.c')] - ) - - config.add_data_dir('tests') - - return config - -if __name__=='__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/lib/setup.py (from rev 4342, branches/numpy.scons/numpy/lib/setupscons.py) Deleted: branches/numpy.scons/numpy/lib/setupscons.py =================================================================== --- branches/numpy.scons/numpy/lib/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/lib/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,15 +0,0 @@ -from os.path import join - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - - config = Configuration('lib',parent_package,top_path) - - config.add_sconscript('SConstruct') - config.add_data_dir('tests') - - return config - -if __name__=='__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/linalg/setup.old.py (from rev 4342, branches/numpy.scons/numpy/linalg/setup.py) Deleted: branches/numpy.scons/numpy/linalg/setup.py =================================================================== --- branches/numpy.scons/numpy/linalg/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/linalg/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,31 +0,0 @@ - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - from numpy.distutils.system_info import get_info - config = Configuration('linalg',parent_package,top_path) - - config.add_data_dir('tests') - - # Configure lapack_lite - lapack_info = get_info('lapack_opt',0) - def get_lapack_lite_sources(ext, build_dir): - if not lapack_info: - print "### Warning: Using unoptimized lapack ###" - return ext.depends[:-1] - else: - return ext.depends[:1] - - config.add_extension('lapack_lite', - sources = [get_lapack_lite_sources], - depends= ['lapack_litemodule.c', - 'zlapack_lite.c', 'dlapack_lite.c', - 'blas_lite.c', 'dlamch.c', - 'f2c_lite.c','f2c.h'], - extra_info = lapack_info - ) - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/linalg/setup.py (from rev 4342, branches/numpy.scons/numpy/linalg/setupscons.py) Deleted: branches/numpy.scons/numpy/linalg/setupscons.py =================================================================== --- branches/numpy.scons/numpy/linalg/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/linalg/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,17 +0,0 @@ - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - from numpy.distutils.system_info import get_info - config = Configuration('linalg',parent_package,top_path) - - config.add_data_dir('tests') - - print "### Warning: Using unoptimized lapack ###" - - config.add_sconscript('SConstruct') - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/numarray/setup.old.py (from rev 4342, branches/numpy.scons/numpy/numarray/setup.py) Deleted: branches/numpy.scons/numpy/numarray/setup.py =================================================================== --- branches/numpy.scons/numpy/numarray/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/numarray/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,17 +0,0 @@ -from os.path import join - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('numarray',parent_package,top_path) - - config.add_data_files('numpy/') - - config.add_extension('_capi', - sources=['_capi.c'], - ) - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/numarray/setup.py (from rev 4342, branches/numpy.scons/numpy/numarray/setupscons.py) Deleted: branches/numpy.scons/numpy/numarray/setupscons.py =================================================================== --- branches/numpy.scons/numpy/numarray/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/numarray/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,14 +0,0 @@ -from os.path import join - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('numarray',parent_package,top_path) - - config.add_data_files('numpy/') - config.add_sconscript('SConstruct') - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/oldnumeric/setup.old.py (from rev 4342, branches/numpy.scons/numpy/oldnumeric/setup.py) Deleted: branches/numpy.scons/numpy/oldnumeric/setup.py =================================================================== --- branches/numpy.scons/numpy/oldnumeric/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/oldnumeric/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,8 +0,0 @@ - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - return Configuration('oldnumeric',parent_package,top_path) - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/oldnumeric/setup.py (from rev 4342, branches/numpy.scons/numpy/oldnumeric/setupscons.py) Deleted: branches/numpy.scons/numpy/oldnumeric/setupscons.py =================================================================== --- branches/numpy.scons/numpy/oldnumeric/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/oldnumeric/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,8 +0,0 @@ - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - return Configuration('oldnumeric',parent_package,top_path) - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/random/setup.old.py (from rev 4342, branches/numpy.scons/numpy/random/setup.py) Deleted: branches/numpy.scons/numpy/random/setup.py =================================================================== --- branches/numpy.scons/numpy/random/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/random/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,53 +0,0 @@ -from os.path import join, split - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration, get_mathlibs - config = Configuration('random',parent_package,top_path) - - def generate_libraries(ext, build_dir): - config_cmd = config.get_config_cmd() - if top_path is None: - libs = get_mathlibs() - else: - path = join(split(build_dir)[0],'core') - libs = get_mathlibs(path) - tc = testcode_wincrypt() - if config_cmd.try_run(tc): - libs.append('Advapi32') - ext.libraries.extend(libs) - return None - - libs = [] - # Configure mtrand - config.add_extension('mtrand', - sources=[join('mtrand', x) for x in - ['mtrand.c', 'randomkit.c', 'initarray.c', - 'distributions.c']]+[generate_libraries], - libraries=libs, - depends = [join('mtrand','*.h'), - join('mtrand','*.pyx'), - join('mtrand','*.pxi'), - ] - ) - - config.add_data_files(('.', join('mtrand', 'randomkit.h'))) - config.add_data_dir('tests') - - return config - -def testcode_wincrypt(): - return """\ -/* check to see if _WIN32 is defined */ -int main(int argc, char *argv[]) -{ -#ifdef _WIN32 - return 0; -#else - return 1; -#endif -} -""" - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/random/setup.py (from rev 4342, branches/numpy.scons/numpy/random/setupscons.py) Deleted: branches/numpy.scons/numpy/random/setupscons.py =================================================================== --- branches/numpy.scons/numpy/random/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/random/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,28 +0,0 @@ -from os.path import join, split - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration, get_mathlibs - config = Configuration('random',parent_package,top_path) - - config.add_sconscript('SConstruct') - config.add_data_files(('.', join('mtrand', 'randomkit.h'))) - config.add_data_dir('tests') - - return config - -def testcode_wincrypt(): - return """\ -/* check to see if _WIN32 is defined */ -int main(int argc, char *argv[]) -{ -#ifdef _WIN32 - return 0; -#else - return 1; -#endif -} -""" - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/scons_fake/setup.old.py (from rev 4342, branches/numpy.scons/numpy/scons_fake/setup.py) Deleted: branches/numpy.scons/numpy/scons_fake/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,17 +0,0 @@ -import os -import os.path - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('scons_fake',parent_package,top_path) - - config.add_subpackage('pyext') - config.add_subpackage('ctypesext') - config.add_subpackage('checklib') - config.add_subpackage('checkers') - config.add_subpackage('hook') - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/scons_fake/setup.py (from rev 4342, branches/numpy.scons/numpy/scons_fake/setupscons.py) Deleted: branches/numpy.scons/numpy/scons_fake/setupscons.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/scons_fake/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,17 +0,0 @@ -import os -import os.path - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('scons_fake',parent_package,top_path) - - config.add_subpackage('pyext') - config.add_subpackage('ctypesext') - config.add_subpackage('checklib') - config.add_subpackage('checkers') - config.add_subpackage('hook') - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/setup.old.py (from rev 4342, branches/numpy.scons/numpy/setup.py) Deleted: branches/numpy.scons/numpy/setup.py =================================================================== --- branches/numpy.scons/numpy/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,23 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('numpy',parent_package,top_path) - config.add_subpackage('distutils') - config.add_subpackage('scons_fake') - config.add_subpackage('testing') - config.add_subpackage('f2py') - config.add_subpackage('core') - config.add_subpackage('lib') - config.add_subpackage('oldnumeric') - config.add_subpackage('numarray') - config.add_subpackage('fft') - config.add_subpackage('linalg') - config.add_subpackage('random') - config.add_data_dir('doc') - config.add_data_dir('tests') - config.make_config_py() # installs __config__.py - return config - -if __name__ == '__main__': - print 'This is the wrong setup.py file to run' Copied: branches/numpy.scons/numpy/setup.py (from rev 4342, branches/numpy.scons/numpy/setupscons.py) Deleted: branches/numpy.scons/numpy/setupscons.py =================================================================== --- branches/numpy.scons/numpy/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,28 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('numpy',parent_package,top_path, setup_name = 'setupscons.py') - config.add_subpackage('distutils') - config.add_subpackage('scons_fake') - config.add_subpackage('testing') - config.add_subpackage('f2py') - config.add_subpackage('core') - config.add_subpackage('lib') - config.add_subpackage('oldnumeric') - config.add_subpackage('numarray') - config.add_subpackage('fft') - config.add_subpackage('linalg') - config.add_subpackage('random') - config.add_data_dir('doc') - config.add_data_dir('tests') - # The following empty extension is done on purpose to fool distutils, and - # process as usual, even if we do not build any extension (because we use - # scons instead). - # !! DO NOT REMOVE THIS !! - config.add_extension('', sources = []) - config.make_config_py() # installs __config__.py - return config - -if __name__ == '__main__': - print 'This is the wrong setup.py file to run' Copied: branches/numpy.scons/numpy/testing/setup.old.py (from rev 4342, branches/numpy.scons/numpy/testing/setup.py) Deleted: branches/numpy.scons/numpy/testing/setup.py =================================================================== --- branches/numpy.scons/numpy/testing/setup.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/testing/setup.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('testing',parent_package,top_path) - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(maintainer = "NumPy Developers", - maintainer_email = "numpy-dev at numpy.org", - description = "NumPy test module", - url = "http://www.numpy.org", - license = "NumPy License (BSD Style)", - configuration = configuration, - ) Copied: branches/numpy.scons/numpy/testing/setup.py (from rev 4342, branches/numpy.scons/numpy/testing/setupscons.py) Deleted: branches/numpy.scons/numpy/testing/setupscons.py =================================================================== --- branches/numpy.scons/numpy/testing/setupscons.py 2007-10-30 04:12:38 UTC (rev 4343) +++ branches/numpy.scons/numpy/testing/setupscons.py 2007-10-30 04:16:43 UTC (rev 4344) @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('testing',parent_package,top_path) - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(maintainer = "NumPy Developers", - maintainer_email = "numpy-dev at numpy.org", - description = "NumPy test module", - url = "http://www.numpy.org", - license = "NumPy License (BSD Style)", - configuration = configuration, - ) From numpy-svn at scipy.org Tue Oct 30 01:17:25 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 00:17:25 -0500 (CDT) Subject: [Numpy-svn] r4345 - branches/numpy.scons Message-ID: <20071030051725.118F639C16C@new.scipy.org> Author: cdavid Date: 2007-10-30 00:17:21 -0500 (Tue, 30 Oct 2007) New Revision: 4345 Modified: branches/numpy.scons/testsdist.sh Log: Get automatically svn version Modified: branches/numpy.scons/testsdist.sh =================================================================== --- branches/numpy.scons/testsdist.sh 2007-10-30 04:16:43 UTC (rev 4344) +++ branches/numpy.scons/testsdist.sh 2007-10-30 05:17:21 UTC (rev 4345) @@ -1,5 +1,5 @@ PREFIX=$PWD -SVNVER=4342 +SVNVER=`svn info | grep "Revision: [0-9]*" | tr -d \ | cut -f2 -d:` rm -rf $PREFIX/build rm -rf $PREFIX/dist python setup.py sdist From numpy-svn at scipy.org Tue Oct 30 01:49:20 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 00:49:20 -0500 (CDT) Subject: [Numpy-svn] r4346 - branches/numpy.scons Message-ID: <20071030054920.4D73039C083@new.scipy.org> Author: cdavid Date: 2007-10-30 00:49:16 -0500 (Tue, 30 Oct 2007) New Revision: 4346 Modified: branches/numpy.scons/testsdist.sh Log: Revert back to revision 4342, to track distribution problems with sdist ... Modified: branches/numpy.scons/testsdist.sh =================================================================== --- branches/numpy.scons/testsdist.sh 2007-10-30 05:17:21 UTC (rev 4345) +++ branches/numpy.scons/testsdist.sh 2007-10-30 05:49:16 UTC (rev 4346) @@ -1,5 +1,6 @@ PREFIX=$PWD -SVNVER=`svn info | grep "Revision: [0-9]*" | tr -d \ | cut -f2 -d:` +#SVNVER=`svn info | grep "Revision: [0-9]*" | tr -d \ | cut -f2 -d:` +SVNVER=4342 rm -rf $PREFIX/build rm -rf $PREFIX/dist python setup.py sdist From numpy-svn at scipy.org Tue Oct 30 02:15:40 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 01:15:40 -0500 (CDT) Subject: [Numpy-svn] r4347 - in branches/numpy.scons: . numpy numpy/core numpy/distutils numpy/f2py numpy/fft numpy/lib numpy/linalg numpy/numarray numpy/oldnumeric numpy/random numpy/scons_fake numpy/testing Message-ID: <20071030061540.3CCE239C073@new.scipy.org> Author: cdavid Date: 2007-10-30 01:14:45 -0500 (Tue, 30 Oct 2007) New Revision: 4347 Added: branches/numpy.scons/numpy/core/setup.py branches/numpy.scons/numpy/core/setupscons.py branches/numpy.scons/numpy/distutils/setup.py branches/numpy.scons/numpy/distutils/setupscons.py branches/numpy.scons/numpy/f2py/setup.py branches/numpy.scons/numpy/f2py/setupscons.py branches/numpy.scons/numpy/fft/setup.py branches/numpy.scons/numpy/fft/setupscons.py branches/numpy.scons/numpy/lib/setup.py branches/numpy.scons/numpy/lib/setupscons.py branches/numpy.scons/numpy/linalg/setup.py branches/numpy.scons/numpy/linalg/setupscons.py branches/numpy.scons/numpy/numarray/setup.py branches/numpy.scons/numpy/numarray/setupscons.py branches/numpy.scons/numpy/oldnumeric/setup.py branches/numpy.scons/numpy/oldnumeric/setupscons.py branches/numpy.scons/numpy/random/setup.py branches/numpy.scons/numpy/random/setupscons.py branches/numpy.scons/numpy/scons_fake/setup.py branches/numpy.scons/numpy/scons_fake/setupscons.py branches/numpy.scons/numpy/setup.py branches/numpy.scons/numpy/setupscons.py branches/numpy.scons/numpy/testing/setup.py branches/numpy.scons/numpy/testing/setupscons.py Removed: branches/numpy.scons/numpy/core/setup.old.py branches/numpy.scons/numpy/core/setup.py branches/numpy.scons/numpy/distutils/setup.old.py branches/numpy.scons/numpy/distutils/setup.py branches/numpy.scons/numpy/f2py/setup.old.py branches/numpy.scons/numpy/f2py/setup.py branches/numpy.scons/numpy/fft/setup.old.py branches/numpy.scons/numpy/fft/setup.py branches/numpy.scons/numpy/lib/setup.old.py branches/numpy.scons/numpy/lib/setup.py branches/numpy.scons/numpy/linalg/setup.old.py branches/numpy.scons/numpy/linalg/setup.py branches/numpy.scons/numpy/numarray/setup.old.py branches/numpy.scons/numpy/numarray/setup.py branches/numpy.scons/numpy/oldnumeric/setup.old.py branches/numpy.scons/numpy/oldnumeric/setup.py branches/numpy.scons/numpy/random/setup.old.py branches/numpy.scons/numpy/random/setup.py branches/numpy.scons/numpy/scons_fake/setup.old.py branches/numpy.scons/numpy/scons_fake/setup.py branches/numpy.scons/numpy/setup.old.py branches/numpy.scons/numpy/setup.py branches/numpy.scons/numpy/testing/setup.old.py branches/numpy.scons/numpy/testing/setup.py Modified: branches/numpy.scons/testsdist.sh Log: Correctly reverting back to rev 4342 using negative merge Deleted: branches/numpy.scons/numpy/core/setup.old.py =================================================================== --- branches/numpy.scons/numpy/core/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/core/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,466 +0,0 @@ -import imp -import os -import sys -from os.path import join -from numpy.distutils import log -from distutils.dep_util import newer - -FUNCTIONS_TO_CHECK = [ - ('expl', 'HAVE_LONGDOUBLE_FUNCS'), - ('expf', 'HAVE_FLOAT_FUNCS'), - ('log1p', 'HAVE_LOG1P'), - ('expm1', 'HAVE_EXPM1'), - ('asinh', 'HAVE_INVERSE_HYPERBOLIC'), - ('atanhf', 'HAVE_INVERSE_HYPERBOLIC_FLOAT'), - ('atanhl', 'HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE'), - ('isnan', 'HAVE_ISNAN'), - ('isinf', 'HAVE_ISINF'), - ('rint', 'HAVE_RINT'), - ] - -def is_npy_no_signal(): - """Return True if the NPY_NO_SIGNAL symbol must be defined in configuration - header.""" - return sys.platform == 'win32' - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration,dot_join - from numpy.distutils.system_info import get_info, default_lib_dirs - - config = Configuration('core',parent_package,top_path) - local_dir = config.local_path - codegen_dir = join(local_dir,'code_generators') - - generate_umath_py = join(codegen_dir,'generate_umath.py') - n = dot_join(config.name,'generate_umath') - generate_umath = imp.load_module('_'.join(n.split('.')), - open(generate_umath_py,'U'),generate_umath_py, - ('.py','U',1)) - - header_dir = 'include/numpy' # this is relative to config.path_in_package - - def generate_config_h(ext, build_dir): - target = join(build_dir,'config.h') - if newer(__file__,target): - config_cmd = config.get_config_cmd() - log.info('Generating %s',target) - tc = generate_testcode(target) - from distutils import sysconfig - python_include = sysconfig.get_python_inc() - python_h = join(python_include, 'Python.h') - if not os.path.isfile(python_h): - raise SystemError,\ - "Non-existing %s. Perhaps you need to install"\ - " python-dev|python-devel." % (python_h) - result = config_cmd.try_run(tc,include_dirs=[python_include], - library_dirs = default_lib_dirs) - if not result: - raise SystemError,"Failed to test configuration. "\ - "See previous error messages for more information." - - # Python 2.3 causes a segfault when - # trying to re-acquire the thread-state - # which is done in error-handling - # ufunc code. NPY_ALLOW_C_API and friends - # cause the segfault. So, we disable threading - # for now. - if sys.version[:5] < '2.4.2': - nosmp = 1 - else: - # Perhaps a fancier check is in order here. - # so that threads are only enabled if there - # are actually multiple CPUS? -- but - # threaded code can be nice even on a single - # CPU so that long-calculating code doesn't - # block. - try: - nosmp = os.environ['NPY_NOSMP'] - nosmp = 1 - except KeyError: - nosmp = 0 - moredefs = [] - # - mathlibs = [] - tc = testcode_mathlib() - mathlibs_choices = [[],['m'],['cpml']] - mathlib = os.environ.get('MATHLIB') - if mathlib: - mathlibs_choices.insert(0,mathlib.split(',')) - for libs in mathlibs_choices: - if config_cmd.try_run(tc,libraries=libs): - mathlibs = libs - break - else: - raise EnvironmentError("math library missing; rerun " - "setup.py after setting the " - "MATHLIB env variable") - ext.libraries.extend(mathlibs) - moredefs.append(('MATHLIB',','.join(mathlibs))) - - def check_func(func_name): - return config_cmd.check_func(func_name, - libraries=mathlibs, decl=False, - headers=['math.h']) - - for func_name, defsymbol in FUNCTIONS_TO_CHECK: - if check_func(func_name): - moredefs.append(defsymbol) - - if is_npy_no_signal(): - moredefs.append('NPY_NO_SIGNAL') - - if sys.platform=='win32' or os.name=='nt': - from distutils.msvccompiler import get_build_architecture - a = get_build_architecture() - print 'BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % (a, os.name, sys.platform) - if a == 'AMD64': - moredefs.append('DISTUTILS_USE_SDK') - - if sys.version[:3] < '2.4': - if config_cmd.check_func('strtod', decl=False, - headers=['stdlib.h']): - moredefs.append(('PyOS_ascii_strtod', 'strtod')) - - target_f = open(target,'a') - for d in moredefs: - if isinstance(d,str): - target_f.write('#define %s\n' % (d)) - else: - target_f.write('#define %s %s\n' % (d[0],d[1])) - # Define NPY_NOSMP to 1 if explicitely requested, or if we cannot - # support thread support reliably - if nosmp: - target_f.write('#define NPY_NOSMP 1\n') - else: - target_f.write('#define NPY_NOSMP 0\n') - target_f.close() - print 'File:',target - target_f = open(target) - print target_f.read() - target_f.close() - print 'EOF' - else: - mathlibs = [] - target_f = open(target) - for line in target_f.readlines(): - s = '#define MATHLIB' - if line.startswith(s): - value = line[len(s):].strip() - if value: - mathlibs.extend(value.split(',')) - target_f.close() - - ext.libraries.extend(mathlibs) - - incl_dir = os.path.dirname(target) - if incl_dir not in config.numpy_include_dirs: - config.numpy_include_dirs.append(incl_dir) - - config.add_data_files((header_dir,target)) - return target - - def generate_numpyconfig_h(ext, build_dir): - """Depends on config.h: generate_config_h has to be called before !""" - target = join(build_dir,'numpyconfig.h') - if newer(__file__,target): - config_cmd = config.get_config_cmd() - log.info('Generating %s',target) - testcode = generate_numpyconfig_code(target) - - from distutils import sysconfig - python_include = sysconfig.get_python_inc() - python_h = join(python_include, 'Python.h') - if not os.path.isfile(python_h): - raise SystemError,\ - "Non-existing %s. Perhaps you need to install"\ - " python-dev|python-devel." % (python_h) - - config.numpy_include_dirs - result = config_cmd.try_run(testcode, - include_dirs = [python_include] + \ - config.numpy_include_dirs, - library_dirs = default_lib_dirs) - - if not result: - raise SystemError,"Failed to generate numpy configuration. "\ - "See previous error messages for more information." - - print 'File: %s' % target - target_f = open(target) - print target_f.read() - target_f.close() - print 'EOF' - return target - - def generate_api_func(module_name): - def generate_api(ext, build_dir): - script = join(codegen_dir, module_name + '.py') - sys.path.insert(0, codegen_dir) - try: - m = __import__(module_name) - log.info('executing %s', script) - h_file, c_file, doc_file = m.generate_api(build_dir) - finally: - del sys.path[0] - config.add_data_files((header_dir, h_file), - (header_dir, doc_file)) - return (h_file,) - return generate_api - - generate_array_api = generate_api_func('generate_array_api') - generate_ufunc_api = generate_api_func('generate_ufunc_api') - - def generate_umath_c(ext,build_dir): - target = join(build_dir,'__umath_generated.c') - script = generate_umath_py - if newer(script,target): - f = open(target,'w') - f.write(generate_umath.make_code(generate_umath.defdict, - generate_umath.__file__)) - f.close() - return [] - - config.add_data_files('include/numpy/*.h') - config.add_include_dirs('src') - - config.numpy_include_dirs.extend(config.paths('include')) - - deps = [join('src','arrayobject.c'), - join('src','arraymethods.c'), - join('src','scalartypes.inc.src'), - join('src','arraytypes.inc.src'), - join('src','_signbit.c'), - join('src','_isnan.c'), - join('src','ucsnarrow.c'), - join('include','numpy','*object.h'), - 'include/numpy/fenv/fenv.c', - 'include/numpy/fenv/fenv.h', - join(codegen_dir,'genapi.py'), - join(codegen_dir,'*.txt') - ] - - # Don't install fenv unless we need them. - if sys.platform == 'cygwin': - config.add_data_dir('include/numpy/fenv') - - config.add_extension('multiarray', - sources = [join('src','multiarraymodule.c'), - generate_config_h, - generate_numpyconfig_h, - generate_array_api, - join('src','scalartypes.inc.src'), - join('src','arraytypes.inc.src'), - join(codegen_dir,'generate_array_api.py'), - join('*.py') - ], - depends = deps, - ) - - config.add_extension('umath', - sources = [generate_config_h, - generate_numpyconfig_h, - join('src','umathmodule.c.src'), - generate_umath_c, - generate_ufunc_api, - join('src','scalartypes.inc.src'), - join('src','arraytypes.inc.src'), - ], - depends = [join('src','ufuncobject.c'), - generate_umath_py, - join(codegen_dir,'generate_ufunc_api.py'), - ]+deps, - ) - - config.add_extension('_sort', - sources=[join('src','_sortmodule.c.src'), - generate_config_h, - generate_numpyconfig_h, - generate_array_api, - ], - ) - - config.add_extension('scalarmath', - sources=[join('src','scalarmathmodule.c.src'), - generate_config_h, - generate_numpyconfig_h, - generate_array_api, - generate_ufunc_api], - ) - - # Configure blasdot - blas_info = get_info('blas_opt',0) - #blas_info = {} - def get_dotblas_sources(ext, build_dir): - if blas_info: - if ('NO_ATLAS_INFO',1) in blas_info.get('define_macros',[]): - return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient. - return ext.depends[:1] - return None # no extension module will be built - - config.add_extension('_dotblas', - sources = [get_dotblas_sources], - depends=[join('blasdot','_dotblas.c'), - join('blasdot','cblas.h'), - ], - include_dirs = ['blasdot'], - extra_info = blas_info - ) - - - config.add_data_dir('tests') - config.make_svn_version_py() - - return config - -def testcode_mathlib(): - return """\ -/* check whether libm is broken */ -#include -int main(int argc, char *argv[]) -{ - return exp(-720.) > 1.0; /* typically an IEEE denormal */ -} -""" - -import sys -def generate_testcode(target): - if sys.platform == 'win32': - target = target.replace('\\','\\\\') - testcode = [r''' -#include -#include -#include - -int main(int argc, char **argv) -{ - - FILE *fp; - - fp = fopen("'''+target+'''","w"); - '''] - - c_size_test = r''' -#ifndef %(sz)s - fprintf(fp,"#define %(sz)s %%d\n", sizeof(%(type)s)); -#else - fprintf(fp,"/* #define %(sz)s %%d */\n", %(sz)s); -#endif -''' - for sz, t in [('SIZEOF_SHORT', 'short'), - ('SIZEOF_INT', 'int'), - ('SIZEOF_LONG', 'long'), - ('SIZEOF_FLOAT', 'float'), - ('SIZEOF_DOUBLE', 'double'), - ('SIZEOF_LONG_DOUBLE', 'long double'), - ('SIZEOF_PY_INTPTR_T', 'Py_intptr_t'), - ]: - testcode.append(c_size_test % {'sz' : sz, 'type' : t}) - - testcode.append('#ifdef PY_LONG_LONG') - testcode.append(c_size_test % {'sz' : 'SIZEOF_LONG_LONG', - 'type' : 'PY_LONG_LONG'}) - testcode.append(c_size_test % {'sz' : 'SIZEOF_PY_LONG_LONG', - 'type' : 'PY_LONG_LONG'}) - - - testcode.append(r''' -#else - fprintf(fp, "/* PY_LONG_LONG not defined */\n"); -#endif -#ifndef CHAR_BIT - { - unsigned char var = 2; - int i=0; - while (var >= 2) { - var = var << 1; - i++; - } - fprintf(fp,"#define CHAR_BIT %d\n", i+1); - } -#else - fprintf(fp, "/* #define CHAR_BIT %d */\n", CHAR_BIT); -#endif - fclose(fp); - return 0; -} -''') - testcode = '\n'.join(testcode) - return testcode - -def generate_numpyconfig_code(target): - """Return the source code as a string of the code to generate the - numpyconfig header file.""" - if sys.platform == 'win32': - target = target.replace('\\','\\\\') - # Config symbols to prepend - prepends = [('NPY_SIZEOF_SHORT', 'SIZEOF_SHORT'), - ('NPY_SIZEOF_INT', 'SIZEOF_INT'), - ('NPY_SIZEOF_LONG', 'SIZEOF_LONG'), - ('NPY_SIZEOF_FLOAT', 'SIZEOF_FLOAT'), - ('NPY_SIZEOF_DOUBLE', 'SIZEOF_DOUBLE'), - ('NPY_SIZEOF_LONGDOUBLE', 'SIZEOF_LONG_DOUBLE'), - ('NPY_SIZEOF_PY_INTPTR_T', 'SIZEOF_PY_INTPTR_T'), - ('NPY_NOSMP', 'NPY_NOSMP'),] - - testcode = [""" -#include -#include "config.h" - -int main() -{ - FILE* f; - - f = fopen("%s", "w"); - if (f == NULL) { - return -1; - } -""" % target] - - testcode.append(r""" - fprintf(f, "/*\n * This file is generated by %s. DO NOT EDIT \n */\n"); -""" % __file__) - - # Prepend NPY_ to any SIZEOF defines - testcode.extend([r' fprintf(f, "#define ' + i + r' %%d \n", %s);' % j for i, j in prepends]) - - # Conditionally define NPY_NO_SIGNAL - if is_npy_no_signal(): - testcode.append(r' fprintf(f, "\n#define NPY_NO_SIGNAL\n");') - - tmpcode = r""" - #ifdef PY_LONG_LONG - fprintf(f, "\n#define %s %%d \n", %s); - fprintf(f, "#define %s %%d \n", %s); - #else - fprintf(f, "/* PY_LONG_LONG not defined */ \n"); - #endif""" - testcode.append(tmpcode % ('NPY_SIZEOF_LONGLONG', 'SIZEOF_LONG_LONG', - 'NPY_SIZEOF_PY_LONG_LONG', 'SIZEOF_PY_LONG_LONG')) - - testcode.append(r""" -#ifndef CHAR_BIT - { - unsigned char var = 2; - int i = 0; - while (var >= 2) { - var = var << 1; - i++; - } - fprintf(f,"#define CHAR_BIT %d\n", i+1); - } -#else - fprintf(f, "/* #define CHAR_BIT %d */\n", CHAR_BIT); -#endif""") - - testcode.append(""" - fclose(f); - - return 0; -} -""") - return "\n".join(testcode) - -if __name__=='__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) - Deleted: branches/numpy.scons/numpy/core/setup.py =================================================================== --- branches/numpy.scons/numpy/core/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/core/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,84 +0,0 @@ -import imp -import os -import sys -from os.path import join -from numpy.distutils import log -from distutils.dep_util import newer - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration,dot_join - from numpy.distutils.system_info import get_info, default_lib_dirs - - config = Configuration('core',parent_package,top_path) - local_dir = config.local_path - - header_dir = 'include/numpy' # this is relative to config.path_in_package - - # Add generated files to distutils... - def add_config_header(): - scons_build_dir = config.get_scons_build_dir() - # XXX: I really have to think about how to communicate path info - # between scons and distutils, and set the options at one single - # location. - target = join(scons_build_dir, local_dir, 'config.h') - incl_dir = os.path.dirname(target) - if incl_dir not in config.numpy_include_dirs: - config.numpy_include_dirs.append(incl_dir) - #config.add_data_files((header_dir, target)) - - def add_numpyconfig_header(): - scons_build_dir = config.get_scons_build_dir() - # XXX: I really have to think about how to communicate path info - # between scons and distutils, and set the options at one single - # location. - target = join(scons_build_dir, local_dir, 'numpyconfig.h') - incl_dir = os.path.dirname(target) - if incl_dir not in config.numpy_include_dirs: - config.numpy_include_dirs.append(incl_dir) - config.add_data_files((header_dir, target)) - - def add_array_api(): - scons_build_dir = config.get_scons_build_dir() - # XXX: I really have to think about how to communicate path info - # between scons and distutils, and set the options at one single - # location. - h_file = join(scons_build_dir, local_dir, '__multiarray_api.h') - t_file = join(scons_build_dir, local_dir, 'multiarray_api.txt') - config.add_data_files((header_dir, h_file), - (header_dir, t_file)) - - def add_ufunc_api(): - scons_build_dir = config.get_scons_build_dir() - # XXX: I really have to think about how to communicate path info - # between scons and distutils, and set the options at one single - # location. - h_file = join(scons_build_dir, local_dir, '__ufunc_api.h') - t_file = join(scons_build_dir, local_dir, 'ufunc_api.txt') - config.add_data_files((header_dir, h_file), - (header_dir, t_file)) - - def add_generated_files(): - add_config_header() - add_numpyconfig_header() - add_array_api() - add_ufunc_api() - - config.add_sconscript('SConstruct', post_hook = add_generated_files) - - config.add_data_files('include/numpy/*.h') - config.add_include_dirs('src') - - config.numpy_include_dirs.extend(config.paths('include')) - - # Don't install fenv unless we need them. - if sys.platform == 'cygwin': - config.add_data_dir('include/numpy/fenv') - - config.add_data_dir('tests') - config.make_svn_version_py() - - return config - -if __name__=='__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/core/setup.py (from rev 4343, branches/numpy.scons/numpy/core/setup.py) Copied: branches/numpy.scons/numpy/core/setupscons.py (from rev 4343, branches/numpy.scons/numpy/core/setupscons.py) Deleted: branches/numpy.scons/numpy/distutils/setup.old.py =================================================================== --- branches/numpy.scons/numpy/distutils/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/distutils/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('distutils',parent_package,top_path) - config.add_subpackage('command') - config.add_subpackage('scons') - config.add_subpackage('fcompiler') - config.add_data_dir('tests') - config.add_data_files('site.cfg') - config.make_config_py() - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Deleted: branches/numpy.scons/numpy/distutils/setup.py =================================================================== --- branches/numpy.scons/numpy/distutils/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/distutils/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('distutils',parent_package,top_path) - config.add_subpackage('command') - config.add_subpackage('scons') - config.add_subpackage('fcompiler') - config.add_data_dir('tests') - config.add_data_files('site.cfg') - config.make_config_py() - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/distutils/setup.py (from rev 4343, branches/numpy.scons/numpy/distutils/setup.py) Copied: branches/numpy.scons/numpy/distutils/setupscons.py (from rev 4343, branches/numpy.scons/numpy/distutils/setupscons.py) Deleted: branches/numpy.scons/numpy/f2py/setup.old.py =================================================================== --- branches/numpy.scons/numpy/f2py/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/f2py/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,130 +0,0 @@ -#!/usr/bin/env python -""" -setup.py for installing F2PY - -Usage: - python setup.py install - -Copyright 2001-2005 Pearu Peterson all rights reserved, -Pearu Peterson -Permission to use, modify, and distribute this software is given under the -terms of the NumPy License. - -NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. -$Revision: 1.32 $ -$Date: 2005/01/30 17:22:14 $ -Pearu Peterson -""" - -__version__ = "$Id: setup.py,v 1.32 2005/01/30 17:22:14 pearu Exp $" - -import os -import sys -from distutils.dep_util import newer -from numpy.distutils import log -from numpy.distutils.core import setup -from numpy.distutils.misc_util import Configuration - -from __version__ import version - -def configuration(parent_package='',top_path=None): - config = Configuration('f2py', parent_package, top_path) - - config.add_subpackage('lib') - - config.add_data_dir('docs') - - config.add_data_files('src/fortranobject.c', - 'src/fortranobject.h', - 'f2py.1' - ) - - config.make_svn_version_py() - - def generate_f2py_py(build_dir): - f2py_exe = 'f2py'+os.path.basename(sys.executable)[6:] - if f2py_exe[-4:]=='.exe': - f2py_exe = f2py_exe[:-4] + '.py' - if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py': - f2py_exe = f2py_exe + '.py' - target = os.path.join(build_dir,f2py_exe) - if newer(__file__,target): - log.info('Creating %s', target) - f = open(target,'w') - f.write('''\ -#!/usr/bin/env %s -# See http://cens.ioc.ee/projects/f2py2e/ -import os, sys -for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]: - try: - i=sys.argv.index("--"+mode) - del sys.argv[i] - break - except ValueError: pass -os.environ["NO_SCIPY_IMPORT"]="f2py" -if mode=="g3-numpy": - try: - from main import main - except ImportError: - from numpy.f2py.lib.api import main -elif mode=="2e-numeric": - from f2py2e import main -elif mode=="2e-numarray": - sys.argv.append("-DNUMARRAY") - from f2py2e import main -elif mode=="2e-numpy": - from numpy.f2py import main -else: - print >> sys.stderr, "Unknown mode:",`mode` - sys.exit(1) -main() -'''%(os.path.basename(sys.executable))) - f.close() - return target - - config.add_scripts(generate_f2py_py) - - log.info('F2PY Version %s', config.get_version()) - - return config - -if __name__ == "__main__": - - config = configuration(top_path='') - version = config.get_version() - print 'F2PY Version',version - config = config.todict() - - if sys.version[:3]>='2.3': - config['download_url'] = "http://cens.ioc.ee/projects/f2py2e/2.x"\ - "/F2PY-2-latest.tar.gz" - config['classifiers'] = [ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: NumPy License', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: C', - 'Programming Language :: Fortran', - 'Programming Language :: Python', - 'Topic :: Scientific/Engineering', - 'Topic :: Software Development :: Code Generators', - ] - setup(version=version, - description = "F2PY - Fortran to Python Interface Generaton", - author = "Pearu Peterson", - author_email = "pearu at cens.ioc.ee", - maintainer = "Pearu Peterson", - maintainer_email = "pearu at cens.ioc.ee", - license = "BSD", - platforms = "Unix, Windows (mingw|cygwin), Mac OSX", - long_description = """\ -The Fortran to Python Interface Generator, or F2PY for short, is a -command line tool (f2py) for generating Python C/API modules for -wrapping Fortran 77/90/95 subroutines, accessing common blocks from -Python, and calling Python functions from Fortran (call-backs). -Interfacing subroutines/data from Fortran 90/95 modules is supported.""", - url = "http://cens.ioc.ee/projects/f2py2e/", - keywords = ['Fortran','f2py'], - **config) Deleted: branches/numpy.scons/numpy/f2py/setup.py =================================================================== --- branches/numpy.scons/numpy/f2py/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/f2py/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,130 +0,0 @@ -#!/usr/bin/env python -""" -setup.py for installing F2PY - -Usage: - python setup.py install - -Copyright 2001-2005 Pearu Peterson all rights reserved, -Pearu Peterson -Permission to use, modify, and distribute this software is given under the -terms of the NumPy License. - -NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. -$Revision: 1.32 $ -$Date: 2005/01/30 17:22:14 $ -Pearu Peterson -""" - -__version__ = "$Id: setup.py,v 1.32 2005/01/30 17:22:14 pearu Exp $" - -import os -import sys -from distutils.dep_util import newer -from numpy.distutils import log -from numpy.distutils.core import setup -from numpy.distutils.misc_util import Configuration - -from __version__ import version - -def configuration(parent_package='',top_path=None): - config = Configuration('f2py', parent_package, top_path) - - config.add_subpackage('lib') - - config.add_data_dir('docs') - - config.add_data_files('src/fortranobject.c', - 'src/fortranobject.h', - 'f2py.1' - ) - - config.make_svn_version_py() - - def generate_f2py_py(build_dir): - f2py_exe = 'f2py'+os.path.basename(sys.executable)[6:] - if f2py_exe[-4:]=='.exe': - f2py_exe = f2py_exe[:-4] + '.py' - if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py': - f2py_exe = f2py_exe + '.py' - target = os.path.join(build_dir,f2py_exe) - if newer(__file__,target): - log.info('Creating %s', target) - f = open(target,'w') - f.write('''\ -#!/usr/bin/env %s -# See http://cens.ioc.ee/projects/f2py2e/ -import os, sys -for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]: - try: - i=sys.argv.index("--"+mode) - del sys.argv[i] - break - except ValueError: pass -os.environ["NO_SCIPY_IMPORT"]="f2py" -if mode=="g3-numpy": - try: - from main import main - except ImportError: - from numpy.f2py.lib.api import main -elif mode=="2e-numeric": - from f2py2e import main -elif mode=="2e-numarray": - sys.argv.append("-DNUMARRAY") - from f2py2e import main -elif mode=="2e-numpy": - from numpy.f2py import main -else: - print >> sys.stderr, "Unknown mode:",`mode` - sys.exit(1) -main() -'''%(os.path.basename(sys.executable))) - f.close() - return target - - config.add_scripts(generate_f2py_py) - - log.info('F2PY Version %s', config.get_version()) - - return config - -if __name__ == "__main__": - - config = configuration(top_path='') - version = config.get_version() - print 'F2PY Version',version - config = config.todict() - - if sys.version[:3]>='2.3': - config['download_url'] = "http://cens.ioc.ee/projects/f2py2e/2.x"\ - "/F2PY-2-latest.tar.gz" - config['classifiers'] = [ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: NumPy License', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: C', - 'Programming Language :: Fortran', - 'Programming Language :: Python', - 'Topic :: Scientific/Engineering', - 'Topic :: Software Development :: Code Generators', - ] - setup(version=version, - description = "F2PY - Fortran to Python Interface Generaton", - author = "Pearu Peterson", - author_email = "pearu at cens.ioc.ee", - maintainer = "Pearu Peterson", - maintainer_email = "pearu at cens.ioc.ee", - license = "BSD", - platforms = "Unix, Windows (mingw|cygwin), Mac OSX", - long_description = """\ -The Fortran to Python Interface Generator, or F2PY for short, is a -command line tool (f2py) for generating Python C/API modules for -wrapping Fortran 77/90/95 subroutines, accessing common blocks from -Python, and calling Python functions from Fortran (call-backs). -Interfacing subroutines/data from Fortran 90/95 modules is supported.""", - url = "http://cens.ioc.ee/projects/f2py2e/", - keywords = ['Fortran','f2py'], - **config) Copied: branches/numpy.scons/numpy/f2py/setup.py (from rev 4343, branches/numpy.scons/numpy/f2py/setup.py) Copied: branches/numpy.scons/numpy/f2py/setupscons.py (from rev 4343, branches/numpy.scons/numpy/f2py/setupscons.py) Deleted: branches/numpy.scons/numpy/fft/setup.old.py =================================================================== --- branches/numpy.scons/numpy/fft/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/fft/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,19 +0,0 @@ - - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('fft',parent_package,top_path) - - config.add_data_dir('tests') - - # Configure fftpack_lite - config.add_extension('fftpack_lite', - sources=['fftpack_litemodule.c', 'fftpack.c'] - ) - - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Deleted: branches/numpy.scons/numpy/fft/setup.py =================================================================== --- branches/numpy.scons/numpy/fft/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/fft/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,14 +0,0 @@ -def configuration(parent_package = '', top_path = None): - from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs - config = Configuration('fft', parent_package, top_path) - - config.add_data_dir('tests') - - # Configure fftpack_lite - config.add_sconscript('SConstruct') - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/fft/setup.py (from rev 4343, branches/numpy.scons/numpy/fft/setup.py) Copied: branches/numpy.scons/numpy/fft/setupscons.py (from rev 4343, branches/numpy.scons/numpy/fft/setupscons.py) Deleted: branches/numpy.scons/numpy/lib/setup.old.py =================================================================== --- branches/numpy.scons/numpy/lib/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/lib/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,21 +0,0 @@ -from os.path import join - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - - config = Configuration('lib',parent_package,top_path) - - config.add_include_dirs(join('..','core','include')) - - - config.add_extension('_compiled_base', - sources=[join('src','_compiled_base.c')] - ) - - config.add_data_dir('tests') - - return config - -if __name__=='__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Deleted: branches/numpy.scons/numpy/lib/setup.py =================================================================== --- branches/numpy.scons/numpy/lib/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/lib/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,15 +0,0 @@ -from os.path import join - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - - config = Configuration('lib',parent_package,top_path) - - config.add_sconscript('SConstruct') - config.add_data_dir('tests') - - return config - -if __name__=='__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/lib/setup.py (from rev 4343, branches/numpy.scons/numpy/lib/setup.py) Copied: branches/numpy.scons/numpy/lib/setupscons.py (from rev 4343, branches/numpy.scons/numpy/lib/setupscons.py) Deleted: branches/numpy.scons/numpy/linalg/setup.old.py =================================================================== --- branches/numpy.scons/numpy/linalg/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/linalg/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,31 +0,0 @@ - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - from numpy.distutils.system_info import get_info - config = Configuration('linalg',parent_package,top_path) - - config.add_data_dir('tests') - - # Configure lapack_lite - lapack_info = get_info('lapack_opt',0) - def get_lapack_lite_sources(ext, build_dir): - if not lapack_info: - print "### Warning: Using unoptimized lapack ###" - return ext.depends[:-1] - else: - return ext.depends[:1] - - config.add_extension('lapack_lite', - sources = [get_lapack_lite_sources], - depends= ['lapack_litemodule.c', - 'zlapack_lite.c', 'dlapack_lite.c', - 'blas_lite.c', 'dlamch.c', - 'f2c_lite.c','f2c.h'], - extra_info = lapack_info - ) - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Deleted: branches/numpy.scons/numpy/linalg/setup.py =================================================================== --- branches/numpy.scons/numpy/linalg/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/linalg/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,17 +0,0 @@ - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - from numpy.distutils.system_info import get_info - config = Configuration('linalg',parent_package,top_path) - - config.add_data_dir('tests') - - print "### Warning: Using unoptimized lapack ###" - - config.add_sconscript('SConstruct') - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/linalg/setup.py (from rev 4343, branches/numpy.scons/numpy/linalg/setup.py) Copied: branches/numpy.scons/numpy/linalg/setupscons.py (from rev 4343, branches/numpy.scons/numpy/linalg/setupscons.py) Deleted: branches/numpy.scons/numpy/numarray/setup.old.py =================================================================== --- branches/numpy.scons/numpy/numarray/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/numarray/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,17 +0,0 @@ -from os.path import join - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('numarray',parent_package,top_path) - - config.add_data_files('numpy/') - - config.add_extension('_capi', - sources=['_capi.c'], - ) - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Deleted: branches/numpy.scons/numpy/numarray/setup.py =================================================================== --- branches/numpy.scons/numpy/numarray/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/numarray/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,14 +0,0 @@ -from os.path import join - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('numarray',parent_package,top_path) - - config.add_data_files('numpy/') - config.add_sconscript('SConstruct') - - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/numarray/setup.py (from rev 4343, branches/numpy.scons/numpy/numarray/setup.py) Copied: branches/numpy.scons/numpy/numarray/setupscons.py (from rev 4343, branches/numpy.scons/numpy/numarray/setupscons.py) Deleted: branches/numpy.scons/numpy/oldnumeric/setup.old.py =================================================================== --- branches/numpy.scons/numpy/oldnumeric/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/oldnumeric/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,8 +0,0 @@ - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - return Configuration('oldnumeric',parent_package,top_path) - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Deleted: branches/numpy.scons/numpy/oldnumeric/setup.py =================================================================== --- branches/numpy.scons/numpy/oldnumeric/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/oldnumeric/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,8 +0,0 @@ - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - return Configuration('oldnumeric',parent_package,top_path) - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/oldnumeric/setup.py (from rev 4343, branches/numpy.scons/numpy/oldnumeric/setup.py) Copied: branches/numpy.scons/numpy/oldnumeric/setupscons.py (from rev 4343, branches/numpy.scons/numpy/oldnumeric/setupscons.py) Deleted: branches/numpy.scons/numpy/random/setup.old.py =================================================================== --- branches/numpy.scons/numpy/random/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/random/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,53 +0,0 @@ -from os.path import join, split - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration, get_mathlibs - config = Configuration('random',parent_package,top_path) - - def generate_libraries(ext, build_dir): - config_cmd = config.get_config_cmd() - if top_path is None: - libs = get_mathlibs() - else: - path = join(split(build_dir)[0],'core') - libs = get_mathlibs(path) - tc = testcode_wincrypt() - if config_cmd.try_run(tc): - libs.append('Advapi32') - ext.libraries.extend(libs) - return None - - libs = [] - # Configure mtrand - config.add_extension('mtrand', - sources=[join('mtrand', x) for x in - ['mtrand.c', 'randomkit.c', 'initarray.c', - 'distributions.c']]+[generate_libraries], - libraries=libs, - depends = [join('mtrand','*.h'), - join('mtrand','*.pyx'), - join('mtrand','*.pxi'), - ] - ) - - config.add_data_files(('.', join('mtrand', 'randomkit.h'))) - config.add_data_dir('tests') - - return config - -def testcode_wincrypt(): - return """\ -/* check to see if _WIN32 is defined */ -int main(int argc, char *argv[]) -{ -#ifdef _WIN32 - return 0; -#else - return 1; -#endif -} -""" - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Deleted: branches/numpy.scons/numpy/random/setup.py =================================================================== --- branches/numpy.scons/numpy/random/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/random/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,28 +0,0 @@ -from os.path import join, split - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration, get_mathlibs - config = Configuration('random',parent_package,top_path) - - config.add_sconscript('SConstruct') - config.add_data_files(('.', join('mtrand', 'randomkit.h'))) - config.add_data_dir('tests') - - return config - -def testcode_wincrypt(): - return """\ -/* check to see if _WIN32 is defined */ -int main(int argc, char *argv[]) -{ -#ifdef _WIN32 - return 0; -#else - return 1; -#endif -} -""" - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/random/setup.py (from rev 4343, branches/numpy.scons/numpy/random/setup.py) Copied: branches/numpy.scons/numpy/random/setupscons.py (from rev 4343, branches/numpy.scons/numpy/random/setupscons.py) Deleted: branches/numpy.scons/numpy/scons_fake/setup.old.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/scons_fake/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,17 +0,0 @@ -import os -import os.path - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('scons_fake',parent_package,top_path) - - config.add_subpackage('pyext') - config.add_subpackage('ctypesext') - config.add_subpackage('checklib') - config.add_subpackage('checkers') - config.add_subpackage('hook') - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Deleted: branches/numpy.scons/numpy/scons_fake/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/scons_fake/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,17 +0,0 @@ -import os -import os.path - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('scons_fake',parent_package,top_path) - - config.add_subpackage('pyext') - config.add_subpackage('ctypesext') - config.add_subpackage('checklib') - config.add_subpackage('checkers') - config.add_subpackage('hook') - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(configuration=configuration) Copied: branches/numpy.scons/numpy/scons_fake/setup.py (from rev 4343, branches/numpy.scons/numpy/scons_fake/setup.py) Copied: branches/numpy.scons/numpy/scons_fake/setupscons.py (from rev 4343, branches/numpy.scons/numpy/scons_fake/setupscons.py) Deleted: branches/numpy.scons/numpy/setup.old.py =================================================================== --- branches/numpy.scons/numpy/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,23 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('numpy',parent_package,top_path) - config.add_subpackage('distutils') - config.add_subpackage('scons_fake') - config.add_subpackage('testing') - config.add_subpackage('f2py') - config.add_subpackage('core') - config.add_subpackage('lib') - config.add_subpackage('oldnumeric') - config.add_subpackage('numarray') - config.add_subpackage('fft') - config.add_subpackage('linalg') - config.add_subpackage('random') - config.add_data_dir('doc') - config.add_data_dir('tests') - config.make_config_py() # installs __config__.py - return config - -if __name__ == '__main__': - print 'This is the wrong setup.py file to run' Deleted: branches/numpy.scons/numpy/setup.py =================================================================== --- branches/numpy.scons/numpy/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,28 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('numpy',parent_package,top_path, setup_name = 'setupscons.py') - config.add_subpackage('distutils') - config.add_subpackage('scons_fake') - config.add_subpackage('testing') - config.add_subpackage('f2py') - config.add_subpackage('core') - config.add_subpackage('lib') - config.add_subpackage('oldnumeric') - config.add_subpackage('numarray') - config.add_subpackage('fft') - config.add_subpackage('linalg') - config.add_subpackage('random') - config.add_data_dir('doc') - config.add_data_dir('tests') - # The following empty extension is done on purpose to fool distutils, and - # process as usual, even if we do not build any extension (because we use - # scons instead). - # !! DO NOT REMOVE THIS !! - config.add_extension('', sources = []) - config.make_config_py() # installs __config__.py - return config - -if __name__ == '__main__': - print 'This is the wrong setup.py file to run' Copied: branches/numpy.scons/numpy/setup.py (from rev 4343, branches/numpy.scons/numpy/setup.py) Copied: branches/numpy.scons/numpy/setupscons.py (from rev 4343, branches/numpy.scons/numpy/setupscons.py) Deleted: branches/numpy.scons/numpy/testing/setup.old.py =================================================================== --- branches/numpy.scons/numpy/testing/setup.old.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/testing/setup.old.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('testing',parent_package,top_path) - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(maintainer = "NumPy Developers", - maintainer_email = "numpy-dev at numpy.org", - description = "NumPy test module", - url = "http://www.numpy.org", - license = "NumPy License (BSD Style)", - configuration = configuration, - ) Deleted: branches/numpy.scons/numpy/testing/setup.py =================================================================== --- branches/numpy.scons/numpy/testing/setup.py 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/numpy/testing/setup.py 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -def configuration(parent_package='',top_path=None): - from numpy.distutils.misc_util import Configuration - config = Configuration('testing',parent_package,top_path) - return config - -if __name__ == '__main__': - from numpy.distutils.core import setup - setup(maintainer = "NumPy Developers", - maintainer_email = "numpy-dev at numpy.org", - description = "NumPy test module", - url = "http://www.numpy.org", - license = "NumPy License (BSD Style)", - configuration = configuration, - ) Copied: branches/numpy.scons/numpy/testing/setup.py (from rev 4343, branches/numpy.scons/numpy/testing/setup.py) Copied: branches/numpy.scons/numpy/testing/setupscons.py (from rev 4343, branches/numpy.scons/numpy/testing/setupscons.py) Modified: branches/numpy.scons/testsdist.sh =================================================================== --- branches/numpy.scons/testsdist.sh 2007-10-30 05:49:16 UTC (rev 4346) +++ branches/numpy.scons/testsdist.sh 2007-10-30 06:14:45 UTC (rev 4347) @@ -1,6 +1,5 @@ PREFIX=$PWD -#SVNVER=`svn info | grep "Revision: [0-9]*" | tr -d \ | cut -f2 -d:` -SVNVER=4342 +SVNVER=4346 rm -rf $PREFIX/build rm -rf $PREFIX/dist python setup.py sdist From numpy-svn at scipy.org Tue Oct 30 02:35:27 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 01:35:27 -0500 (CDT) Subject: [Numpy-svn] r4348 - branches/numpy.scons/numpy/distutils Message-ID: <20071030063527.8E5A939C191@new.scipy.org> Author: cdavid Date: 2007-10-30 01:35:22 -0500 (Tue, 30 Oct 2007) New Revision: 4348 Modified: branches/numpy.scons/numpy/distutils/setupscons.py Log: Add scons-local as a data_dir for distribution. Modified: branches/numpy.scons/numpy/distutils/setupscons.py =================================================================== --- branches/numpy.scons/numpy/distutils/setupscons.py 2007-10-30 06:14:45 UTC (rev 4347) +++ branches/numpy.scons/numpy/distutils/setupscons.py 2007-10-30 06:35:22 UTC (rev 4348) @@ -7,6 +7,7 @@ config.add_subpackage('scons') config.add_subpackage('fcompiler') config.add_data_dir('tests') + config.add_data_dir('scons-local') config.add_data_files('site.cfg') config.make_config_py() return config From numpy-svn at scipy.org Tue Oct 30 02:45:00 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 01:45:00 -0500 (CDT) Subject: [Numpy-svn] r4349 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071030064500.4F46139C187@new.scipy.org> Author: cdavid Date: 2007-10-30 01:44:56 -0500 (Tue, 30 Oct 2007) New Revision: 4349 Modified: branches/numpy.scons/numpy/distutils/scons/setup.py Log: Add checkers subpackage in distutils.scons Modified: branches/numpy.scons/numpy/distutils/scons/setup.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/setup.py 2007-10-30 06:35:22 UTC (rev 4348) +++ branches/numpy.scons/numpy/distutils/scons/setup.py 2007-10-30 06:44:56 UTC (rev 4349) @@ -4,6 +4,7 @@ from numpy.distutils.misc_util import Configuration config = Configuration('scons',parent_package,top_path) config.add_subpackage('tools') + config.add_subpackage('checkers') config.add_data_dir('tests') return config From numpy-svn at scipy.org Tue Oct 30 03:13:35 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 02:13:35 -0500 (CDT) Subject: [Numpy-svn] r4350 - in branches/numpy.scons/numpy/distutils: . command Message-ID: <20071030071335.CFAA539C164@new.scipy.org> Author: cdavid Date: 2007-10-30 02:13:30 -0500 (Tue, 30 Oct 2007) New Revision: 4350 Modified: branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/misc_util.py branches/numpy.scons/numpy/distutils/numpy_distribution.py Log: - Clean up a bit NumpyDistribution, to avoid accessing directly distribution data in scons command - Add a source_file argument, to enable adding source files used in SConscripts and unknown to distutils (not implemented yet) Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-30 06:44:56 UTC (rev 4349) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-10-30 07:13:30 UTC (rev 4350) @@ -140,9 +140,11 @@ old_build_ext.finalize_options(self) if self.distribution.has_scons_scripts(): #print "Got it: scons scripts are %s" % self.distribution.scons_scripts - self.scons_scripts = self.distribution.scons_scripts + self.sconscripts = self.distribution.get_scons_scripts() + self.post_hooks = self.distribution.get_scons_post_hooks() else: - self.scons_scripts = [] + self.sconscripts = [] + self.post_hooks = [] # Try to get the same compiler than the ones used by distutils: this is # non trivial because distutils and scons have totally different @@ -183,7 +185,9 @@ scons_exec = get_python_exec_invoc() scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py')) - for sconscript, pre_hook, post_hook in self.scons_scripts: + + # XXX handle pre hoook + for sconscript, post_hook in zip(self.sconscripts, self.post_hooks): # XXX: This is inefficient... (use join instead) from numpy.distutils.misc_util import get_numpy_include_dirs cmd = scons_exec + " -f " + sconscript + ' -I. ' Modified: branches/numpy.scons/numpy/distutils/misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-30 06:44:56 UTC (rev 4349) +++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-30 07:13:30 UTC (rev 4350) @@ -575,7 +575,7 @@ class Configuration(object): _list_keys = ['packages', 'ext_modules', 'data_files', 'include_dirs', - 'libraries', 'headers', 'scripts', 'py_modules', 'scons_scripts'] + 'libraries', 'headers', 'scripts', 'py_modules', 'scons_data'] _dict_keys = ['package_dir'] _extra_keys = ['name', 'version'] @@ -1173,7 +1173,8 @@ subpackage_path=None, standalone = False, pre_hook = None, - post_hook = None): + post_hook = None, + source_files = None): """Add a sconscript to configuration. pre_hook and post hook should be sequences of callable, which will be @@ -1188,13 +1189,21 @@ # Convert the sconscript name to a relative filename (relative from top # setup.py's directory) fullsconsname = self.paths(sconscript)[0] - + if source_files: + full_source_files = [self.paths(i)[0] for i in source_files] + if dist is not None: - dist.scons_scripts.extend((fullsconsname, pre_hook, post_hook)) + dist.scons_data.append((fullsconsname, + pre_hook, + post_hook, + source_files)) self.warn('distutils distribution has been initialized,'\ ' it may be too late to add a subpackage '+ subpackage_name) else: - self.scons_scripts.append((fullsconsname, pre_hook, post_hook)) + self.scons_data.append((fullsconsname, + pre_hook, + post_hook, + source_files)) def add_scripts(self,*files): """Add scripts to configuration. Modified: branches/numpy.scons/numpy/distutils/numpy_distribution.py =================================================================== --- branches/numpy.scons/numpy/distutils/numpy_distribution.py 2007-10-30 06:44:56 UTC (rev 4349) +++ branches/numpy.scons/numpy/distutils/numpy_distribution.py 2007-10-30 07:13:30 UTC (rev 4350) @@ -1,12 +1,27 @@ +# XXX: Handle setuptools ? from distutils.core import Distribution +# This class is used because we add new files (sconscripts, and so on) with the +# scons command class NumpyDistribution(Distribution): def __init__(self, attrs = None): - self.scons_scripts = [] + # A list of (sconscripts, pre_hook, post_hook, src) + self.scons_data = [] Distribution.__init__(self, attrs) def has_scons_scripts(self): - return bool(self.scons_scripts) + return bool(self.scons_data) def get_scons_scripts(self): - return [i[0] for i in self.scons_scripts] + print self.scons_data + return [i[0] for i in self.scons_data] + + def get_scons_pre_hooks(self): + return [i[1] for i in self.scons_data] + + def get_scons_post_hooks(self): + return [i[2] for i in self.scons_data] + + def get_scons_sources(self): + return [i[3] for i in self.scons_data] + From numpy-svn at scipy.org Tue Oct 30 03:32:51 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 02:32:51 -0500 (CDT) Subject: [Numpy-svn] r4351 - in branches/numpy.scons/numpy/distutils: . command Message-ID: <20071030073251.7309639C1A0@new.scipy.org> Author: cdavid Date: 2007-10-30 02:32:46 -0500 (Tue, 30 Oct 2007) New Revision: 4351 Modified: branches/numpy.scons/numpy/distutils/command/sdist.py branches/numpy.scons/numpy/distutils/misc_util.py branches/numpy.scons/numpy/distutils/numpy_distribution.py Log: implement source_files arguments of Configuration.add_sconscript Modified: branches/numpy.scons/numpy/distutils/command/sdist.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/sdist.py 2007-10-30 07:13:30 UTC (rev 4350) +++ branches/numpy.scons/numpy/distutils/command/sdist.py 2007-10-30 07:32:46 UTC (rev 4351) @@ -25,6 +25,16 @@ self.filelist.extend(headers) if dist.has_scons_scripts(): + # Add SConscripts files self.filelist.extend(dist.get_scons_scripts()) + + # Add related sources files added through source_files argument of + # Configuration.add_sconscript + scons_sources = [] + for pkg_sources in dist.get_scons_sources(): + if pkg_sources: + scons_sources.extend(pkg_sources) + self.filelist.extend(scons_sources) + return Modified: branches/numpy.scons/numpy/distutils/misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-30 07:13:30 UTC (rev 4350) +++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-30 07:32:46 UTC (rev 4351) @@ -1189,21 +1189,22 @@ # Convert the sconscript name to a relative filename (relative from top # setup.py's directory) fullsconsname = self.paths(sconscript)[0] + full_source_files = [] if source_files: - full_source_files = [self.paths(i)[0] for i in source_files] + full_source_files.extend([self.paths(i)[0] for i in source_files]) if dist is not None: dist.scons_data.append((fullsconsname, pre_hook, post_hook, - source_files)) + full_source_files)) self.warn('distutils distribution has been initialized,'\ ' it may be too late to add a subpackage '+ subpackage_name) else: self.scons_data.append((fullsconsname, pre_hook, post_hook, - source_files)) + full_source_files)) def add_scripts(self,*files): """Add scripts to configuration. Modified: branches/numpy.scons/numpy/distutils/numpy_distribution.py =================================================================== --- branches/numpy.scons/numpy/distutils/numpy_distribution.py 2007-10-30 07:13:30 UTC (rev 4350) +++ branches/numpy.scons/numpy/distutils/numpy_distribution.py 2007-10-30 07:32:46 UTC (rev 4351) @@ -13,7 +13,6 @@ return bool(self.scons_data) def get_scons_scripts(self): - print self.scons_data return [i[0] for i in self.scons_data] def get_scons_pre_hooks(self): From numpy-svn at scipy.org Tue Oct 30 04:21:22 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 03:21:22 -0500 (CDT) Subject: [Numpy-svn] r4352 - branches/numpy.scons/numpy/core Message-ID: <20071030082122.1660539C065@new.scipy.org> Author: cdavid Date: 2007-10-30 03:21:18 -0500 (Tue, 30 Oct 2007) New Revision: 4352 Modified: branches/numpy.scons/numpy/core/setupscons.py Log: Register source files of numpy.core to distutils Modified: branches/numpy.scons/numpy/core/setupscons.py =================================================================== --- branches/numpy.scons/numpy/core/setupscons.py 2007-10-30 07:32:46 UTC (rev 4351) +++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-30 08:21:18 UTC (rev 4352) @@ -1,9 +1,8 @@ -import imp import os import sys -from os.path import join +import glob +from os.path import join, basename from numpy.distutils import log -from distutils.dep_util import newer def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration,dot_join @@ -14,6 +13,24 @@ header_dir = 'include/numpy' # this is relative to config.path_in_package + config.add_subpackage('code_generators') + + # List of files to register to numpy.distutils + dot_blas_src = [join('blasdot', '_dotblas.c'), + join('blasdot', 'cblas.h')] + api_definition = [join('code_generators', 'array_api_order.txt'), + join('code_generators', 'multiarray_api_order.txt'), + join('code_generators', 'ufunc_api_order.txt')] + core_src = [join('src', basename(i)) for i in glob.glob(join(local_dir, + 'src', + '*.c'))] + core_src += [join('src', basename(i)) for i in glob.glob(join(local_dir, + 'src', + '*.src'))] + + source_files = dot_blas_src + api_definition + core_src + \ + [join(header_dir, 'numpyconfig.h.in')] + # Add generated files to distutils... def add_config_header(): scons_build_dir = config.get_scons_build_dir() @@ -24,7 +41,6 @@ incl_dir = os.path.dirname(target) if incl_dir not in config.numpy_include_dirs: config.numpy_include_dirs.append(incl_dir) - #config.add_data_files((header_dir, target)) def add_numpyconfig_header(): scons_build_dir = config.get_scons_build_dir() @@ -63,7 +79,9 @@ add_array_api() add_ufunc_api() - config.add_sconscript('SConstruct', post_hook = add_generated_files) + config.add_sconscript('SConstruct', + post_hook = add_generated_files, + source_files = source_files) config.add_data_files('include/numpy/*.h') config.add_include_dirs('src') From numpy-svn at scipy.org Tue Oct 30 04:21:38 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 03:21:38 -0500 (CDT) Subject: [Numpy-svn] r4353 - in branches/numpy.scons/numpy/scons_fake: ctypesext pyext Message-ID: <20071030082138.A6ED339C065@new.scipy.org> Author: cdavid Date: 2007-10-30 03:21:33 -0500 (Tue, 30 Oct 2007) New Revision: 4353 Modified: branches/numpy.scons/numpy/scons_fake/ctypesext/setup.py branches/numpy.scons/numpy/scons_fake/pyext/setup.py Log: Register source files of numpy.scons_fake to distutils Modified: branches/numpy.scons/numpy/scons_fake/ctypesext/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/ctypesext/setup.py 2007-10-30 08:21:18 UTC (rev 4352) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/setup.py 2007-10-30 08:21:33 UTC (rev 4353) @@ -5,7 +5,7 @@ from numpy.distutils.misc_util import Configuration config = Configuration('ctypesext',parent_package,top_path) - config.add_sconscript('SConstruct') + config.add_sconscript('SConstruct', source_files = ['foo.c']) config.add_data_dir('tests') return config Modified: branches/numpy.scons/numpy/scons_fake/pyext/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/pyext/setup.py 2007-10-30 08:21:18 UTC (rev 4352) +++ branches/numpy.scons/numpy/scons_fake/pyext/setup.py 2007-10-30 08:21:33 UTC (rev 4353) @@ -5,7 +5,7 @@ from numpy.distutils.misc_util import Configuration config = Configuration('pyext',parent_package,top_path) - config.add_sconscript('SConstruct') + config.add_sconscript('SConstruct', source_files = ['hellomodule.c']) config.add_data_dir('tests') return config From numpy-svn at scipy.org Tue Oct 30 04:23:27 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 03:23:27 -0500 (CDT) Subject: [Numpy-svn] r4354 - branches/numpy.scons/numpy/lib Message-ID: <20071030082327.3D12539C1C7@new.scipy.org> Author: cdavid Date: 2007-10-30 03:23:23 -0500 (Tue, 30 Oct 2007) New Revision: 4354 Modified: branches/numpy.scons/numpy/lib/setupscons.py Log: Register source files of numpy.lib to distutils Modified: branches/numpy.scons/numpy/lib/setupscons.py =================================================================== --- branches/numpy.scons/numpy/lib/setupscons.py 2007-10-30 08:21:33 UTC (rev 4353) +++ branches/numpy.scons/numpy/lib/setupscons.py 2007-10-30 08:23:23 UTC (rev 4354) @@ -5,7 +5,8 @@ config = Configuration('lib',parent_package,top_path) - config.add_sconscript('SConstruct') + config.add_sconscript('SConstruct', + source_files = [join('src', '_compiled_base.c')]) config.add_data_dir('tests') return config From numpy-svn at scipy.org Tue Oct 30 04:40:59 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 03:40:59 -0500 (CDT) Subject: [Numpy-svn] r4355 - in branches/numpy.scons/numpy: distutils fft linalg numarray random Message-ID: <20071030084059.E170839C1B1@new.scipy.org> Author: cdavid Date: 2007-10-30 03:40:50 -0500 (Tue, 30 Oct 2007) New Revision: 4355 Modified: branches/numpy.scons/numpy/distutils/misc_util.py branches/numpy.scons/numpy/fft/setupscons.py branches/numpy.scons/numpy/linalg/setupscons.py branches/numpy.scons/numpy/numarray/setupscons.py branches/numpy.scons/numpy/random/setupscons.py Log: sdist finally works Modified: branches/numpy.scons/numpy/distutils/misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-30 08:23:23 UTC (rev 4354) +++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-30 08:40:50 UTC (rev 4355) @@ -1189,6 +1189,9 @@ # Convert the sconscript name to a relative filename (relative from top # setup.py's directory) fullsconsname = self.paths(sconscript)[0] + + # XXX: Think about a way to automatically register source files from + # scons... full_source_files = [] if source_files: full_source_files.extend([self.paths(i)[0] for i in source_files]) Modified: branches/numpy.scons/numpy/fft/setupscons.py =================================================================== --- branches/numpy.scons/numpy/fft/setupscons.py 2007-10-30 08:23:23 UTC (rev 4354) +++ branches/numpy.scons/numpy/fft/setupscons.py 2007-10-30 08:40:50 UTC (rev 4355) @@ -4,8 +4,9 @@ config.add_data_dir('tests') - # Configure fftpack_lite - config.add_sconscript('SConstruct') + config.add_sconscript('SConstruct', + source_files = ['fftpack_litemodule.c', 'fftpack.c', + 'fftpack.h']) return config Modified: branches/numpy.scons/numpy/linalg/setupscons.py =================================================================== --- branches/numpy.scons/numpy/linalg/setupscons.py 2007-10-30 08:23:23 UTC (rev 4354) +++ branches/numpy.scons/numpy/linalg/setupscons.py 2007-10-30 08:40:50 UTC (rev 4355) @@ -6,10 +6,12 @@ config.add_data_dir('tests') - print "### Warning: Using unoptimized lapack ###" + config.add_sconscript('SConstruct', + source_files = ['lapack_litemodule.c', + 'zlapack_lite.c', 'dlapack_lite.c', + 'blas_lite.c', 'dlamch.c', + 'f2c_lite.c','f2c.h']) - config.add_sconscript('SConstruct') - return config if __name__ == '__main__': Modified: branches/numpy.scons/numpy/numarray/setupscons.py =================================================================== --- branches/numpy.scons/numpy/numarray/setupscons.py 2007-10-30 08:23:23 UTC (rev 4354) +++ branches/numpy.scons/numpy/numarray/setupscons.py 2007-10-30 08:40:50 UTC (rev 4355) @@ -5,7 +5,7 @@ config = Configuration('numarray',parent_package,top_path) config.add_data_files('numpy/') - config.add_sconscript('SConstruct') + config.add_sconscript('SConstruct', source_files = ['_capi.c']) return config Modified: branches/numpy.scons/numpy/random/setupscons.py =================================================================== --- branches/numpy.scons/numpy/random/setupscons.py 2007-10-30 08:23:23 UTC (rev 4354) +++ branches/numpy.scons/numpy/random/setupscons.py 2007-10-30 08:40:50 UTC (rev 4355) @@ -1,3 +1,4 @@ +import glob from os.path import join, split def configuration(parent_package='',top_path=None): @@ -4,7 +5,18 @@ from numpy.distutils.misc_util import Configuration, get_mathlibs config = Configuration('random',parent_package,top_path) - config.add_sconscript('SConstruct') + source_files = [join('mtrand', i) for i in ['mtrand.c', + 'mtrand.pxi', + 'numpy.pyx', + 'randomkit.c', + 'randomkit.h', + 'Python.pxi', + 'initarray.c', + 'initarray.h', + 'distributions.c', + 'distributions.h', + ]] + config.add_sconscript('SConstruct', source_files = source_files) config.add_data_files(('.', join('mtrand', 'randomkit.h'))) config.add_data_dir('tests') From numpy-svn at scipy.org Tue Oct 30 05:47:19 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 04:47:19 -0500 (CDT) Subject: [Numpy-svn] r4356 - branches/numpy.scons/numpy/distutils/scons/doc Message-ID: <20071030094719.2DBB639C114@new.scipy.org> Author: cdavid Date: 2007-10-30 04:47:14 -0500 (Tue, 30 Oct 2007) New Revision: 4356 Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO Log: Update TODO Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-10-30 08:40:50 UTC (rev 4355) +++ branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-10-30 09:47:14 UTC (rev 4356) @@ -1,6 +1,4 @@ Before second alpha (in order of priority): - - support sdist: how to add files to distutils distribution ? ~ 2 hours - - support sdist: examples and numpy (~ 1 hour) - show_config implementation : show libs, libpath and cpppath for each configuration (~ 2-3 hours) - BLAS, CBLAS and LAPACK meta checkers: overridable, support at least From numpy-svn at scipy.org Tue Oct 30 05:48:59 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 04:48:59 -0500 (CDT) Subject: [Numpy-svn] r4357 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071030094859.3D27339C0A7@new.scipy.org> Author: cdavid Date: 2007-10-30 04:48:53 -0500 (Tue, 30 Oct 2007) New Revision: 4357 Added: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py Modified: branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py Log: Starting refactoring scons checkers Modified: branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py 2007-10-30 09:47:14 UTC (rev 4356) +++ branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py 2007-10-30 09:48:53 UTC (rev 4357) @@ -0,0 +1 @@ +from custom_checkers import CheckLAPACK, CheckCBLAS Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-10-30 09:47:14 UTC (rev 4356) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-10-30 09:48:53 UTC (rev 4357) @@ -1,10 +1,9 @@ #! /usr/bin/env python -# Last Change: Mon Oct 29 07:00 PM 2007 J +# Last Change: Tue Oct 30 05:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys import os.path -from copy import deepcopy from distutils.util import get_platform from numpy.distutils.scons.libinfo import get_config_from_section, get_config @@ -15,162 +14,6 @@ from numpy.distutils.scons.configuration import opt_info, add_info -def _check_include_and_run(context, name, cpppath, headers, run_src, libs, - libpath, linkflags, cflags, autoadd = 1): - """This is a basic implementation for generic "test include and run" - testers. - - For example, for library foo, which implements function do_foo, and with - include header foo.h, this will: - - test that foo.h is found and compilable by the compiler - - test that the given source code can be compiled. The source code - should contain a simple program with the function. - - Arguments: - - name: name of the library - - cpppath: list of directories - - headers: list of headers - - run_src: the code for the run test - - libs: list of libraries to link - - libpath: list of library path. - - linkflags: list of link flags to add.""" - context.Message('Checking for %s ... ' % name) - env = context.env - - #---------------------------- - # Check headers are available - #---------------------------- - oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] - oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] - env.AppendUnique(CPPPATH = cpppath) - env.AppendUnique(CFLAGS = cflags) - # XXX: handle context - hcode = ['#include <%s>' % h for h in headers] - # HACK: we add cpppath in the command of the source, to add dependency of - # the check on the cpppath. - hcode.extend(['#if 0', '%s' % cpppath, '#endif\n']) - src = '\n'.join(hcode) - - ret = context.TryCompile(src, '.c') - if not ret: - env.Replace(CPPPATH = oldCPPPATH) - env.Replace(CFLAGS = oldCFLAGS) - context.Result('Failed: %s include not found' % name) - return 0 - - #------------------------------ - # Check a simple example works - #------------------------------ - oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] - oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] - # XXX: RPATH, drawbacks using it ? - oldRPATH = (env.has_key('RPATH') and deepcopy(env['RPATH'])) or [] - oldLINKFLAGS = (env.has_key('LINKFLAGS') and deepcopy(env['LINKFLAGS'])) or [] - env.AppendUnique(LIBPATH = libpath) - env.AppendUnique(LIBS = libs) - env.AppendUnique(RPATH = libpath) - env.AppendUnique(LINKFLAGS = linkflags) - - # HACK: we add libpath and libs at the end of the source as a comment, to - # add dependency of the check on those. - src = '\n'.join(['#include <%s>' % h for h in headers] +\ - [run_src, '#if 0', '%s' % libpath, - '%s' % headers, '%s' % libs, '#endif']) - ret = context.TryLink(src, '.c') - if (not ret or not autoadd): - # If test failed or autoadd = 0, restore everything - env.Replace(LIBS = oldLIBS) - env.Replace(LIBPATH = oldLIBPATH) - env.Replace(RPATH = oldRPATH) - env.Replace(LINKFLAGS = oldLINKFLAGS) - - if not ret: - context.Result('Failed: %s test could not be linked and run' % name) - return 0 - - context.Result(ret) - return ret - -#def CheckMKL(context, mkl_dir, nb): -# """mkl_lib is the root path of MKL (the one which contains include, lib, -# etc...). nb is 32, 64, emt, etc...""" -# -# libs = ['mkl'] -# cpppath = os.path.join(mkl_dir, 'include') -# libpath = os.path.join(mkl_dir, 'lib', nb) -# -# return _check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], -# cblas_src, libs, libpath, [], [], autoadd) - -def CheckMKL(context, autoadd = 1): - """Check MKL is usable using a simple cblas example.""" - section = "mkl" - siteconfig, cfgfiles = get_config() - (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) - if not found: - # XXX: find exact options to use for the MKL - libs.extend(['lapack', 'mkl', 'guide', 'm']) - headers = ['mkl.h'] - - return _check_include_and_run(context, 'MKL', cpppath, headers, - cblas_src, libs, libpath, [], [], autoadd) - -def CheckATLAS(context, autoadd = 1): - """Check whether ATLAS is usable in C.""" - - libs = ['atlas', 'f77blas', 'cblas'] - libpath = [] - - return _check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h', 'cblas.h'], - cblas_src, libs, libpath, [], [], autoadd) - -def CheckAccelerate(context, autoadd = 1): - """Checker for Accelerate framework (on Mac OS X >= 10.3). Only test from - C.""" - # According to - # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: - # - # This page contains a continually expanding set of vector libraries - # that are available to the AltiVec programmer through the Accelerate - # framework on MacOS X.3, Panther. On earlier versions of MacOS X, - # these were available in vecLib.framework. The currently available - # libraries are described below. - - #XXX: get_platform does not seem to work... - #if get_platform()[-4:] == 'i386': - # is_intel = 1 - # cflags.append('-msse3') - #else: - # is_intel = 0 - # cflags.append('-faltivec') - - # XXX: This double append is not good, any other way ? - linkflags = ['-framework', 'Accelerate'] - - return _check_include_and_run(context, 'FRAMEWORK: Accelerate', None, - ['Accelerate/Accelerate.h'], cblas_src, [], - [], linkflags, [], autoadd) - -def CheckVeclib(context, autoadd = 1): - """Checker for Veclib framework (on Mac OS X < 10.3).""" - # XXX: This double append is not good, any other way ? - linkflags = ['-framework', 'vecLib'] - - return _check_include_and_run(context, 'FRAMEWORK: veclib', None, - ['vecLib/vecLib.h'], cblas_src, [], - [], linkflags, [], autoadd) - -def CheckSunperf(context, autoadd = 1): - """Checker for sunperf using a simple sunperf example""" - - # XXX: Other options needed ? - linkflags = ['-xlic_lib=sunperf'] - cflags = ['-dalign'] - - return _check_include_and_run(context, 'sunperf', None, - ['sunperf.h'], sunperf_src, [], - [], linkflags, cflags, autoadd) - def CheckCBLAS(context, autoadd = 1): env = context.env Added: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-30 09:47:14 UTC (rev 4356) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-30 09:48:53 UTC (rev 4357) @@ -0,0 +1,96 @@ +#! /usr/bin/env python +# Last Change: Tue Oct 30 06:00 PM 2007 J + +# This module defines checkers for performances libs providing standard API, +# such as MKL (Intel), ATLAS, Sunperf (solaris and linux), Accelerate (Mac OS +# X), etc... Those checkers merely only check whether the library is found +# using a library specific check if possible, or other heuristics. +# Generally, you don't use those directly: they are used in 'meta' checkers, +# such as BLAS, CBLAS, LAPACK checkers. + +from numpy.distutils.scons.libinfo import get_config_from_section, get_config +from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \ + c_sgemm as sunperf_src, lapack_sgesv + +from support import check_include_and_run + +#def CheckMKL(context, mkl_dir, nb): +# """mkl_lib is the root path of MKL (the one which contains include, lib, +# etc...). nb is 32, 64, emt, etc...""" +# +# libs = ['mkl'] +# cpppath = os.path.join(mkl_dir, 'include') +# libpath = os.path.join(mkl_dir, 'lib', nb) +# +# return check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], +# cblas_src, libs, libpath, [], [], autoadd) + +def CheckMKL(context, autoadd = 1): + """Check MKL is usable using a simple cblas example.""" + section = "mkl" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if not found: + # XXX: find exact options to use for the MKL + libs.extend(['lapack', 'mkl', 'guide', 'm']) + headers = ['mkl.h'] + + return check_include_and_run(context, 'MKL', cpppath, headers, + cblas_src, libs, libpath, [], [], autoadd) + +def CheckATLAS(context, autoadd = 1): + """Check whether ATLAS is usable in C.""" + + libs = ['atlas', 'f77blas', 'cblas'] + libpath = [] + + return check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h', 'cblas.h'], + cblas_src, libs, libpath, [], [], autoadd) + +def CheckAccelerate(context, autoadd = 1): + """Checker for Accelerate framework (on Mac OS X >= 10.3). Only test from + C.""" + # According to + # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: + # + # This page contains a continually expanding set of vector libraries + # that are available to the AltiVec programmer through the Accelerate + # framework on MacOS X.3, Panther. On earlier versions of MacOS X, + # these were available in vecLib.framework. The currently available + # libraries are described below. + + #XXX: get_platform does not seem to work... + #if get_platform()[-4:] == 'i386': + # is_intel = 1 + # cflags.append('-msse3') + #else: + # is_intel = 0 + # cflags.append('-faltivec') + + # XXX: This double append is not good, any other way ? + linkflags = ['-framework', 'Accelerate'] + + return check_include_and_run(context, 'FRAMEWORK: Accelerate', None, + ['Accelerate/Accelerate.h'], cblas_src, [], + [], linkflags, [], autoadd) + +def CheckVeclib(context, autoadd = 1): + """Checker for Veclib framework (on Mac OS X < 10.3).""" + # XXX: This double append is not good, any other way ? + linkflags = ['-framework', 'vecLib'] + + return check_include_and_run(context, 'FRAMEWORK: veclib', None, + ['vecLib/vecLib.h'], cblas_src, [], + [], linkflags, [], autoadd) + +def CheckSunperf(context, autoadd = 1): + """Checker for sunperf using a simple sunperf example""" + + # XXX: Other options needed ? + linkflags = ['-xlic_lib=sunperf'] + cflags = ['-dalign'] + + return check_include_and_run(context, 'sunperf', None, + ['sunperf.h'], sunperf_src, [], + [], linkflags, cflags, autoadd) + Added: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-30 09:47:14 UTC (rev 4356) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-30 09:48:53 UTC (rev 4357) @@ -0,0 +1,83 @@ +#! /usr/bin/env python +# Last Change: Tue Oct 30 05:00 PM 2007 J + +# This module defines some helper functions, to be used by high level checkers + +from copy import deepcopy + +def check_include_and_run(context, name, cpppath, headers, run_src, libs, + libpath, linkflags, cflags, autoadd = 1): + """This is a basic implementation for generic "test include and run" + testers. + + For example, for library foo, which implements function do_foo, and with + include header foo.h, this will: + - test that foo.h is found and compilable by the compiler + - test that the given source code can be compiled. The source code + should contain a simple program with the function. + + Arguments: + - name: name of the library + - cpppath: list of directories + - headers: list of headers + - run_src: the code for the run test + - libs: list of libraries to link + - libpath: list of library path. + - linkflags: list of link flags to add.""" + context.Message('Checking for %s ... ' % name) + env = context.env + + #---------------------------- + # Check headers are available + #---------------------------- + oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] + oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] + env.AppendUnique(CPPPATH = cpppath) + env.AppendUnique(CFLAGS = cflags) + # XXX: handle context + hcode = ['#include <%s>' % h for h in headers] + # HACK: we add cpppath in the command of the source, to add dependency of + # the check on the cpppath. + hcode.extend(['#if 0', '%s' % cpppath, '#endif\n']) + src = '\n'.join(hcode) + + ret = context.TryCompile(src, '.c') + if not ret: + env.Replace(CPPPATH = oldCPPPATH) + env.Replace(CFLAGS = oldCFLAGS) + context.Result('Failed: %s include not found' % name) + return 0 + + #------------------------------ + # Check a simple example works + #------------------------------ + oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] + oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] + # XXX: RPATH, drawbacks using it ? + oldRPATH = (env.has_key('RPATH') and deepcopy(env['RPATH'])) or [] + oldLINKFLAGS = (env.has_key('LINKFLAGS') and deepcopy(env['LINKFLAGS'])) or [] + env.AppendUnique(LIBPATH = libpath) + env.AppendUnique(LIBS = libs) + env.AppendUnique(RPATH = libpath) + env.AppendUnique(LINKFLAGS = linkflags) + + # HACK: we add libpath and libs at the end of the source as a comment, to + # add dependency of the check on those. + src = '\n'.join(['#include <%s>' % h for h in headers] +\ + [run_src, '#if 0', '%s' % libpath, + '%s' % headers, '%s' % libs, '#endif']) + ret = context.TryLink(src, '.c') + if (not ret or not autoadd): + # If test failed or autoadd = 0, restore everything + env.Replace(LIBS = oldLIBS) + env.Replace(LIBPATH = oldLIBPATH) + env.Replace(RPATH = oldRPATH) + env.Replace(LINKFLAGS = oldLINKFLAGS) + + if not ret: + context.Result('Failed: %s test could not be linked and run' % name) + return 0 + + context.Result(ret) + return ret + From numpy-svn at scipy.org Tue Oct 30 06:39:46 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 05:39:46 -0500 (CDT) Subject: [Numpy-svn] r4358 - in branches/numpy.scons: . numpy/core numpy/distutils/scons numpy/distutils/scons/checkers numpy/scons_fake/checkers Message-ID: <20071030103946.8A3F139C0A7@new.scipy.org> Author: cdavid Date: 2007-10-30 05:39:36 -0500 (Tue, 30 Oct 2007) New Revision: 4358 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct branches/numpy.scons/testsdist.sh Log: More scons checkers refactoring Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-10-30 09:48:53 UTC (rev 4357) +++ branches/numpy.scons/numpy/core/SConstruct 2007-10-30 10:39:36 UTC (rev 4358) @@ -1,4 +1,4 @@ -# Last Change: Mon Oct 29 07:00 PM 2007 J +# Last Change: Tue Oct 30 07:00 PM 2007 J # vim:syntax=python import os import sys @@ -8,7 +8,7 @@ from numpy.distutils.scons import get_python_inc, get_pythonlib_dir from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons import NumpyCheckLib -from numpy.distutils.scons import CheckCBLAS, CheckMKL, CheckATLAS, CheckGenericBLAS, CheckGenericLAPACK +from numpy.distutils.scons import CheckCBLAS from numpy.distutils.scons.configuration import write_info from scons_support import CheckBrokenMathlib, define_no_smp, \ @@ -30,8 +30,6 @@ config = env.NumpyConfigure(custom_tests = {'CheckBrokenMathlib' : CheckBrokenMathlib, 'CheckMathlib' : CheckMathlib, 'CheckCBLAS' : CheckCBLAS, - 'CheckGenericBLAS' : CheckGenericBLAS, - 'CheckGenericLAPACK' : CheckGenericLAPACK, 'NumpyCheckLib' : NumpyCheckLib}) # Convention: list of tuples (definition, value). value: Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-30 09:48:53 UTC (rev 4357) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-10-30 10:39:36 UTC (rev 4358) @@ -1,9 +1,7 @@ from numpyenv import GetNumpyEnvironment, GetNumpyOptions from libinfo_scons import NumpyCheckLib from libinfo import get_paths as scons_get_paths -from checkers.custom_checkers import CheckMKL, CheckATLAS, CheckCBLAS, \ - CheckAccelerate, CheckMKL, CheckSunperf, CheckLAPACK, \ - CheckGenericBLAS, CheckGenericLAPACK +from checkers import CheckCBLAS, CheckLAPACK from extension import get_python_inc, get_pythonlib_dir from utils import isstring from fortran_scons import CheckF77Verbose, CheckF77Clib, CheckF77Mangling Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-10-30 09:48:53 UTC (rev 4357) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-10-30 10:39:36 UTC (rev 4358) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Oct 30 05:00 PM 2007 J +# Last Change: Tue Oct 30 07:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -14,6 +14,9 @@ from numpy.distutils.scons.configuration import opt_info, add_info +from perflib import CheckMKL, CheckATLAS, CheckSunperf, CheckAccelerate +from support import check_include_and_run + def CheckCBLAS(context, autoadd = 1): env = context.env @@ -25,7 +28,7 @@ headers = ['cblas.h'] linkflags = [] cflags = [] - st = _check_include_and_run(context, 'CBLAS', [], headers, cblas_src, + st = check_include_and_run(context, 'CBLAS', [], headers, cblas_src, libs, libpath, linkflags, cflags, autoadd) if st: add_info(env, 'cblas', opt_info('cblas', site = 1)) @@ -93,7 +96,7 @@ fdict['LIBS'].extend(context.env['LIBS']) if env.has_key('LIBPATH'): fdict['LIBPATH'].extend(context.env['LIBPATH']) - st =_check_include_and_run(context, 'LAPACK (MKL)', [], [], + st = check_include_and_run(context, 'LAPACK (MKL)', [], [], test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) add_info(env, 'lapack', opt_info('mkl')) return st @@ -107,7 +110,7 @@ fdict['LIBS'].extend(context.env['LIBS']) if env.has_key('LIBPATH'): fdict['LIBPATH'].extend(context.env['LIBPATH']) - st =_check_include_and_run(context, 'LAPACK (ATLAS)', [], [], + st = check_include_and_run(context, 'LAPACK (ATLAS)', [], [], test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) add_info(env, 'lapack', opt_info('atlas')) # XXX: Check complete LAPACK or not Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-30 09:48:53 UTC (rev 4357) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-30 10:39:36 UTC (rev 4358) @@ -1,26 +1,33 @@ # vim:syntax=python -from numpy.distutils.scons import GetNumpyEnvironment, CheckATLAS, \ - CheckAccelerate, CheckMKL, CheckCBLAS, \ - CheckSunperf +from numpy.distutils.scons import GetNumpyEnvironment +from numpy.distutils.scons.checkers.perflib import \ + CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf env = GetNumpyEnvironment(ARGUMENTS) +import os +try: + os.environ['DEBUG_SCONS_CHECK'] + do_check = 1 +except KeyError: + do_check = 0 + config = env.NumpyConfigure(custom_tests = {'CheckATLAS' : CheckATLAS, 'CheckMKL' : CheckMKL, 'CheckAccelerate' : CheckAccelerate, - 'CheckSunperf' : CheckSunperf, - 'CheckCBLAS' : CheckCBLAS}) + 'CheckSunperf' : CheckSunperf}) -#config.CheckATLAS(autoadd = 0) -#config.CheckMKL(autoadd = 0) -#config.CheckAccelerate(autoadd = 0) -#config.CheckSunperf(autoadd = 0) -#config.CheckCBLAS(autoadd = 0) +if do_check: + config.CheckATLAS(autoadd = 0) + config.CheckMKL(autoadd = 0) + config.CheckAccelerate(autoadd = 0) + config.CheckSunperf(autoadd = 0) + if env.has_key('LIBS'): + print env.Dump('LIBS') + else: + print "No LIBS in env" + config.Finish() -if env.has_key('LIBS'): - print env.Dump('LIBS') -else: - print "No LIBS in env" Modified: branches/numpy.scons/testsdist.sh =================================================================== --- branches/numpy.scons/testsdist.sh 2007-10-30 09:48:53 UTC (rev 4357) +++ branches/numpy.scons/testsdist.sh 2007-10-30 10:39:36 UTC (rev 4358) @@ -1,8 +1,9 @@ PREFIX=$PWD -SVNVER=4346 +SVNVER=` svn info | grep Revision | tr -d \ | cut -d: -f 2` rm -rf $PREFIX/build rm -rf $PREFIX/dist python setup.py sdist (cd $PREFIX/dist && tar -xzf numpy-1.0.4.dev$SVNVER.tar.gz) -(cd $PREFIX/dist/numpy-1.0.4.dev$SVNVER && python setup.py scons) +(cd $PREFIX/dist/numpy-1.0.4.dev$SVNVER && python setup.py scons --jobs=3 install --prefix=$PREFIX/dist/tmp) +(cd $PREFIX/dist/tmp && PYTHONPATH=$PREFIX/dist/tmp/lib/python2.5/site-packages python -c "import numpy; numpy.test(level = 9999)") From numpy-svn at scipy.org Tue Oct 30 08:22:17 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 07:22:17 -0500 (CDT) Subject: [Numpy-svn] r4359 - in branches/numpy.scons/numpy: distutils/scons/checkers scons_fake/checkers Message-ID: <20071030122217.8A71639C215@new.scipy.org> Author: cdavid Date: 2007-10-30 07:22:10 -0500 (Tue, 30 Oct 2007) New Revision: 4359 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct Log: Start working on getting version in perflib Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-30 10:39:36 UTC (rev 4358) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-30 12:22:10 UTC (rev 4359) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Oct 30 06:00 PM 2007 J +# Last Change: Tue Oct 30 09:00 PM 2007 J # This module defines checkers for performances libs providing standard API, # such as MKL (Intel), ATLAS, Sunperf (solaris and linux), Accelerate (Mac OS @@ -12,7 +12,7 @@ from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \ c_sgemm as sunperf_src, lapack_sgesv -from support import check_include_and_run +from support import check_include_and_run, CheckOptions #def CheckMKL(context, mkl_dir, nb): # """mkl_lib is the root path of MKL (the one which contains include, lib, @@ -25,6 +25,26 @@ # return check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], # cblas_src, libs, libpath, [], [], autoadd) +# code = """ +# #include +# #include "mkl.h" +# +# int main(void) +# { +# MKLVersion ver; +# MKLGetVersion(&ver); +# +# printf("Major version: %d\n",ver.MajorVersion); +# printf("Minor version: %d\n",ver.MinorVersion); +# printf("Build number: %d\n",ver.BuildNumber); +# printf("Product status: %s\n",ver.ProductStatus); +# printf("Build: %s\n",ver.Build); +# printf("Processor optimization: %s\n",ver.Processor); +# +# return 0; +# } +# """ + def CheckMKL(context, autoadd = 1): """Check MKL is usable using a simple cblas example.""" section = "mkl" @@ -32,12 +52,37 @@ (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) if not found: # XXX: find exact options to use for the MKL - libs.extend(['lapack', 'mkl', 'guide', 'm']) + libs.extend(['mkl', 'guide', 'm']) + headers = ['mkl.h'] return check_include_and_run(context, 'MKL', cpppath, headers, cblas_src, libs, libpath, [], [], autoadd) +def _CheckATLASVersion(context): + pass + +def CheckATLAS2(context, autoadd = 1): + """Check whether ATLAS is usable in C.""" + opts = CheckOptions(libs = ['atlas']) + + context.Message("Checking ATLAS ... ") + version_code = """ +void ATL_buildinfo(void); +int main(void) { + ATL_buildinfo(); + return 0; +} +""" + env = context.env + env.AppendUnique(LIBS = 'atlas') + if not context.TryLink(version_code, '.c'): + return "blas blas" + + st, out = context.TryRun(version_code, '.c') + context.Result(st) + return st + def CheckATLAS(context, autoadd = 1): """Check whether ATLAS is usable in C.""" Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-30 10:39:36 UTC (rev 4358) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-30 12:22:10 UTC (rev 4359) @@ -1,10 +1,43 @@ #! /usr/bin/env python -# Last Change: Tue Oct 30 05:00 PM 2007 J +# Last Change: Tue Oct 30 09:00 PM 2007 J # This module defines some helper functions, to be used by high level checkers from copy import deepcopy +class CheckOptions: + def __init__(self, cpppath = None, headers = None, cflags = None, + libpath = None, libs = None, linkflags = None): + if cpppath: + self.cpppath = cpppath + else: + self.cpppath = [] + + if headers: + self.headers = headers + else: + self.headers = [] + + if cflags: + self.cflags = cflags + else: + self.cflags = [] + + if libpath: + self.libpath = libpath + else: + self.libpath = [] + + if libs: + self.libs = libs + else: + self.libs = [] + + if linkflags: + self.linkflags = linkflags + else: + self.linkflags = [] + def check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath, linkflags, cflags, autoadd = 1): """This is a basic implementation for generic "test include and run" Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-30 10:39:36 UTC (rev 4358) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-30 12:22:10 UTC (rev 4359) @@ -1,7 +1,7 @@ # vim:syntax=python from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons.checkers.perflib import \ - CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf + CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf, CheckATLAS2 env = GetNumpyEnvironment(ARGUMENTS) @@ -14,12 +14,14 @@ config = env.NumpyConfigure(custom_tests = {'CheckATLAS' : CheckATLAS, + 'CheckATLAS2' : CheckATLAS2, 'CheckMKL' : CheckMKL, 'CheckAccelerate' : CheckAccelerate, 'CheckSunperf' : CheckSunperf}) if do_check: - config.CheckATLAS(autoadd = 0) + #config.CheckATLAS(autoadd = 0) + config.CheckATLAS2(autoadd = 0) config.CheckMKL(autoadd = 0) config.CheckAccelerate(autoadd = 0) config.CheckSunperf(autoadd = 0) From numpy-svn at scipy.org Tue Oct 30 10:27:05 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 09:27:05 -0500 (CDT) Subject: [Numpy-svn] r4360 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071030142705.BBE6839C0B2@new.scipy.org> Author: cdavid Date: 2007-10-30 09:27:00 -0500 (Tue, 30 Oct 2007) New Revision: 4360 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py Log: Put checking header in a separate function for reuse. Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-30 12:22:10 UTC (rev 4359) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-30 14:27:00 UTC (rev 4360) @@ -62,11 +62,16 @@ def _CheckATLASVersion(context): pass -def CheckATLAS2(context, autoadd = 1): +def CheckATLAS2(context, check_version = 1, autoadd = 1): """Check whether ATLAS is usable in C.""" opts = CheckOptions(libs = ['atlas']) context.Message("Checking ATLAS ... ") + + env = context.env + env.AppendUnique(LIBS = 'atlas') + + # Check whether the library is available version_code = """ void ATL_buildinfo(void); int main(void) { @@ -74,8 +79,6 @@ return 0; } """ - env = context.env - env.AppendUnique(LIBS = 'atlas') if not context.TryLink(version_code, '.c'): return "blas blas" Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-30 12:22:10 UTC (rev 4359) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-30 14:27:00 UTC (rev 4360) @@ -38,6 +38,33 @@ else: self.linkflags = [] +def _check_headers(context, cpppath, cflags, headers): + """Try to compile code including the given headers.""" + env = context.env + + #---------------------------- + # Check headers are available + #---------------------------- + oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] + oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] + env.AppendUnique(CPPPATH = cpppath) + env.AppendUnique(CFLAGS = cflags) + # XXX: handle context + hcode = ['#include <%s>' % h for h in headers] + + # HACK: we add cpppath in the command of the source, to add dependency of + # the check on the cpppath. + hcode.extend(['#if 0', '%s' % cpppath, '#endif\n']) + src = '\n'.join(hcode) + + ret = context.TryCompile(src, '.c') + if not ret: + env.Replace(CPPPATH = oldCPPPATH) + env.Replace(CFLAGS = oldCFLAGS) + return 0 + + return ret + def check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath, linkflags, cflags, autoadd = 1): """This is a basic implementation for generic "test include and run" @@ -57,29 +84,31 @@ - libs: list of libraries to link - libpath: list of library path. - linkflags: list of link flags to add.""" + context.Message('Checking for %s ... ' % name) env = context.env - #---------------------------- - # Check headers are available - #---------------------------- - oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] - oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] - env.AppendUnique(CPPPATH = cpppath) - env.AppendUnique(CFLAGS = cflags) - # XXX: handle context - hcode = ['#include <%s>' % h for h in headers] - # HACK: we add cpppath in the command of the source, to add dependency of - # the check on the cpppath. - hcode.extend(['#if 0', '%s' % cpppath, '#endif\n']) - src = '\n'.join(hcode) + # #---------------------------- + # # Check headers are available + # #---------------------------- + # oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] + # oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] + # env.AppendUnique(CPPPATH = cpppath) + # env.AppendUnique(CFLAGS = cflags) + # # XXX: handle context + # hcode = ['#include <%s>' % h for h in headers] + # # HACK: we add cpppath in the command of the source, to add dependency of + # # the check on the cpppath. + # hcode.extend(['#if 0', '%s' % cpppath, '#endif\n']) + # src = '\n'.join(hcode) - ret = context.TryCompile(src, '.c') - if not ret: - env.Replace(CPPPATH = oldCPPPATH) - env.Replace(CFLAGS = oldCFLAGS) - context.Result('Failed: %s include not found' % name) - return 0 + # ret = context.TryCompile(src, '.c') + # if not ret: + # env.Replace(CPPPATH = oldCPPPATH) + # env.Replace(CFLAGS = oldCFLAGS) + # context.Result('Failed: %s include not found' % name) + # return 0 + ret = _check_headers(context, cpppath, cflags, headers) #------------------------------ # Check a simple example works @@ -114,3 +143,6 @@ context.Result(ret) return ret +def check_lib(context, library = None, symbols = None, headers = None, language = 'C'): + if language is not 'C': + raise NotImplementedError('FIXME: support languages') From numpy-svn at scipy.org Tue Oct 30 12:21:09 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 30 Oct 2007 11:21:09 -0500 (CDT) Subject: [Numpy-svn] r4361 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071030162109.7DED839C18C@new.scipy.org> Author: cdavid Date: 2007-10-30 11:21:04 -0500 (Tue, 30 Oct 2007) New Revision: 4361 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py Log: Use the refactored check_header in libperf checkers Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-30 14:27:00 UTC (rev 4360) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-30 16:21:04 UTC (rev 4361) @@ -71,7 +71,9 @@ env = context.env env.AppendUnique(LIBS = 'atlas') - # Check whether the library is available + # Check whether the library is available (CheckLib-like checker) + + # Check version if requested version_code = """ void ATL_buildinfo(void); int main(void) { Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-30 14:27:00 UTC (rev 4360) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-30 16:21:04 UTC (rev 4361) @@ -38,7 +38,7 @@ else: self.linkflags = [] -def _check_headers(context, cpppath, cflags, headers): +def _check_headers(context, cpppath, cflags, headers, autoadd): """Try to compile code including the given headers.""" env = context.env @@ -58,13 +58,41 @@ src = '\n'.join(hcode) ret = context.TryCompile(src, '.c') - if not ret: + if ret == 0 or autoadd == 0: env.Replace(CPPPATH = oldCPPPATH) env.Replace(CFLAGS = oldCFLAGS) return 0 return ret +def _check_libs(context, cpppath, headers, cflags, libpath, libs, linkflags, autoadd): + raise NotImplementedError("FIXME") + #------------------------------ + # Check a simple example works + #------------------------------ + oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] + oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] + oldLINKFLAGS = (env.has_key('LINKFLAGS') and deepcopy(env['LINKFLAGS'])) or [] + # # XXX: RPATH, drawbacks using it ? + # oldRPATH = (env.has_key('RPATH') and deepcopy(env['RPATH'])) or [] + env.AppendUnique(LIBPATH = libpath) + env.AppendUnique(LIBS = libs) + #env.AppendUnique(RPATH = libpath) + env.AppendUnique(LINKFLAGS = linkflags) + + # HACK: we add libpath and libs at the end of the source as a comment, to + # add dependency of the check on those. + src = '\n'.join(['#include <%s>' % h for h in headers] +\ + [run_src, '#if 0', '%s' % libpath, + '%s' % headers, '%s' % libs, '#endif']) + ret = context.TryLink(src, '.c') + if (not ret or not autoadd): + # If test failed or autoadd = 0, restore everything + env.Replace(LIBS = oldLIBS) + env.Replace(LIBPATH = oldLIBPATH) + env.Replace(RPATH = oldRPATH) + env.Replace(LINKFLAGS = oldLINKFLAGS) + def check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath, linkflags, cflags, autoadd = 1): """This is a basic implementation for generic "test include and run" @@ -88,27 +116,9 @@ context.Message('Checking for %s ... ' % name) env = context.env - # #---------------------------- - # # Check headers are available - # #---------------------------- - # oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] - # oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] - # env.AppendUnique(CPPPATH = cpppath) - # env.AppendUnique(CFLAGS = cflags) - # # XXX: handle context - # hcode = ['#include <%s>' % h for h in headers] - # # HACK: we add cpppath in the command of the source, to add dependency of - # # the check on the cpppath. - # hcode.extend(['#if 0', '%s' % cpppath, '#endif\n']) - # src = '\n'.join(hcode) - - # ret = context.TryCompile(src, '.c') - # if not ret: - # env.Replace(CPPPATH = oldCPPPATH) - # env.Replace(CFLAGS = oldCFLAGS) - # context.Result('Failed: %s include not found' % name) - # return 0 ret = _check_headers(context, cpppath, cflags, headers) + if not ret: + context.Result('Failed: %s include not found' % name) #------------------------------ # Check a simple example works @@ -145,4 +155,4 @@ def check_lib(context, library = None, symbols = None, headers = None, language = 'C'): if language is not 'C': - raise NotImplementedError('FIXME: support languages') + raise NotImplementedError('FIXME: support non-C languages') From numpy-svn at scipy.org Wed Oct 31 03:20:53 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 31 Oct 2007 02:20:53 -0500 (CDT) Subject: [Numpy-svn] r4362 - in branches/numpy.scons/numpy: distutils/scons/checkers scons_fake/checkers Message-ID: <20071031072053.B546D39C112@new.scipy.org> Author: cdavid Date: 2007-10-31 02:20:40 -0500 (Wed, 31 Oct 2007) New Revision: 4362 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct Log: More refactoring of custom checkers: - implements a scheme for save-and-set / restore env variables used for tests - MKL and ATLAS checkers implemented using the above scheme Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-30 16:21:04 UTC (rev 4361) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-31 07:20:40 UTC (rev 4362) @@ -37,6 +37,10 @@ # printf("Major version: %d\n",ver.MajorVersion); # printf("Minor version: %d\n",ver.MinorVersion); # printf("Build number: %d\n",ver.BuildNumber); +# printf("Full version: %d.%d.%d\n", +# ver.MajorVersion, +# ver.MinorVersion, +# ver.BuildNumber); # printf("Product status: %s\n",ver.ProductStatus); # printf("Build: %s\n",ver.Build); # printf("Processor optimization: %s\n",ver.Processor); @@ -45,49 +49,207 @@ # } # """ -def CheckMKL(context, autoadd = 1): - """Check MKL is usable using a simple cblas example.""" +# def CheckMKL(context, autoadd = 1): +# """Check MKL is usable using a simple cblas example.""" +# section = "mkl" +# siteconfig, cfgfiles = get_config() +# (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) +# if not found: +# # XXX: find exact options to use for the MKL +# libs.extend(['mkl', 'guide', 'm']) +# +# headers = ['mkl.h'] +# +# return check_include_and_run(context, 'MKL', cpppath, headers, +# cblas_src, libs, libpath, [], [], autoadd) + +def _CheckATLASVersion(context): + pass + +from support import save_set, restore +import re + +def CheckMKL(context, check_version = 1, autoadd = 1): + """Check whether mkl is usable in C.""" + context.Message("Checking MKL ... ") + + # XXX: take into account siteconfig section = "mkl" siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) if not found: # XXX: find exact options to use for the MKL libs.extend(['mkl', 'guide', 'm']) + opts = {'cpppath' : cpppath, 'libpath' : libpath, 'libs' : libs} + env = context.env + test_funcs = ['MKLGetVersion'] headers = ['mkl.h'] - return check_include_and_run(context, 'MKL', cpppath, headers, - cblas_src, libs, libpath, [], [], autoadd) + # Check whether the header is available (CheckHeader-like checker) + saved = save_set(env, opts) + try: + # XXX: add dep vars in code + src = '\n'.join([r'#include <%s>\n' % h for h in headers]) + st = context.TryCompile(src, '.c') + finally: + restore(env, saved) -def _CheckATLASVersion(context): - pass + if not st: + context.Result('Failed (could not check header(s))') + return st + # Check whether the library is available (CheckLib-like checker) + saved = save_set(env, opts) + try: + for sym in test_funcs: + # XXX: add dep vars in code + st = check_symbol(context, headers, sym) + if not st: + break + finally: + if st == 0 or autoadd == 0: + restore(env, saved) + + if not st: + context.Result('Failed (could not check symbol %s)' % sym) + return st + + context.Result(st) + + # Check version if requested + if check_version: + saved = save_set(env, opts) + version_code = """ +#include +#include + +int main(void) +{ + MKLVersion ver; + MKLGetVersion(&ver); + + printf("Full version: %d.%d.%d\n", ver.MajorVersion, + ver.MinorVersion, + ver.BuildNumber); + + return 0; +} +""" + + try: + vst, out = context.TryRun(version_code, '.c') + finally: + restore(env, saved) + + if not vst: + version = r'?.?.? (could not get version)' + else: + m = re.search( + r'Full version: (\d+[.]\d+[.]\d+)', + out) + if m: + version = m.group('version') + else: + version = r'?.?.? (could not get version)' + opts['version'] = version + + return st, opts + +def check_symbol(context, headers, sym, extra = r''): + # XXX: add dep vars in code + code = [r'#include <%s>' %h for h in headers] + code.append(r''' +#undef %(func)s +#ifdef __cplusplus +extern "C" +#endif +char %(func)s(); + +int main() +{ +return %(func)s(); +return 0; +} +''' % {'func' : sym}) + code.append(extra) + return context.TryLink('\n'.join(code), '.c') + def CheckATLAS2(context, check_version = 1, autoadd = 1): """Check whether ATLAS is usable in C.""" - opts = CheckOptions(libs = ['atlas']) - context.Message("Checking ATLAS ... ") + section = "atlas" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if not found: + libs.extend(['atlas']) + opts = {'cpppath' : cpppath, 'libpath' : libpath, 'libs' : libs} + env = context.env - env.AppendUnique(LIBS = 'atlas') + test_funcs = ['ATL_sgemm'] + headers = ['atlas_enum.h'] + # Check whether the header is available (CheckHeader-like checker) + saved = save_set(env, opts) + try: + # XXX: add dep vars in code + src = '\n'.join([r'#include <%s>\n' % h for h in headers]) + st = context.TryCompile(src, '.c') + finally: + restore(env, saved) + + if not st: + context.Result('Failed (could not check header(s))') + return st + # Check whether the library is available (CheckLib-like checker) + saved = save_set(env, opts) + try: + for sym in test_funcs: + # XXX: add dep vars in code + st = check_symbol(context, headers, sym) + if not st: + break + finally: + if st == 0 or autoadd == 0: + restore(env, saved) + + if not st: + context.Result('Failed (could not check symbol %s)' % sym) + return st + + context.Result(st) # Check version if requested - version_code = """ + if check_version: + saved = save_set(env, opts) + version_code = """ void ATL_buildinfo(void); int main(void) { ATL_buildinfo(); return 0; } """ - if not context.TryLink(version_code, '.c'): - return "blas blas" + try: + vst, out = context.TryRun(version_code, '.c') + finally: + restore(env, saved) - st, out = context.TryRun(version_code, '.c') - context.Result(st) - return st + if not vst: + version = r'?.?.? (could not get version)' + else: + m = re.search( + r'ATLAS version (?P\d+[.]\d+[.]\d+)', + out) + if m: + version = m.group('version') + else: + version = r'?.?.? (could not get version)' + opts['version'] = version + return st, opts + def CheckATLAS(context, autoadd = 1): """Check whether ATLAS is usable in C.""" Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-30 16:21:04 UTC (rev 4361) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-31 07:20:40 UTC (rev 4362) @@ -5,94 +5,32 @@ from copy import deepcopy -class CheckOptions: - def __init__(self, cpppath = None, headers = None, cflags = None, - libpath = None, libs = None, linkflags = None): - if cpppath: - self.cpppath = cpppath - else: - self.cpppath = [] +_arg2env = {'cpppath' : 'CPPPATH', + 'cflags' : 'CFLAGS', + 'libpath' : 'LIBPATH', + 'libs' : 'LIBS', + 'linkflags' : 'LINKFLAGS'} - if headers: - self.headers = headers - else: - self.headers = [] +def save_set(env, opts): + """keys given as config opts args.""" + saved_keys = {} + keys = opts.keys() + for k in keys: + saved_keys[k] = (env.has_key(_arg2env[k]) and\ + deepcopy(env[_arg2env[k]])) or\ + [] + kw = zip([_arg2env[k] for k in keys], [opts[k] for k in keys]) + kw = dict(kw) + env.AppendUnique(**kw) + return saved_keys - if cflags: - self.cflags = cflags - else: - self.cflags = [] +def restore(env, saved_keys): + keys = saved_keys.keys() + kw = zip([_arg2env[k] for k in keys], + [saved_keys[k] for k in keys]) + kw = dict(kw) + env.Replace(**kw) - if libpath: - self.libpath = libpath - else: - self.libpath = [] - - if libs: - self.libs = libs - else: - self.libs = [] - - if linkflags: - self.linkflags = linkflags - else: - self.linkflags = [] - -def _check_headers(context, cpppath, cflags, headers, autoadd): - """Try to compile code including the given headers.""" - env = context.env - - #---------------------------- - # Check headers are available - #---------------------------- - oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] - oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] - env.AppendUnique(CPPPATH = cpppath) - env.AppendUnique(CFLAGS = cflags) - # XXX: handle context - hcode = ['#include <%s>' % h for h in headers] - - # HACK: we add cpppath in the command of the source, to add dependency of - # the check on the cpppath. - hcode.extend(['#if 0', '%s' % cpppath, '#endif\n']) - src = '\n'.join(hcode) - - ret = context.TryCompile(src, '.c') - if ret == 0 or autoadd == 0: - env.Replace(CPPPATH = oldCPPPATH) - env.Replace(CFLAGS = oldCFLAGS) - return 0 - - return ret - -def _check_libs(context, cpppath, headers, cflags, libpath, libs, linkflags, autoadd): - raise NotImplementedError("FIXME") - #------------------------------ - # Check a simple example works - #------------------------------ - oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] - oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] - oldLINKFLAGS = (env.has_key('LINKFLAGS') and deepcopy(env['LINKFLAGS'])) or [] - # # XXX: RPATH, drawbacks using it ? - # oldRPATH = (env.has_key('RPATH') and deepcopy(env['RPATH'])) or [] - env.AppendUnique(LIBPATH = libpath) - env.AppendUnique(LIBS = libs) - #env.AppendUnique(RPATH = libpath) - env.AppendUnique(LINKFLAGS = linkflags) - - # HACK: we add libpath and libs at the end of the source as a comment, to - # add dependency of the check on those. - src = '\n'.join(['#include <%s>' % h for h in headers] +\ - [run_src, '#if 0', '%s' % libpath, - '%s' % headers, '%s' % libs, '#endif']) - ret = context.TryLink(src, '.c') - if (not ret or not autoadd): - # If test failed or autoadd = 0, restore everything - env.Replace(LIBS = oldLIBS) - env.Replace(LIBPATH = oldLIBPATH) - env.Replace(RPATH = oldRPATH) - env.Replace(LINKFLAGS = oldLINKFLAGS) - def check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath, linkflags, cflags, autoadd = 1): """This is a basic implementation for generic "test include and run" @@ -152,7 +90,3 @@ context.Result(ret) return ret - -def check_lib(context, library = None, symbols = None, headers = None, language = 'C'): - if language is not 'C': - raise NotImplementedError('FIXME: support non-C languages') Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-30 16:21:04 UTC (rev 4361) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-31 07:20:40 UTC (rev 4362) @@ -21,8 +21,12 @@ if do_check: #config.CheckATLAS(autoadd = 0) - config.CheckATLAS2(autoadd = 0) - config.CheckMKL(autoadd = 0) + st, opts = config.CheckATLAS2(autoadd = 0) + if st: + print opts + st, opts = config.CheckMKL(autoadd = 0) + if st: + print opts config.CheckAccelerate(autoadd = 0) config.CheckSunperf(autoadd = 0) From numpy-svn at scipy.org Wed Oct 31 05:48:08 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 31 Oct 2007 04:48:08 -0500 (CDT) Subject: [Numpy-svn] r4363 - in branches/numpy.scons/numpy: distutils/scons/checkers scons_fake/checkers Message-ID: <20071031094808.30F4139C26D@new.scipy.org> Author: cdavid Date: 2007-10-31 04:48:00 -0500 (Wed, 31 Oct 2007) New Revision: 4363 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct Log: More refactoring of libperf checkers: now mosly abstracted away (defining your own is a few lines). Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-31 07:20:40 UTC (rev 4362) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-31 09:48:00 UTC (rev 4363) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Oct 30 09:00 PM 2007 J +# Last Change: Wed Oct 31 06:00 PM 2007 J # This module defines checkers for performances libs providing standard API, # such as MKL (Intel), ATLAS, Sunperf (solaris and linux), Accelerate (Mac OS @@ -7,104 +7,49 @@ # using a library specific check if possible, or other heuristics. # Generally, you don't use those directly: they are used in 'meta' checkers, # such as BLAS, CBLAS, LAPACK checkers. +import re from numpy.distutils.scons.libinfo import get_config_from_section, get_config from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \ c_sgemm as sunperf_src, lapack_sgesv -from support import check_include_and_run, CheckOptions +from support import check_include_and_run, check_symbol +from support import save_and_set, restore, ConfigOpts -#def CheckMKL(context, mkl_dir, nb): -# """mkl_lib is the root path of MKL (the one which contains include, lib, -# etc...). nb is 32, 64, emt, etc...""" -# -# libs = ['mkl'] -# cpppath = os.path.join(mkl_dir, 'include') -# libpath = os.path.join(mkl_dir, 'lib', nb) -# -# return check_include_and_run(context, 'MKL', cpppath, ['mkl.h'], -# cblas_src, libs, libpath, [], [], autoadd) +def _check(context, name, section, defopts, headers_to_check, funcs_to_check, + check_version, version_checker, autoadd): + context.Message("Checking %s ... " % name) -# code = """ -# #include -# #include "mkl.h" -# -# int main(void) -# { -# MKLVersion ver; -# MKLGetVersion(&ver); -# -# printf("Major version: %d\n",ver.MajorVersion); -# printf("Minor version: %d\n",ver.MinorVersion); -# printf("Build number: %d\n",ver.BuildNumber); -# printf("Full version: %d.%d.%d\n", -# ver.MajorVersion, -# ver.MinorVersion, -# ver.BuildNumber); -# printf("Product status: %s\n",ver.ProductStatus); -# printf("Build: %s\n",ver.Build); -# printf("Processor optimization: %s\n",ver.Processor); -# -# return 0; -# } -# """ - -# def CheckMKL(context, autoadd = 1): -# """Check MKL is usable using a simple cblas example.""" -# section = "mkl" -# siteconfig, cfgfiles = get_config() -# (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) -# if not found: -# # XXX: find exact options to use for the MKL -# libs.extend(['mkl', 'guide', 'm']) -# -# headers = ['mkl.h'] -# -# return check_include_and_run(context, 'MKL', cpppath, headers, -# cblas_src, libs, libpath, [], [], autoadd) - -def _CheckATLASVersion(context): - pass - -from support import save_set, restore -import re - -def CheckMKL(context, check_version = 1, autoadd = 1): - """Check whether mkl is usable in C.""" - context.Message("Checking MKL ... ") - - # XXX: take into account siteconfig - section = "mkl" + # Get site.cfg customization if any siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) - if not found: - # XXX: find exact options to use for the MKL - libs.extend(['mkl', 'guide', 'm']) - opts = {'cpppath' : cpppath, 'libpath' : libpath, 'libs' : libs} + if found: + opts = ConfigOpts(cpppath = cpppath, libpath = libpath, libs = libs) + else: + opts = defopts env = context.env - test_funcs = ['MKLGetVersion'] - headers = ['mkl.h'] # Check whether the header is available (CheckHeader-like checker) - saved = save_set(env, opts) + saved = save_and_set(env, opts) try: # XXX: add dep vars in code - src = '\n'.join([r'#include <%s>\n' % h for h in headers]) + src = '\n'.join([r'#include <%s>\n' % h for h in headers_to_check]) st = context.TryCompile(src, '.c') finally: restore(env, saved) if not st: - context.Result('Failed (could not check header(s))') - return st + context.Result('Failed (could not check header(s) : check config.log '\ + 'in %s for more details)' % env['build_dir']) + return st, {} # Check whether the library is available (CheckLib-like checker) - saved = save_set(env, opts) + saved = save_and_set(env, opts) try: - for sym in test_funcs: + for sym in funcs_to_check: # XXX: add dep vars in code - st = check_symbol(context, headers, sym) + st = check_symbol(context, headers_to_check, sym) if not st: break finally: @@ -112,15 +57,34 @@ restore(env, saved) if not st: - context.Result('Failed (could not check symbol %s)' % sym) - return st + context.Result('Failed (could not check symbol %s : check config.log '\ + 'in %s for more details))' % (sym, env['build_dir'])) + return st, {} context.Result(st) # Check version if requested if check_version: - saved = save_set(env, opts) - version_code = """ + if version_checker: + vst, v = version_checker(env, opts) + if vst: + version = v + else: + version = 'Unknown (checking version failed)' + else: + version = 'Unkown (not implemented)' + + return st, opts + +def CheckMKL(context, check_version = 0, autoadd = 1): + name = 'MKL' + section = 'mkl' + defopts = ConfigOpts(libs = ['mkl', 'guide', 'm']) + headers = ['mkl.h'] + funcs = ['MKLGetVersion'] + + def mkl_version_checker(env, opts): + version_code = r""" #include #include @@ -137,119 +101,193 @@ } """ + opts['rpath'] = libpath + saved = save_and_set(env, opts) try: vst, out = context.TryRun(version_code, '.c') finally: restore(env, saved) - if not vst: - version = r'?.?.? (could not get version)' + if vst and re.search(r'Full version: (\d+[.]\d+[.]\d+)', out): + version = m.group(1) else: - m = re.search( - r'Full version: (\d+[.]\d+[.]\d+)', - out) - if m: - version = m.group('version') - else: - version = r'?.?.? (could not get version)' - opts['version'] = version + version = '' - return st, opts + return vst, version -def check_symbol(context, headers, sym, extra = r''): - # XXX: add dep vars in code - code = [r'#include <%s>' %h for h in headers] - code.append(r''' -#undef %(func)s -#ifdef __cplusplus -extern "C" -#endif -char %(func)s(); + return _check(context, name, section, defopts, headers, funcs, + check_version, mkl_version_checker, autoadd) -int main() -{ -return %(func)s(); -return 0; -} -''' % {'func' : sym}) - code.append(extra) - return context.TryLink('\n'.join(code), '.c') +#def CheckMKL(context, check_version = 0, autoadd = 1): +# """Check whether mkl is usable in C.""" +# context.Message("Checking MKL ... ") +# +# # XXX: take into account siteconfig +# section = "mkl" +# siteconfig, cfgfiles = get_config() +# (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) +# if not found: +# # XXX: find exact options to use for the MKL +# libs.extend(['mkl', 'guide', 'm']) +# opts = {'cpppath' : cpppath, 'libpath' : libpath, 'libs' : libs} +# +# env = context.env +# test_funcs = ['MKLGetVersion'] +# headers = ['mkl.h'] +# +# # Check whether the header is available (CheckHeader-like checker) +# saved = save_and_set(env, opts) +# try: +# # XXX: add dep vars in code +# src = '\n'.join([r'#include <%s>\n' % h for h in headers]) +# st = context.TryCompile(src, '.c') +# finally: +# restore(env, saved) +# +# if not st: +# context.Result('Failed (could not check header(s) : check config.log '\ +# 'in %s for more details)' % env['build_dir']) +# return st, opts +# +# # Check whether the library is available (CheckLib-like checker) +# saved = save_and_set(env, opts) +# try: +# for sym in test_funcs: +# # XXX: add dep vars in code +# st = check_symbol(context, headers, sym) +# if not st: +# break +# finally: +# if st == 0 or autoadd == 0: +# restore(env, saved) +# +# if not st: +# context.Result('Failed (could not check symbol %s : check config.log in %s for more details))' % (sym, env['build_dir'])) +# return st, opts +# +# context.Result(st) +# +# # Check version if requested +# if check_version: +# version_code = r""" +##include +##include +# +#int main(void) +#{ +# MKLVersion ver; +# MKLGetVersion(&ver); +# +# printf("Full version: %d.%d.%d\n", ver.MajorVersion, +# ver.MinorVersion, +# ver.BuildNumber); +# +# return 0; +#} +#""" +# +# opts['rpath'] = libpath +# saved = save_and_set(env, opts) +# try: +# vst, out = context.TryRun(version_code, '.c') +# finally: +# restore(env, saved) +# +# if not vst: +# version = r'?.?.? (could not get version)' +# else: +# m = re.search(r'Full version: (\d+[.]\d+[.]\d+)', out) +# if m: +# version = m.group(1) +# else: +# version = r'?.?.? (could not get version)' +# opts['version'] = version +# +# return st, opts def CheckATLAS2(context, check_version = 1, autoadd = 1): """Check whether ATLAS is usable in C.""" - context.Message("Checking ATLAS ... ") - - section = "atlas" - siteconfig, cfgfiles = get_config() - (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) - if not found: - libs.extend(['atlas']) - opts = {'cpppath' : cpppath, 'libpath' : libpath, 'libs' : libs} - - env = context.env - test_funcs = ['ATL_sgemm'] + name = 'ATLAS' + section = 'atlas' + defopts = ConfigOpts(libs = ['atlas']) headers = ['atlas_enum.h'] + funcs = ['ATL_sgemm'] + return _check(context, name, section, defopts, headers, funcs, + check_version, None, autoadd) - # Check whether the header is available (CheckHeader-like checker) - saved = save_set(env, opts) - try: - # XXX: add dep vars in code - src = '\n'.join([r'#include <%s>\n' % h for h in headers]) - st = context.TryCompile(src, '.c') - finally: - restore(env, saved) +# context.Message("Checking ATLAS ... ") +# +# section = "atlas" +# siteconfig, cfgfiles = get_config() +# (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) +# if not found: +# libs.extend(['atlas']) +# opts = {'cpppath' : cpppath, 'libpath' : libpath, 'libs' : libs} +# +# env = context.env +# test_funcs = ['ATL_sgemm'] +# headers = ['atlas_enum.h'] +# +# # Check whether the header is available (CheckHeader-like checker) +# saved = save_and_set(env, opts) +# try: +# # XXX: add dep vars in code +# src = '\n'.join([r'#include <%s>\n' % h for h in headers]) +# st = context.TryCompile(src, '.c') +# finally: +# restore(env, saved) +# +# if not st: +# context.Result('Failed (could not check header(s))') +# return st +# +# # Check whether the library is available (CheckLib-like checker) +# saved = save_and_set(env, opts) +# try: +# for sym in test_funcs: +# # XXX: add dep vars in code +# st = check_symbol(context, headers, sym) +# if not st: +# break +# finally: +# if st == 0 or autoadd == 0: +# restore(env, saved) +# +# if not st: +# context.Result('Failed (could not check symbol %s)' % sym) +# return st +# +# context.Result(st) +# +# # Check version if requested +# if check_version: +# saved = save_and_set(env, opts) +# version_code = """ +#void ATL_buildinfo(void); +#int main(void) { +# ATL_buildinfo(); +# return 0; +#} +#""" +# try: +# vst, out = context.TryRun(version_code, '.c') +# finally: +# restore(env, saved) +# +# if not vst: +# version = r'?.?.? (could not get version)' +# else: +# m = re.search( +# r'ATLAS version (?P\d+[.]\d+[.]\d+)', +# out) +# if m: +# version = m.group('version') +# else: +# version = r'?.?.? (could not get version)' +# opts['version'] = version +# +# return st, opts - if not st: - context.Result('Failed (could not check header(s))') - return st - - # Check whether the library is available (CheckLib-like checker) - saved = save_set(env, opts) - try: - for sym in test_funcs: - # XXX: add dep vars in code - st = check_symbol(context, headers, sym) - if not st: - break - finally: - if st == 0 or autoadd == 0: - restore(env, saved) - - if not st: - context.Result('Failed (could not check symbol %s)' % sym) - return st - - context.Result(st) - - # Check version if requested - if check_version: - saved = save_set(env, opts) - version_code = """ -void ATL_buildinfo(void); -int main(void) { - ATL_buildinfo(); - return 0; -} -""" - try: - vst, out = context.TryRun(version_code, '.c') - finally: - restore(env, saved) - - if not vst: - version = r'?.?.? (could not get version)' - else: - m = re.search( - r'ATLAS version (?P\d+[.]\d+[.]\d+)', - out) - if m: - version = m.group('version') - else: - version = r'?.?.? (could not get version)' - opts['version'] = version - - return st, opts - def CheckATLAS(context, autoadd = 1): """Check whether ATLAS is usable in C.""" Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-31 07:20:40 UTC (rev 4362) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-31 09:48:00 UTC (rev 4363) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Oct 30 09:00 PM 2007 J +# Last Change: Wed Oct 31 06:00 PM 2007 J # This module defines some helper functions, to be used by high level checkers @@ -9,17 +9,18 @@ 'cflags' : 'CFLAGS', 'libpath' : 'LIBPATH', 'libs' : 'LIBS', - 'linkflags' : 'LINKFLAGS'} + 'linkflags' : 'LINKFLAGS', + 'rpath' : 'RPATH'} -def save_set(env, opts): +def save_and_set(env, opts): """keys given as config opts args.""" saved_keys = {} - keys = opts.keys() + keys = opts.data.keys() for k in keys: saved_keys[k] = (env.has_key(_arg2env[k]) and\ deepcopy(env[_arg2env[k]])) or\ [] - kw = zip([_arg2env[k] for k in keys], [opts[k] for k in keys]) + kw = zip([_arg2env[k] for k in keys], [opts.data[k] for k in keys]) kw = dict(kw) env.AppendUnique(**kw) return saved_keys @@ -31,6 +32,78 @@ kw = dict(kw) env.Replace(**kw) +def check_symbol(context, headers, sym, extra = r''): + # XXX: add dep vars in code + #code = [r'#include <%s>' %h for h in headers] + code = [] + code.append(r''' +#undef %(func)s +#ifdef __cplusplus +extern "C" +#endif +char %(func)s(); + +int main() +{ +return %(func)s(); +return 0; +} +''' % {'func' : sym}) + code.append(extra) + return context.TryLink('\n'.join(code), '.c') + +class ConfigOpts: + _keys = ['cpppath', 'cflags', 'libpath', 'libs', 'linkflags', 'rpath'] + def __init__(self, cpppath = None, cflags = None, libpath = None, libs = None, + linkflags = None, rpath = None): + data = {} + + if not cpppath: + data['cpppath'] = [] + else: + data['cpppath'] = cpppath + + if not cflags: + data['cflags'] = [] + else: + data['cflags'] = cflags + + if not libpath: + data['libpath'] = [] + else: + data['libpath'] = libpath + + if not libs: + data['libs'] = [] + else: + data['libs'] = libs + + if not linkflags: + data['linkflags'] = [] + else: + data['linkflags'] = linkflags + + if not rpath: + data['rpath'] = [] + else: + data['rpath'] = rpath + + self.data = data + + def __getitem__(self, key): + return self.data[key] + + def __setitem__(self, key, item): + self.data[key] = item + + def __repr__(self): + msg = [r'%s : %s' % (k, i) for k, i in self.data.items()] + return '\n'.join(msg) + +class ConfigRes(): + def __init__(self, cfgopts, version, origin): + pass + def check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath, linkflags, cflags, autoadd = 1): """This is a basic implementation for generic "test include and run" Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-31 07:20:40 UTC (rev 4362) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-31 09:48:00 UTC (rev 4363) @@ -27,8 +27,8 @@ st, opts = config.CheckMKL(autoadd = 0) if st: print opts - config.CheckAccelerate(autoadd = 0) - config.CheckSunperf(autoadd = 0) + # config.CheckAccelerate(autoadd = 0) + # config.CheckSunperf(autoadd = 0) if env.has_key('LIBS'): print env.Dump('LIBS') From numpy-svn at scipy.org Wed Oct 31 06:47:26 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 31 Oct 2007 05:47:26 -0500 (CDT) Subject: [Numpy-svn] r4364 - in branches/numpy.scons/numpy: distutils/scons/checkers scons_fake/checkers Message-ID: <20071031104726.6831339C06A@new.scipy.org> Author: cdavid Date: 2007-10-31 05:47:18 -0500 (Wed, 31 Oct 2007) New Revision: 4364 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct Log: Refactor libperf checkers: mostly done Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-10-31 09:48:00 UTC (rev 4363) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-10-31 10:47:18 UTC (rev 4364) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Oct 30 07:00 PM 2007 J +# Last Change: Wed Oct 31 07:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -49,7 +49,7 @@ else: # Check MKL, then ATLAS, then Sunperf - st = CheckMKL(context, autoadd) + st, opts = CheckMKL(context, autoadd) if st: add_info(env, 'cblas', opt_info('mkl')) return st Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-31 09:48:00 UTC (rev 4363) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-31 10:47:18 UTC (rev 4364) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Wed Oct 31 06:00 PM 2007 J +# Last Change: Wed Oct 31 07:00 PM 2007 J # This module defines checkers for performances libs providing standard API, # such as MKL (Intel), ATLAS, Sunperf (solaris and linux), Accelerate (Mac OS @@ -14,10 +14,17 @@ c_sgemm as sunperf_src, lapack_sgesv from support import check_include_and_run, check_symbol -from support import save_and_set, restore, ConfigOpts +from support import save_and_set, restore, ConfigOpts, ConfigRes def _check(context, name, section, defopts, headers_to_check, funcs_to_check, check_version, version_checker, autoadd): + """Generic implementation for perflib check. + + This checks for header (by compiling code including them) and symbols in + libraries (by linking code calling for given symbols). Optionnaly, it can + get the version using some specific function. + + See CheckATLAS or CheckMKL for examples.""" context.Message("Checking %s ... " % name) # Get site.cfg customization if any @@ -42,7 +49,7 @@ if not st: context.Result('Failed (could not check header(s) : check config.log '\ 'in %s for more details)' % env['build_dir']) - return st, {} + return st, ConfigRes(opts, found) # Check whether the library is available (CheckLib-like checker) saved = save_and_set(env, opts) @@ -59,7 +66,7 @@ if not st: context.Result('Failed (could not check symbol %s : check config.log '\ 'in %s for more details))' % (sym, env['build_dir'])) - return st, {} + return st, ConfigRes(opts, found) context.Result(st) @@ -73,233 +80,93 @@ version = 'Unknown (checking version failed)' else: version = 'Unkown (not implemented)' + cfgres = ConfigRes(opts, found, version) + else: + cfgres = ConfigRes(opts, found, version = 'Not checked') - return st, opts + return st, cfgres -def CheckMKL(context, check_version = 0, autoadd = 1): - name = 'MKL' - section = 'mkl' - defopts = ConfigOpts(libs = ['mkl', 'guide', 'm']) - headers = ['mkl.h'] - funcs = ['MKLGetVersion'] - - def mkl_version_checker(env, opts): - version_code = r""" +def _check_mkl_version(env, opts): + version_code = r""" #include #include int main(void) { - MKLVersion ver; - MKLGetVersion(&ver); +MKLVersion ver; +MKLGetVersion(&ver); - printf("Full version: %d.%d.%d\n", ver.MajorVersion, - ver.MinorVersion, - ver.BuildNumber); +printf("Full version: %d.%d.%d\n", ver.MajorVersion, + ver.MinorVersion, + ver.BuildNumber); - return 0; +return 0; } """ - opts['rpath'] = libpath - saved = save_and_set(env, opts) - try: - vst, out = context.TryRun(version_code, '.c') - finally: - restore(env, saved) + opts['rpath'] = opts['libpath'] + saved = save_and_set(env, opts) + try: + vst, out = context.TryRun(version_code, '.c') + finally: + restore(env, saved) - if vst and re.search(r'Full version: (\d+[.]\d+[.]\d+)', out): + if vst and re.search(r'Full version: (\d+[.]\d+[.]\d+)', out): + version = m.group(1) + else: + version = '' + + return vst, version + +def _atlas_version_checker(env, opts): + version_code = """ +void ATL_buildinfo(void); +int main(void) { +ATL_buildinfo(); +return 0; +} +""" + opts['rpath'] = opts['libpath'] + saved = save_and_set(env, opts) + try: + vst, out = context.TryRun(version_code, '.c') + finally: + restore(env, saved) + + if vst: + m = re.search('ATLAS version (?P\d+[.]\d+[.]\d+)', out) + if m: version = m.group(1) else: version = '' + else: + version = '' - return vst, version + return vst, version +def CheckMKL(context, autoadd = 1, check_version = 0): + name = 'MKL' + section = 'mkl' + defopts = ConfigOpts(libs = ['mkl', 'guide', 'm']) + headers = ['mkl.h'] + funcs = ['MKLGetVersion'] + return _check(context, name, section, defopts, headers, funcs, - check_version, mkl_version_checker, autoadd) + check_version, _mkl_version_checker, autoadd) -#def CheckMKL(context, check_version = 0, autoadd = 1): -# """Check whether mkl is usable in C.""" -# context.Message("Checking MKL ... ") -# -# # XXX: take into account siteconfig -# section = "mkl" -# siteconfig, cfgfiles = get_config() -# (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) -# if not found: -# # XXX: find exact options to use for the MKL -# libs.extend(['mkl', 'guide', 'm']) -# opts = {'cpppath' : cpppath, 'libpath' : libpath, 'libs' : libs} -# -# env = context.env -# test_funcs = ['MKLGetVersion'] -# headers = ['mkl.h'] -# -# # Check whether the header is available (CheckHeader-like checker) -# saved = save_and_set(env, opts) -# try: -# # XXX: add dep vars in code -# src = '\n'.join([r'#include <%s>\n' % h for h in headers]) -# st = context.TryCompile(src, '.c') -# finally: -# restore(env, saved) -# -# if not st: -# context.Result('Failed (could not check header(s) : check config.log '\ -# 'in %s for more details)' % env['build_dir']) -# return st, opts -# -# # Check whether the library is available (CheckLib-like checker) -# saved = save_and_set(env, opts) -# try: -# for sym in test_funcs: -# # XXX: add dep vars in code -# st = check_symbol(context, headers, sym) -# if not st: -# break -# finally: -# if st == 0 or autoadd == 0: -# restore(env, saved) -# -# if not st: -# context.Result('Failed (could not check symbol %s : check config.log in %s for more details))' % (sym, env['build_dir'])) -# return st, opts -# -# context.Result(st) -# -# # Check version if requested -# if check_version: -# version_code = r""" -##include -##include -# -#int main(void) -#{ -# MKLVersion ver; -# MKLGetVersion(&ver); -# -# printf("Full version: %d.%d.%d\n", ver.MajorVersion, -# ver.MinorVersion, -# ver.BuildNumber); -# -# return 0; -#} -#""" -# -# opts['rpath'] = libpath -# saved = save_and_set(env, opts) -# try: -# vst, out = context.TryRun(version_code, '.c') -# finally: -# restore(env, saved) -# -# if not vst: -# version = r'?.?.? (could not get version)' -# else: -# m = re.search(r'Full version: (\d+[.]\d+[.]\d+)', out) -# if m: -# version = m.group(1) -# else: -# version = r'?.?.? (could not get version)' -# opts['version'] = version -# -# return st, opts - -def CheckATLAS2(context, check_version = 1, autoadd = 1): +def CheckATLAS(context, autoadd = 1, check_version = 0): """Check whether ATLAS is usable in C.""" name = 'ATLAS' section = 'atlas' defopts = ConfigOpts(libs = ['atlas']) headers = ['atlas_enum.h'] funcs = ['ATL_sgemm'] + return _check(context, name, section, defopts, headers, funcs, - check_version, None, autoadd) + check_version, _atlas_version_checker, autoadd) -# context.Message("Checking ATLAS ... ") -# -# section = "atlas" -# siteconfig, cfgfiles = get_config() -# (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) -# if not found: -# libs.extend(['atlas']) -# opts = {'cpppath' : cpppath, 'libpath' : libpath, 'libs' : libs} -# -# env = context.env -# test_funcs = ['ATL_sgemm'] -# headers = ['atlas_enum.h'] -# -# # Check whether the header is available (CheckHeader-like checker) -# saved = save_and_set(env, opts) -# try: -# # XXX: add dep vars in code -# src = '\n'.join([r'#include <%s>\n' % h for h in headers]) -# st = context.TryCompile(src, '.c') -# finally: -# restore(env, saved) -# -# if not st: -# context.Result('Failed (could not check header(s))') -# return st -# -# # Check whether the library is available (CheckLib-like checker) -# saved = save_and_set(env, opts) -# try: -# for sym in test_funcs: -# # XXX: add dep vars in code -# st = check_symbol(context, headers, sym) -# if not st: -# break -# finally: -# if st == 0 or autoadd == 0: -# restore(env, saved) -# -# if not st: -# context.Result('Failed (could not check symbol %s)' % sym) -# return st -# -# context.Result(st) -# -# # Check version if requested -# if check_version: -# saved = save_and_set(env, opts) -# version_code = """ -#void ATL_buildinfo(void); -#int main(void) { -# ATL_buildinfo(); -# return 0; -#} -#""" -# try: -# vst, out = context.TryRun(version_code, '.c') -# finally: -# restore(env, saved) -# -# if not vst: -# version = r'?.?.? (could not get version)' -# else: -# m = re.search( -# r'ATLAS version (?P\d+[.]\d+[.]\d+)', -# out) -# if m: -# version = m.group('version') -# else: -# version = r'?.?.? (could not get version)' -# opts['version'] = version -# -# return st, opts - -def CheckATLAS(context, autoadd = 1): - """Check whether ATLAS is usable in C.""" - - libs = ['atlas', 'f77blas', 'cblas'] - libpath = [] - - return check_include_and_run(context, 'ATLAS', None, ['atlas_enum.h', 'cblas.h'], - cblas_src, libs, libpath, [], [], autoadd) - -def CheckAccelerate(context, autoadd = 1): - """Checker for Accelerate framework (on Mac OS X >= 10.3). Only test from - C.""" +def CheckAccelerate(context, autoadd = 1, check_version = 0): + """Checker for Accelerate framework (on Mac OS X >= 10.3). """ # According to # http://developer.apple.com/hardwaredrivers/ve/vector_libraries.html: # @@ -317,30 +184,37 @@ # is_intel = 0 # cflags.append('-faltivec') - # XXX: This double append is not good, any other way ? - linkflags = ['-framework', 'Accelerate'] + name = 'Framework: Accelerate' + # XXX: does it make sense to customize mac os X frameworks ? + section = 'accelerate' + defopts = ConfigOpts(frameworks = ['Accelerate']) + headers = ['Accelerate/Accelerate.h'] + funcs = ['cblas_sgemm'] + + return _check(context, name, section, defopts, headers, funcs, + check_version, None, autoadd) - return check_include_and_run(context, 'FRAMEWORK: Accelerate', None, - ['Accelerate/Accelerate.h'], cblas_src, [], - [], linkflags, [], autoadd) - def CheckVeclib(context, autoadd = 1): """Checker for Veclib framework (on Mac OS X < 10.3).""" - # XXX: This double append is not good, any other way ? - linkflags = ['-framework', 'vecLib'] + name = 'Framework: Accelerate' + # XXX: does it make sense to customize mac os X frameworks ? + section = 'accelerate' + defopts = ConfigOpts(frameworks = ['Accelerate']) + headers = ['vecLib/vecLib.h'] + funcs = ['cblas_sgemm'] + + return _check(context, name, section, defopts, headers, funcs, + check_version, None, autoadd) - return check_include_and_run(context, 'FRAMEWORK: veclib', None, - ['vecLib/vecLib.h'], cblas_src, [], - [], linkflags, [], autoadd) -def CheckSunperf(context, autoadd = 1): - """Checker for sunperf using a simple sunperf example""" - +def CheckSunperf(context, autoadd = 1, check_version = 0): + """Checker for sunperf.""" + name = 'Sunperf' + section = 'sunperf' # XXX: Other options needed ? - linkflags = ['-xlic_lib=sunperf'] - cflags = ['-dalign'] - - return check_include_and_run(context, 'sunperf', None, - ['sunperf.h'], sunperf_src, [], - [], linkflags, cflags, autoadd) - + defopts = ConfigOpts(cflags = ['-dalign'], linkflags = ['-xlic_lib=sunperf']) + headers = ['sunperf.h'] + funcs = ['cblas_sgemm'] + + return _check(context, name, section, defopts, headers, funcs, + check_version, None, autoadd) Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-31 09:48:00 UTC (rev 4363) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-31 10:47:18 UTC (rev 4364) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Wed Oct 31 06:00 PM 2007 J +# Last Change: Wed Oct 31 07:00 PM 2007 J # This module defines some helper functions, to be used by high level checkers @@ -10,7 +10,8 @@ 'libpath' : 'LIBPATH', 'libs' : 'LIBS', 'linkflags' : 'LINKFLAGS', - 'rpath' : 'RPATH'} + 'rpath' : 'RPATH', + 'frameworks' : 'FRAMEWORKS'} def save_and_set(env, opts): """keys given as config opts args.""" @@ -53,9 +54,11 @@ return context.TryLink('\n'.join(code), '.c') class ConfigOpts: - _keys = ['cpppath', 'cflags', 'libpath', 'libs', 'linkflags', 'rpath'] + # Any added key should be added as an argument to __init__ + _keys = ['cpppath', 'cflags', 'libpath', 'libs', 'linkflags', 'rpath', + 'frameworks'] def __init__(self, cpppath = None, cflags = None, libpath = None, libs = None, - linkflags = None, rpath = None): + linkflags = None, rpath = None, frameworks = None): data = {} if not cpppath: @@ -88,6 +91,11 @@ else: data['rpath'] = rpath + if not frameworks: + data['frameworks'] = [] + else: + data['frameworks'] = frameworks + self.data = data def __getitem__(self, key): @@ -101,9 +109,30 @@ return '\n'.join(msg) class ConfigRes(): - def __init__(self, cfgopts, version, origin): - pass + def __init__(self, cfgopts, origin, version = None): + self.data = cfgopts.data + self.origin = origin + self.version = version + def __getitem__(self, key): + return self.data[key] + + def __setitem__(self, key, item): + self.data[key] = item + + def is_customized(self): + return bool(self.origin) + + def __repr__(self): + if self.is_customized(): + msg = ['Customized items site.cfg:'] + else: + msg = ['Using default configuration:'] + + msg += ['\t%s : %s' % (k, i) for k, i in self.data.items() if len(i) > 0] + msg += ['Version is : %s' % self.version] + return '\n'.join(msg) + def check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath, linkflags, cflags, autoadd = 1): """This is a basic implementation for generic "test include and run" Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-31 09:48:00 UTC (rev 4363) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-10-31 10:47:18 UTC (rev 4364) @@ -1,7 +1,7 @@ # vim:syntax=python from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons.checkers.perflib import \ - CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf, CheckATLAS2 + CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf env = GetNumpyEnvironment(ARGUMENTS) @@ -14,21 +14,21 @@ config = env.NumpyConfigure(custom_tests = {'CheckATLAS' : CheckATLAS, - 'CheckATLAS2' : CheckATLAS2, 'CheckMKL' : CheckMKL, 'CheckAccelerate' : CheckAccelerate, 'CheckSunperf' : CheckSunperf}) if do_check: - #config.CheckATLAS(autoadd = 0) - st, opts = config.CheckATLAS2(autoadd = 0) + st, opts = config.CheckATLAS(autoadd = 0) if st: print opts st, opts = config.CheckMKL(autoadd = 0) if st: print opts - # config.CheckAccelerate(autoadd = 0) - # config.CheckSunperf(autoadd = 0) + st, opts = config.CheckAccelerate(autoadd = 0) + if st: + print opts + st, opts = config.CheckSunperf(autoadd = 0) if env.has_key('LIBS'): print env.Dump('LIBS') From numpy-svn at scipy.org Wed Oct 31 08:45:02 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 31 Oct 2007 07:45:02 -0500 (CDT) Subject: [Numpy-svn] r4365 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071031124502.E65FA39C042@new.scipy.org> Author: cdavid Date: 2007-10-31 07:44:57 -0500 (Wed, 31 Oct 2007) New Revision: 4365 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py Log: Refactor meta checkers. Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-10-31 10:47:18 UTC (rev 4364) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-10-31 12:44:57 UTC (rev 4365) @@ -12,7 +12,7 @@ from numpy.distutils.scons.fortran_scons import CheckF77Mangling, CheckF77Clib -from numpy.distutils.scons.configuration import opt_info, add_info +from numpy.distutils.scons.configuration import add_info from perflib import CheckMKL, CheckATLAS, CheckSunperf, CheckAccelerate from support import check_include_and_run @@ -25,6 +25,8 @@ siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) if found: + raise NotImplementedError("FIXME: siteconfig for cblas") + # XXX: adapt this to libperf refactor headers = ['cblas.h'] linkflags = [] cflags = [] @@ -35,86 +37,100 @@ return st else: if sys.platform == 'darwin': - st = CheckAccelerate(context, autoadd) + st, opts = CheckAccelerate(context, autoadd) if st: - add_info(env, 'cblas', opt_info('Accelerate')) + add_info(env, 'cblas', opts) return st - st = CheckVeclib(context, autoadd) - if st: - add_info(env, 'cblas', opt_info('vecLib')) - return st + #st, opts = CheckVeclib(context, autoadd) + #if st: + # add_info(env, 'cblas', opt_info('vecLib')) + # return st - add_info(env, 'cblas', opt_info('')) + add_info(env, 'cblas', 'Def numpy implementation used') return 0 else: # Check MKL, then ATLAS, then Sunperf st, opts = CheckMKL(context, autoadd) if st: - add_info(env, 'cblas', opt_info('mkl')) + add_info(env, 'cblas', opts) return st - st = CheckATLAS(context, autoadd) + st, opts = CheckATLAS(context, autoadd) if st: - add_info(env, 'cblas', opt_info('atlas')) + add_info(env, 'cblas', opts) return st - st = CheckSunperf(context, autoadd) + st, opts = CheckSunperf(context, autoadd) if st: - add_info(env, 'cblas', opt_info('sunperf')) + add_info(env, 'cblas', opts) return st - add_info(env, 'cblas', opt_info('')) + add_info(env, 'cblas', 'Def numpy implementation used') return 0 def CheckLAPACK(context, autoadd = 1): - # XXX: this whole thing is ugly. Think more about how to combine checkers - # in 'meta checker' like this. - if sys.platform == 'nt': - import warnings - warning.warn('FIXME: LAPACK checks not implemented yet on win32') - return 0 + # If section lapack is in site.cfg, use those options. Otherwise, use default + section = "lapack" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if found: + raise NotImplementedError("FIXME: siteconfig for lapack") + # XXX: adapt this to libperf refactor + headers = ['cblas.h'] + linkflags = [] + cflags = [] + st = check_include_and_run(context, 'CBLAS', [], headers, cblas_src, + libs, libpath, linkflags, cflags, autoadd) + if st: + add_info(env, 'cblas', opt_info('cblas', site = 1)) + return st else: - env = context.env + if sys.platform == 'nt': + import warnings + warning.warn('FIXME: LAPACK checks not implemented yet on win32') + return 0 + else: + env = context.env - # Get fortran stuff - if not env.has_key('F77_NAME_MANGLER'): - if not CheckF77Mangling(context): - return 0 - if not env.has_key('F77_LDFLAGS'): - if not CheckF77Clib(context): - return 0 + # Get fortran stuff + if not env.has_key('F77_NAME_MANGLER'): + if not CheckF77Mangling(context): + return 0 + if not env.has_key('F77_LDFLAGS'): + if not CheckF77Clib(context): + return 0 - # Get the mangled name of our test function - sgesv_string = env['F77_NAME_MANGLER']('sgesv') - test_src = lapack_sgesv % sgesv_string + # Get the mangled name of our test function + sgesv_string = env['F77_NAME_MANGLER']('sgesv') + test_src = lapack_sgesv % sgesv_string - # Check MKL - st = CheckMKL(context, autoadd = 1) - if st: - fdict = env.ParseFlags(context.env['F77_LDFLAGS']) - fdict['LIBS'].append('lapack') - if env.has_key('LIBS'): - fdict['LIBS'].extend(context.env['LIBS']) - if env.has_key('LIBPATH'): - fdict['LIBPATH'].extend(context.env['LIBPATH']) - st = check_include_and_run(context, 'LAPACK (MKL)', [], [], - test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) - add_info(env, 'lapack', opt_info('mkl')) - return st + # Check MKL + st, opts = CheckMKL(context, autoadd = 1) + if st: + fdict = env.ParseFlags(context.env['F77_LDFLAGS']) + fdict['LIBS'].append('lapack') + if env.has_key('LIBS'): + fdict['LIBS'].extend(context.env['LIBS']) + if env.has_key('LIBPATH'): + fdict['LIBPATH'].extend(context.env['LIBPATH']) + st = check_include_and_run(context, 'LAPACK (MKL)', [], [], + test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) + add_info(env, 'lapack', opts) + return st - # Check ATLAS - st = CheckATLAS(context, autoadd = 1) - if st: - fdict = env.ParseFlags(context.env['F77_LDFLAGS']) - fdict['LIBS'].append('lapack') - if env.has_key('LIBS'): - fdict['LIBS'].extend(context.env['LIBS']) - if env.has_key('LIBPATH'): - fdict['LIBPATH'].extend(context.env['LIBPATH']) - st = check_include_and_run(context, 'LAPACK (ATLAS)', [], [], - test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) - add_info(env, 'lapack', opt_info('atlas')) - # XXX: Check complete LAPACK or not - return st + # Check ATLAS + st, opts = CheckATLAS(context, autoadd = 1) + if st: + fdict = env.ParseFlags(context.env['F77_LDFLAGS']) + fdict['LIBS'].append('lapack') + if env.has_key('LIBS'): + fdict['LIBS'].extend(context.env['LIBS']) + if env.has_key('LIBPATH'): + fdict['LIBPATH'].extend(context.env['LIBPATH']) + st = check_include_and_run(context, 'LAPACK (ATLAS)', [], [], + test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) + add_info(env, 'lapack', opts) + # XXX: Check complete LAPACK or not + return st return 0 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-31 10:47:18 UTC (rev 4364) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-31 12:44:57 UTC (rev 4365) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Wed Oct 31 07:00 PM 2007 J +# Last Change: Wed Oct 31 08:00 PM 2007 J # This module defines checkers for performances libs providing standard API, # such as MKL (Intel), ATLAS, Sunperf (solaris and linux), Accelerate (Mac OS @@ -35,6 +35,8 @@ else: opts = defopts + opts['rpath'] = opts['libpath'] + env = context.env # Check whether the header is available (CheckHeader-like checker) @@ -86,7 +88,7 @@ return st, cfgres -def _check_mkl_version(env, opts): +def _mkl_version_checker(env, opts): version_code = r""" #include #include Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-31 10:47:18 UTC (rev 4364) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-31 12:44:57 UTC (rev 4365) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Wed Oct 31 07:00 PM 2007 J +# Last Change: Wed Oct 31 08:00 PM 2007 J # This module defines some helper functions, to be used by high level checkers @@ -133,6 +133,36 @@ msg += ['Version is : %s' % self.version] return '\n'.join(msg) + def __str__(self): + return self.__repr__() + +def _check_headers(context, cpppath, cflags, headers, autoadd): + """Try to compile code including the given headers.""" + env = context.env + + #---------------------------- + # Check headers are available + #---------------------------- + oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or [] + oldCFLAGS = (env.has_key('CFLAGS') and deepcopy(env['CFLAGS'])) or [] + env.AppendUnique(CPPPATH = cpppath) + env.AppendUnique(CFLAGS = cflags) + # XXX: handle context + hcode = ['#include <%s>' % h for h in headers] + + # HACK: we add cpppath in the command of the source, to add dependency of + # the check on the cpppath. + hcode.extend(['#if 0', '%s' % cpppath, '#endif\n']) + src = '\n'.join(hcode) + + ret = context.TryCompile(src, '.c') + if ret == 0 or autoadd == 0: + env.Replace(CPPPATH = oldCPPPATH) + env.Replace(CFLAGS = oldCFLAGS) + return 0 + + return ret + def check_include_and_run(context, name, cpppath, headers, run_src, libs, libpath, linkflags, cflags, autoadd = 1): """This is a basic implementation for generic "test include and run" @@ -156,7 +186,7 @@ context.Message('Checking for %s ... ' % name) env = context.env - ret = _check_headers(context, cpppath, cflags, headers) + ret = _check_headers(context, cpppath, cflags, headers, autoadd) if not ret: context.Result('Failed: %s include not found' % name) From numpy-svn at scipy.org Wed Oct 31 10:57:58 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 31 Oct 2007 09:57:58 -0500 (CDT) Subject: [Numpy-svn] r4366 - in branches/numpy.scons/numpy: core distutils distutils/command distutils/scons Message-ID: <20071031145758.4131139C0A8@new.scipy.org> 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_.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 From numpy-svn at scipy.org Wed Oct 31 19:21:46 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 31 Oct 2007 18:21:46 -0500 (CDT) Subject: [Numpy-svn] r4367 - in branches/numpy.scons/numpy: . distutils distutils/scons Message-ID: <20071031232146.5262439C0C3@new.scipy.org> Author: cdavid Date: 2007-10-31 18:21:39 -0500 (Wed, 31 Oct 2007) New Revision: 4367 Modified: branches/numpy.scons/numpy/distutils/misc_util.py branches/numpy.scons/numpy/distutils/scons/configuration.py branches/numpy.scons/numpy/setupscons.py Log: configres correctly generated and read (show_config still does not work) Modified: branches/numpy.scons/numpy/distutils/misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-31 14:57:41 UTC (rev 4366) +++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-31 23:21:39 UTC (rev 4367) @@ -1446,6 +1446,12 @@ """ self.py_modules.append((self.name,name,generate_config_py)) + def scons_make_config_py(self, name = '__config__'): + """Generate package __config__.py file containing system_info + information used during building the package. + """ + self.py_modules.append((self.name, name, scons_generate_config_py)) + def get_info(self,*names): """Get resources information. """ @@ -1497,6 +1503,59 @@ The path is relative to the top setup.py""" return '__configres.py' +def scons_generate_config_py(target): + """generate config.py file containing system_info information + used during building the package. + + usage: + config['py_modules'].append((packagename, '__config__',generate_config_py)) + """ + from distutils.dir_util import mkpath + import imp + d = {} + mkpath(os.path.dirname(target)) + f = open(target, 'w') + f.write('# this file is generated by %s\n' % (os.path.abspath(sys.argv[0]))) + f.write('# it contains system_info results at the time of building this package.\n') + f.write('__all__ = ["get_info","show"]\n\n') + confdir = get_scons_configres_dir() + confilename = get_scons_configres_filename() + for root, dirs, files in os.walk(confdir): + if files: + file = os.path.join(root, confilename) + assert root.startswith(confdir) + pkg_name = '.'.join(root[len(confdir)+1:].split(os.sep)) + fid = open(file, 'r') + try: + config_mod = imp.load_module(pkg_name, fid, confilename, + ('.py', 'U', 1)) + d[pkg_name] = config_mod.config + finally: + fid.close() + for k, i in d.items(): + f.write('%s=%r\n' % (k, i)) + f.write(r''' +def get_info(name): + g = globals() + return g.get(name, g.get(name + "_info", {})) + +def show(): + for name,info_dict in globals().items(): + if name[0] == "_" or type(info_dict) is not type({}): continue + print name + ":" + if not info_dict: + print " not available" + for k,v in info_dict.items(): + v = str(v) + if k == "sources" and len(v) > 200: + v = v[:60] + " ...\n... " + v[-60:] + print " %s = %s" % (k,v) + print + ''') + + f.close() + return target + ######################### def default_config_dict(name = None, parent_name = None, local_path=None): @@ -1546,18 +1605,18 @@ return os.path.normpath(njoin(drive + prefix, subpath)) def generate_config_py(target): - """Generate config.py file containing system_info information + """generate config.py file containing system_info information used during building the package. - Usage: + usage: config['py_modules'].append((packagename, '__config__',generate_config_py)) """ from numpy.distutils.system_info import system_info from distutils.dir_util import mkpath mkpath(os.path.dirname(target)) f = open(target, 'w') - f.write('# This file is generated by %s\n' % (os.path.abspath(sys.argv[0]))) - f.write('# It contains system_info results at the time of building this package.\n') + f.write('# this file is generated by %s\n' % (os.path.abspath(sys.argv[0]))) + f.write('# it contains system_info results at the time of building this package.\n') f.write('__all__ = ["get_info","show"]\n\n') for k, i in system_info.saved_results.items(): f.write('%s=%r\n' % (k, i)) @@ -1571,7 +1630,7 @@ if name[0] == "_" or type(info_dict) is not type({}): continue print name + ":" if not info_dict: - print " NOT AVAILABLE" + print " not available" for k,v in info_dict.items(): v = str(v) if k == "sources" and len(v) > 200: Modified: branches/numpy.scons/numpy/distutils/scons/configuration.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-10-31 14:57:41 UTC (rev 4366) +++ branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-10-31 23:21:39 UTC (rev 4367) @@ -4,16 +4,14 @@ def add_info(env, name, opt): cfg = env['NUMPY_PKG_CONFIG'] - cfg[name] = opt + cfg[name] = str(opt) 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() + os.makedirs(dir) f = open(env['NUMPY_PKG_CONFIG_FILE'], 'w') f.writelines("config = %s" % str(env['NUMPY_PKG_CONFIG'])) f.close() - - Modified: branches/numpy.scons/numpy/setupscons.py =================================================================== --- branches/numpy.scons/numpy/setupscons.py 2007-10-31 14:57:41 UTC (rev 4366) +++ branches/numpy.scons/numpy/setupscons.py 2007-10-31 23:21:39 UTC (rev 4367) @@ -21,7 +21,7 @@ # scons instead). # !! DO NOT REMOVE THIS !! config.add_extension('', sources = []) - config.make_config_py() # installs __config__.py + config.scons_make_config_py() # installs __config__.py return config if __name__ == '__main__':