
On 22 Jul, 2010, at 15:40, Barry Warsaw wrote:
Abstract ========
PEP 3147 [1]_ described an extension to Python's import machinery that improved the sharing of Python source code, by allowing more than one byte compilation file (.pyc) to be co-located with each source file.
This PEP defines an adjunct feature which allows the co-location of extension module files (.so) in a similar manner. This optional, build-time feature will enable downstream distributions of Python to more easily provide more than one Python major version at a time.
I guess this is not an explicit goal of this PEP, but the structure is very close to supporting multiple system architectures at the same time. I regularly develop code that needs to run on Windows, Linux and OSX and it is very convenient to do so in a shared directory tree (locally on one machine and accessed using remote mounts on the other ones). This works fine for pure python code, but I currently have to resort to tricks for extension modules.
Proposal ========
The configure/compilation options chosen at Python interpreter build-time will be encoded in the shared library file name for extension modules. This "tag" will appear between the module base name and the operation file system extension for shared libraries.
The following information *MUST* be included in the shared library file name:
* The Python implementation (e.g. cpython, pypy, jython, etc.) * The interpreter's major and minor version numbers
These two fields are separated by a hyphen and no dots are to appear between the major and minor version numbers. E.g. ``cpython-32``.
Python implementations *MAY* include additional flags in the file name tag as appropriate. For example, on POSIX systems these flags will also contribute to the file name:
* ``--with-pydebug`` (flag: ``d``) * ``--with-pymalloc`` (flag: ``m``) * ``--with-wide-unicode`` (flag: ``u``)
By default in Python 3.2, ``configure`` enables ``--with-pymalloc`` so shared library file names would appear as ``foo.cpython-32m.so``. When the other two flags are also enabled, the file names would be ``foo.cpython-32dmu.so``.
A way to generically solve my problem is to add the platform name as well, such as "foo.cpython-32m-darwin.so" or "foo.cpython-32mu-linux2.so". Ronald