diff --git a/CHANGES b/CHANGES index f4be1fc..32550b6 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ Modules/ * moved code from version.c to ldapmodule.c * removed obsolete back-ward compability constants from common.h * build checks whether LDAP_API_VERSION is OpenLDAP 2.4.x +* _ldap.__author__ and _ldap.__license__ also set from ldap.pkginfo Lib/ * new global constant ldap.LIBLDAP_API_INFO diff --git a/Modules/constants.c b/Modules/constants.c index 2c0ec1d..06c249a 100644 --- a/Modules/constants.c +++ b/Modules/constants.c @@ -280,12 +280,6 @@ LDAPinit_constants( PyObject* d ) add_int(d,URL_ERR_BADSCOPE); add_int(d,URL_ERR_MEM); - /* author */ - - author = PyString_FromString("python-ldap Project"); - PyDict_SetItemString(d, "__author__", author); - Py_DECREF(author); - /* add_int(d,LIBLDAP_R); */ #ifdef HAVE_LIBLDAP_R obj = PyInt_FromLong(1); diff --git a/Modules/ldapmodule.c b/Modules/ldapmodule.c index c11bf72..dc954d4 100644 --- a/Modules/ldapmodule.c +++ b/Modules/ldapmodule.c @@ -12,15 +12,28 @@ #define STR(x) _STR(x) static char version_str[] = STR(LDAPMODULE_VERSION); +static char author_str[] = STR(LDAPMODULE_AUTHOR); +static char license_str[] = STR(LDAPMODULE_LICENSE); void -LDAPinit_version( PyObject* d ) +init_pkginfo( PyObject* d ) { - PyObject *version; + PyObject *version; + PyObject *author; + PyObject *license; + + version = PyString_FromString(version_str); + PyDict_SetItemString( d, "__version__", version ); + Py_DECREF(version); + + author = PyString_FromString(author_str); + PyDict_SetItemString(d, "__author__", author); + Py_DECREF(author); + + license = PyString_FromString(license_str); + PyDict_SetItemString(d, "__license__", license); + Py_DECREF(license); - version = PyString_FromString(version_str); - PyDict_SetItemString( d, "__version__", version ); - Py_DECREF(version); } DL_EXPORT(void) init_ldap(void); @@ -48,7 +61,7 @@ init_ldap() /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - LDAPinit_version(d); + init_pkginfo(d); LDAPinit_constants(d); LDAPinit_errors(d); LDAPinit_functions(d); diff --git a/setup.py b/setup.py index 7ce8d9d..841ee55 100644 --- a/setup.py +++ b/setup.py @@ -124,7 +124,11 @@ class OpenLDAP2: ('ldap_r' in LDAP_CLASS.libs or 'oldap_r' in LDAP_CLASS.libs)*[('HAVE_LIBLDAP_R',None)] + \ ('sasl' in LDAP_CLASS.libs or 'sasl2' in LDAP_CLASS.libs or 'libsasl' in LDAP_CLASS.libs)*[('HAVE_SASL',None)] + \ ('ssl' in LDAP_CLASS.libs and 'crypto' in LDAP_CLASS.libs)*[('HAVE_TLS',None)] + \ - [('LDAPMODULE_VERSION', pkginfo.__version__)] + [ + ('LDAPMODULE_VERSION', pkginfo.__version__), + ('LDAPMODULE_AUTHOR', pkginfo.__author__), + ('LDAPMODULE_LICENSE', pkginfo.__license__), + ] ), ], #-- Python "stand alone" modules