Re: [Distutils] Distutils improvements regarding header installation and building C extension modules

2016-05-25 Thread Tim Smith
On Wed, May 25, 2016 at 1:24 PM Sylvain Corlay 
wrote:
> *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`.

As a Homebrew maintainer this sounds like something that Homebrew
could influence. Are there any packages in the wild that use this
mechanism? It seems that headers are mostly installed beneath
site-packages. I don't have strong feelings about whether Homebrew
should have better support for install_headers or whether that would
be straightforward to implement but IIRC we've had no prior reports of
this causing trouble.

Thanks,
Tim
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig


[Distutils] Building Python extension modules on OS X without distutils

2015-09-01 Thread Tim Smith
I wrote a post about a problem Homebrew sees pretty often on OS X
where projects link extension modules with -lpython (either explicitly
or because they trust python-config --ldflags). If you see somebody
doing this, please point them to this post and invite them to use
-undefined dynamic_lookup instead, so that the Python symbols are
resolved at import time.

http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/

Cheers,
Tim
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] setup_requires for dev environments

2015-03-19 Thread Tim Smith
On Thu, Mar 19, 2015 at 7:12 AM, Daniel Holth dho...@gmail.com wrote:

 So I'd like to suggest the following series of small improvements to both
 pip and setuptools:

  * setuptools: `python setup.py setup_requires` dumps its setup_requires
 keyword in 'requirements.txt' format

 It's is already in this format, so should be trivial, but allows one to do
 something like:

 $ python setup.py setup_requires  setup_requires.txt
 $ pip install -r setup_requires.txt

 Or in one bash line:

 $ pip install -r ( python setup.py setup_requires )


A way of learning about setup_requires dependencies would be helpful for
homebrew-pypi-poet [1], which helps generate Homebrew formulae for
applications implemented in Python. Homebrew prefers to specify all
dependencies explicitly in the formula rather than allowing easy_install or
pip to perform dependency resolution at formula install time. [2] We use
installed metadata to learn about install_requires dependencies but
setup_requires dependencies aren't captured AFAIK (are they?) so formula
authors have to identify those by hand. This isn't critically painful for
me but I thought it was an interesting example use case.

Tim

[1] https://github.com/tdsmith/homebrew-pypi-poet

[2] As Chris Barker notes, --single-version-externally-managed is a good
way to get setuptools-based setup.py's to just install the package;
--single-version-externally-managed hands the install process over to
distutils. Of course, distutils setup.py's do not support the
--single-version-externally-managed option. To have a consistent CLI
interface, Homebrew borrows a shim from pip's source to make sure we always
call setuptools.setup() when we run setup.py so that we can hand the
install back to distutils:
https://github.com/Homebrew/homebrew/blob/master/Library/Homebrew/language/python.rb#L78-L94
-- thanks to Donald for pointing to the right place in the pip code.
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] setup_requires for dev environments

2015-03-19 Thread Tim Smith
Apologies: misattributed Leonardo Rochael Almeida leoroch...@gmail.com's
comments to Daniel Holth when I was cutting and pasting from my digest.

On Thu, Mar 19, 2015 at 9:45 AM, Tim Smith t...@tim-smith.us wrote:

 On Thu, Mar 19, 2015 at 7:12 AM, Daniel Holth dho...@gmail.com wrote:

 So I'd like to suggest the following series of small improvements to both
 pip and setuptools:


___
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig