Win32 Binaries?

Mauro Cicognini mcicogni at siosistemi.it
Thu Aug 14 15:55:28 CEST 2003


Michael Ströder wrote:

> Mauro,
>
> thanks for your response. I'm very much interested in getting these 
> issues solved.
>
> Mauro Cicognini wrote:
>
>> I attach the old setup.cfg from PythonLDAP 2.0.0pre04 that used to 
>> work perfectly. I *had* hacked setup.py a little bit then, to make it 
>> simple to define symbols. BTW, the particular symbol I need is just 
>> "WIN32".
>
>
> Can you please post your setup.py hack?

Well, it really is functionally identical to the modifications in your 
diff that do the same thing :-)

What I added was:

if cfg.has_section('_ldap'):
    if cfg.has_option('_ldap', 'class'):
        LDAP_CLASS = eval(cfg.get('_ldap', 'class'))
    else:
        LDAP_CLASS = OpenLDAP2
    for name in LDAP_CLASS.__dict__.keys():
        if cfg.has_option('_ldap', name):
            setattr(LDAP_CLASS, name, string.split(cfg.get('_ldap', name)))
+   if cfg.has_option('_ldap', 'defines'):
+      for defname in string.split(cfg.get('_ldap', 'defines')):
+          LDAP_CLASS.defines.append((defname, None))

but I like your solution better.

>    1. There's no way (AFAIK) to simply "define" a preprocessor symbol
>
>>       within setup.cfg. The distutils scripts expect to have a list of
>>       one- or two-element tuples, but the parser has no way to pull
>>       those from the .cfg. Besides, the one-element tuple means to
>>       "undefine" the symbol, whereas I'd like to just "define" it
>>       without giving it a value, which is unnecessary. I managed to
>>       insert it using a crude hack within setup.py (just as I had done
>>       with the earlier version), but I do not like this solution.
>
>
> Wouldn't
>
> extra_compile_args = -DWIN32
>
> help?

As I said, I am not familiar with distutils at all. Yes, it would help, 
I only wasn't really thinking <:-)

>
> I can also modify setup.py to properly build the two-tuple list of 
> defines from a line (see attached diff)
>
> defines = WIN32

As I said, I would like this. I second your implementation.

>
>>    2. The "HAVE_XXX" symbol definition in setup.py is Linux-centric:
>>       since the libraries under Windows have slightly different names
>>       (for instance, "olber32" instead of just "lber"), those symbols
>>       would just not get defined. This however was simple enough to fix.
>
>
> Mainly the HAVE_LIBLDAP_R is of interest. How's the libldap_r called 
> on Windows? Additionally you can try to manually set -DHAVE_LIBLDAP_R 
> etc. in setup.cfg.

The current OpenLDAP version calls it oldap_r.lib.

>
>>    3. It appears that any library path under "library_dirs" for some
>>       reason gets copied over to "runtime_library_dirs", which makes no
>>       sense to me.
>
>
> No clue why David did it. I removed it and it stills builds under 
> Linux. I'd appreciate if others test it on different platforms.

I removed it too, and didn't hurt. I'm wondering too.

>
>>    4. The linker get called without the default libraries, and in such a
>>       way that a whole lot of symbols are found twice, so it just barfs
>>       and never links.
>
>
> Any clue how to solve that?

None whatsoever :-(

I'll work on this more next week, I'll let you know.

>
> My goal is to have a setup.py which is suitable to build python-ldap 
> on any platform with a platform-specific setup.cfg.

Me too. I loved the friendly binary installer I got with 2.0.0pre04 :-)

> So let's sort out the issues together. I don't have a Win32 system to 
> test a build therefore your input is highly appreciated. I've attached 
> a unified diff for setup.py. Please test.

I will, more on this next week (tomorrow is a national holiday here ;-).

Thanks a lot and keep up the great work.

BR,
Mauro







More information about the python-ldap mailing list