[Numpy-svn] r6077 - in branches/visualstudio_manifest: . numpy/random numpy/random/mtrand
numpy-svn at scipy.org
numpy-svn at scipy.org
Mon Nov 17 08:58:31 EST 2008
Author: cdavid
Date: 2008-11-17 07:58:23 -0600 (Mon, 17 Nov 2008)
New Revision: 6077
Modified:
branches/visualstudio_manifest/
branches/visualstudio_manifest/numpy/random/mtrand/randomkit.c
branches/visualstudio_manifest/numpy/random/setup.py
Log:
Merged revisions 6071-6076 via svnmerge from
http://svn.scipy.org/svn/numpy/trunk
........
r6072 | cdavid | 2008-11-17 22:52:47 +0900 (Mon, 17 Nov 2008) | 1 line
Fix the inaccurate comment regarding _ftime issues with mingw.
........
r6073 | cdavid | 2008-11-17 22:53:05 +0900 (Mon, 17 Nov 2008) | 1 line
Do not generate a config.h for randomkit: it does not work as it is, and adding per-subpackage include path is a PITA with distutils.
........
r6074 | cdavid | 2008-11-17 22:53:25 +0900 (Mon, 17 Nov 2008) | 1 line
Conditionally setup mingw workaround on __GNUC__ since we can't detect if we are built with mingw in distutils setup.py.
........
r6075 | cdavid | 2008-11-17 22:53:42 +0900 (Mon, 17 Nov 2008) | 1 line
Forgot to update needs_mingw_ftime_workaround function.
........
r6076 | cdavid | 2008-11-17 22:53:58 +0900 (Mon, 17 Nov 2008) | 1 line
Include time.h and sys/timeb.h just after defining our custom __MSVCRT_VERSION__ to avoid possible duplicate.
........
Property changes on: branches/visualstudio_manifest
___________________________________________________________________
Name: svnmerge-integrated
- /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-6070
+ /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-6076
Modified: branches/visualstudio_manifest/numpy/random/mtrand/randomkit.c
===================================================================
--- branches/visualstudio_manifest/numpy/random/mtrand/randomkit.c 2008-11-17 13:53:58 UTC (rev 6076)
+++ branches/visualstudio_manifest/numpy/random/mtrand/randomkit.c 2008-11-17 13:58:23 UTC (rev 6077)
@@ -64,8 +64,6 @@
/* static char const rcsid[] =
"@(#) $Jeannot: randomkit.c,v 1.28 2005/07/21 22:14:09 js Exp $"; */
-#include "config.h"
-
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -75,20 +73,22 @@
#ifdef _WIN32
/* Windows */
-#ifdef NPY_NEEDS_MINGW_TIME_WORKAROUND
+/* XXX: we have to use this ugly defined(__GNUC__) because it is not easy to
+ * detect the compiler used in distutils itself */
+#if (defined(__GNUC__) && defined(NPY_NEEDS_MINGW_TIME_WORKAROUND))
/* FIXME: ideally, we should set this to the real version of MSVCRT. We need
* something higher than 0x601 to enable _ftime64 and co */
#define __MSVCRT_VERSION__ 0x0700
+#include <time.h>
+#include <sys/timeb.h>
/* mingw msvcr lib import wrongly export _ftime, which does not exist in the
- * actual msvc runtime for version >= 8; we make it an alist to _ftime64, which
- * is available in those versions of the runtime and should be ABI compatible
+ * actual msvc runtime for version >= 8; we make it an alias to _ftime64, which
+ * is available in those versions of the runtime
*/
#define _FTIME(x) _ftime64((x))
#else
#define _FTIME(x) _ftime((x))
#endif
-#include <time.h>
-#include <sys/timeb.h>
#ifndef RK_NO_WINCRYPT
/* Windows crypto */
#ifndef _WIN32_WINNT
Modified: branches/visualstudio_manifest/numpy/random/setup.py
===================================================================
--- branches/visualstudio_manifest/numpy/random/setup.py 2008-11-17 13:53:58 UTC (rev 6076)
+++ branches/visualstudio_manifest/numpy/random/setup.py 2008-11-17 13:58:23 UTC (rev 6077)
@@ -4,13 +4,14 @@
from distutils.dep_util import newer
from distutils.msvccompiler import get_build_version as get_msvc_build_version
-def needs_mingw_ftime_workaround(config):
+def needs_mingw_ftime_workaround():
# We need the mingw workaround for _ftime if the msvc runtime version is
- # 7.1 or above and we build with mingw
- if config.compiler.compiler_type == 'mingw32':
- msver = get_msvc_build_version()
- if msver and msver > 7:
- return True
+ # 7.1 or above and we build with mingw ...
+ # ... but we can't easily detect compiler version outside distutils command
+ # context, so we will need to detect in randomkit whether we build with gcc
+ msver = get_msvc_build_version()
+ if msver and msver > 7:
+ return True
return False
@@ -27,36 +28,22 @@
ext.libraries.extend(libs)
return None
- def generate_config_h(ext, build_dir):
- defs = []
- target = join(build_dir, "mtrand", 'config.h')
- dir = dirname(target)
- if not os.path.exists(dir):
- os.makedirs(dir)
+ defs = []
+ if needs_mingw_ftime_workaround():
+ defs.append(("NPY_NEEDS_MINGW_TIME_WORKAROUND", None))
- config_cmd = config.get_config_cmd()
- if needs_mingw_ftime_workaround(config_cmd):
- defs.append("NPY_NEEDS_MINGW_TIME_WORKAROUND")
-
- if newer(__file__, target):
- target_f = open(target, 'a')
- for d in defs:
- if isinstance(d, str):
- target_f.write('#define %s\n' % (d))
- target_f.close()
-
libs = []
# Configure mtrand
config.add_extension('mtrand',
sources=[join('mtrand', x) for x in
['mtrand.c', 'randomkit.c', 'initarray.c',
- 'distributions.c']]+[generate_libraries]
- + [generate_config_h],
+ 'distributions.c']]+[generate_libraries],
libraries=libs,
depends = [join('mtrand','*.h'),
join('mtrand','*.pyx'),
join('mtrand','*.pxi'),
- ]
+ ],
+ define_macros = defs,
)
config.add_data_files(('.', join('mtrand', 'randomkit.h')))
More information about the Numpy-svn
mailing list