[Distutils] Distutils improvements regarding header installation and building C extension modules
Daniel Holth
dholth at gmail.com
Wed May 25 13:49:20 EDT 2016
A fix for data_files would be very welcome. It has behaved inconsistently
in setuptools and distutils and virtualenv or not-virtualenv.
If a wheel archive has a subfolder package-1.0.data/headers/... then that
tree will be copied into the headers directory as shown below:
In [2]: import wheel; wheel.install.get_install_paths('package')
Out[2]:
{'data': '/home/vagrant/opt/pyenv',
'headers': '/home/vagrant/opt/pyenv/include/site/python2.7/package',
'platlib': '/home/vagrant/opt/pyenv/lib64/python2.7/site-packages',
'purelib': '/home/vagrant/opt/pyenv/lib/python2.7/site-packages',
'scripts': '/home/vagrant/opt/pyenv/bin'}
pip's mapping of paths could differ.
It would be wonderful if you are able to figure out how to actually
convince distutils/setuptools to put the right files or tree of files into
'headers'.
On Wed, May 25, 2016 at 1:24 PM Sylvain Corlay <sylvain.corlay at gmail.com>
wrote:
> Hello everyone,
>
> This is my first post here so, apologies if I am breaking any rules.
>
> Lately, I have been filing a few bug reports and patches to distutils on
> bugs.python.org that all concern the installation and build of C++
> extensions.
>
> *1) The distutils.ccompiler has_flag method.*
> (http://bugs.python.org/issue26689)
>
> When building C++ extension modules that require a certain compiler flag
> (such as enabling C++11 features), you may want to check if the compiler
> has such a flag available.
>
> I proposed a patch adding a `has_flag` method to ccompiler. It is an
> equivalent to cmake' s CHECK_CXX_COMPILER_FLAG.
>
> The implementation is similar to the one of has_function which by the way
> has a pending patch by minrk in issue (http://bugs.python.org/issue25544).
>
> *2) On the need for something like pip.locations.distutils_scheme in
> distutils*
> (http://bugs.python.org/issue26955)
>
> When installing a python package that has a directive for the install_headers
> distutils command, these headers are usually installed under the main
> python include directory, which can be retrieved with
> sysconfig.get_path('include') or directly referred to as the 'include' string
> when setting the include directories of an extension module.
>
> However, on some systems like OS X, headers for extension modules are not
> located in under the python include directory
>
>
> /usr/local/Cellar/pythonX/X.Y.Z/Frameworks/Python.framework/Versions/X.Y/include/pythonX.Y
>
> but in
>
> /usr/local/include/pythonX.Y.
>
> Is there a generic way to find the location where headers are installed in
> a python install? pip.locations has a distutils_scheme function which
> seems to be returning the right thing, but it seems to be a bit overkill to
> require pip. On the other side, no path returned by sysconfig corresponds
> to `/usr/local/include/pythonX.Y`.
>
> *3) On allowing `install_headers` command to follow a specific directory
> structure*
> (http://bugs.python.org/issue27123)
>
> (instead of making a flat copy of the specified list of headers)
>
> Unlike wheel's data files, which can be specified as a list of tuples
> including the target directories
>
> [(target_directory, [list of files for target directory])]
>
> the `headers` setup keyword argument only let's you specify a list of
> files that will be copied over to a sub-directory of
> sysconfig.get_path('include').
>
> It would be useful to enable the same feature for headers as we have for
> data files.
>
> If this is a feature that you would also like to see, I can propose a
> patch to the install_headers command.
>
> Thanks,
>
> Syllvain
> _______________________________________________
> Distutils-SIG maillist - Distutils-SIG at python.org
> https://mail.python.org/mailman/listinfo/distutils-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20160525/fedeca92/attachment-0001.html>
More information about the Distutils-SIG
mailing list