[MERGE] Fast _walkdirs for win32
John Arbash Meinel
john at arbash-meinel.com
Thu Jul 17 19:34:11 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Alexander Belchenko wrote:
| John Arbash Meinel пишет:
|> Alexander Belchenko wrote:
|> | Adrian Wilkins ?8H5B:
|> |> :
|> |> [...]
|> |>>> 2) But anyway it failed because linker cannot find Win32 API
|> functions:
|> |>>>
|> |>
|> |> That's odd, it builds fine here.
|> |
|> | Then something wrong with my computer.
|> |
|> |> Which environment are you using?
|> |
|> | IIUC it's called Microsoft Visual Studio .NET 2003.
|> |
|> |> I'm on MS Visual C++ Toolkit 2003, and I'm using it's headers and
|> |> libraries.
|> |> This corresponds to the environment used to build Python 2.5.
|> |>
|> |> AFAIK jam is using MinGW.
|>
|> Looking at the generated code, I'm pretty sure it is your Pyrex version.
|
| I disagree with you. I've upgraded Pyrex to latest version 0.9.8.4 but
| still has
| the same problem.
|
|> Your version spits out:
|>
|> #ifndef WIN32
|> #define __stdcall
|> #endif
|>
|> Which universally overwrites it.
|>
|> Here I'm seeing
|>
|> #ifndef WIN32
|> # ifndef __stdcall
|> # define __stdcall
|> # endif
|> #endif
|>
|> Which won't override them if they are already set.
|
| But my problem is that my compiler does not set neither WIN32 symbol nor
| __stdcall.
| According to MSDN __stdcall is keyword, not define.
|
| I just did very simple testing main.c:
|
| #ifndef __stdcall
| #error __stdcall is not defined
| #endif
|
| And when I'm trying to compile it (via simple SConstruct) I have error:
|
| C:\Temp\5>scons
| scons: Entering directory `C:\Temp\5'
| scons: Reading SConscript files ...
| scons: done reading SConscript files.
| scons: Building targets ...
| cl /nologo /c main.c /Fomain.obj
| main.c
| main.c(2) : fatal error C1189: #error : __stdcall is not defined
| scons: *** [main.obj] Error 2
| scons: building terminated because of errors.
|
|
| But I found the way to satisfy pyrex and python's distutils. This change
| in setup.py
| does resolve my problem:
|
|
| === modified file 'setup.py'
| --- setup.py 17.07.2008 15:55:11
| +++ setup.py 17.07.2008 20:58:25
| @@ -216,18 +216,19 @@
| pyrex_name = path + '.pyx'
| c_name = path + '.c'
| if have_pyrex:
| - ext_modules.append(Extension(module_name, [pyrex_name]))
| + ext_modules.append(Extension(module_name, [pyrex_name],
**kwargs))
| else:
| if not os.path.isfile(c_name):
| unavailable_files.append(c_name)
| else:
| - ext_modules.append(Extension(module_name, [c_name]))
| + ext_modules.append(Extension(module_name, [c_name],
**kwargs))
|
|
| add_pyrex_extension('bzrlib._dirstate_helpers_c')
| add_pyrex_extension('bzrlib._knit_load_data_c')
| if sys.platform == 'win32':
| - add_pyrex_extension('bzrlib._walkdirs_win32')
| + add_pyrex_extension('bzrlib._walkdirs_win32',
| + define_macros=[('WIN32',None)])
| ext_modules.append(Extension('bzrlib._patiencediff_c',
| ['bzrlib/_patiencediff_c.c']))
|
|
|
|
| So even if my compiler is ugly or broken, there is the bug in Pyrex too.
| It should use MS_WINDOWS constant instead of WIN32, according to
| C:\Python25\include\pyconfig.h
Well, actually, I think VS C++ sets the member "_WIN32" not "WIN32".
I'm happy to update our setup.py to pass the keyword arguments to the
next level.
I'm *not* sure about using MS_WINDOWS, mostly because in pyconfig.h I
only see it set in _WIN32_WCE which is the embedded edition of windows,
IIRC.
Could we do define_macro([('WIN32', '_WIN32')]) ?
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkh/kKMACgkQJdeBCYSNAAOltgCfXlZJrgcTX2/rDlUnG/RXkJlh
9bMAoLNkBvEDOA4QLiI9IN/2seHsavAZ
=pS7r
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list