From: Mauro C. <mci...@si...> - 2003-08-14 14:00:55
|
Michael Str=F6der wrote: > Mauro, > > thanks for your response. I'm very much interested in getting these=20 > issues solved. > > Mauro Cicognini wrote: > >> I attach the old setup.cfg from PythonLDAP 2.0.0pre04 that used to=20 >> 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=20 >> "WIN32". > > > Can you please post your setup.py hack? Well, it really is functionally identical to the modifications in your=20 diff that do the same thing :-) What I added was: if cfg.has_section('_ldap'): if cfg.has_option('_ldap', 'class'): LDAP_CLASS =3D eval(cfg.get('_ldap', 'class')) else: LDAP_CLASS =3D 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 =3D -DWIN32 > > help? As I said, I am not familiar with distutils at all. Yes, it would help,=20 I only wasn't really thinking <:-) > > I can also modify setup.py to properly build the two-tuple list of=20 > defines from a line (see attached diff) > > defines =3D 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 fi= x. > > > Mainly the HAVE_LIBLDAP_R is of interest. How's the libldap_r called=20 > on Windows? Additionally you can try to manually set -DHAVE_LIBLDAP_R=20 > 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 n= o >> sense to me. > > > No clue why David did it. I removed it and it stills builds under=20 > 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 barf= s >> 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=20 > 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=20 > 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 |