|
Would it be appropriate to determine the version at configure time?
If so we could create a file mod_python/__init__.py.in which would contain: version="@MP_VERSION@" and configure would grep src/include/mpversion.h for MPV_STRING and generate __init__.py from __init__.py.in. If this seems reasonable I can put something together. Seems reasonable ; it would be nice to retain the ability to build without configure by running setup.py directly (at least on Windows)
Note that setup.py.in already contains a getmp_version() method that reads the version out of src/include/mpversion.h On further consideration, lets bypass the whole config issue and add a method to serverobject.c:
static PyObject * server_get_mp_version(serverobject *self) { PyObject *version; version = PyString_FromString(MPV_STRING); if (!version) return NULL; Py_INCREF(version); return version; } Usage: req.server.get_mp_version() I think I messed up the referernce counting in the code for server_get_mp_version. I'm new at this and the Python documentation is just plain confusing. I *think* the correct code is:
static PyObject * server_get_mp_version(serverobject *self) { return PyString_FromString(MPV_STRING); } If someone can confirm this I'll attach a corrected patch. Closing issue because "version" attribute was added to "mod_python/__init__.py". I note though that no "req.server.get_mp_string()" function seems to have added in the end as described.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
We should find a way to automate the generation of this value from src/include/mpversion.h at build time.