_readdir_pyx extension cannot be compiled with MSVC

Alexander Belchenko bialix at ukr.net
Thu Oct 2 16:29:32 BST 2008


John Arbash Meinel пишет:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Alexander Belchenko wrote:
>> building 'bzrlib._readdir_pyx' extension
>> c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c
>> /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\Python\2.5.1\include
>> -IC:\Python\2.5.1\PC /Tcbzrlib/_readdir_pyx.c
>> /Fobuild\temp.win32-2.5\Release\bzrlib/_readdir_pyx.obj
>> _readdir_pyx.c
>> bzrlib\_readdir_pyx.c(32) : fatal error C1083: Cannot open include file:
>> 'dirent.h': No such file or directory
>> Building of "bzrlib._readdir_pyx" extension failed, will use the Python
>> version instead
>>
> 
> That's actually file. "_readdir_pyx" is only meant to be used on
> platforms that use "readdir()" which is cygwin and POSIX, not win32.
> 
> What I don't understand is why it is *trying* to build it. At least
> according to my setup.py:
> 
> if sys.platform == 'win32':
>     add_pyrex_extension('bzrlib._dirstate_helpers_c',
>                          libraries=['Ws2_32']
>                        )
> ....
>     add_pyrex_extension('bzrlib._walkdirs_win32',
>                         define_macros=[('WIN32', None)])
> else:
>     add_pyrex_extension('bzrlib._dirstate_helpers_c')
>     add_pyrex_extension('bzrlib._readdir_pyx')
> 
> 
> Which says that if "sys.platform == 'win32'" build the "_walkdirs_win32"
> extension, otherwise build the "_readdir_pyx" extension.
> 
> What is your sys.platform?

Here is extract from setup.py in bzr-1.7 branch:

add_pyrex_extension('bzrlib._btree_serializer_c')
add_pyrex_extension('bzrlib._dirstate_helpers_c')
add_pyrex_extension('bzrlib._knit_load_data_c')
add_pyrex_extension('bzrlib._readdir_pyx')
if sys.platform == 'win32':
     # pyrex uses the macro WIN32 to detect the platform, even though it should
     # be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
     # right value.
     add_pyrex_extension('bzrlib._walkdirs_win32',
                         define_macros=[('WIN32', None)])
ext_modules.append(Extension('bzrlib._patiencediff_c', ['bzrlib/_patiencediff_c.c']))




More information about the bazaar mailing list