Hi AJ,

> On 1 Jun 2015, at 7:07 am, AJ Friend <[email protected]> wrote:
> I'm trying to write a new `setup.py` file for an extension module to
> wrap a C library (https://github.com/cvxgrp/scs).

I have been looking for the best way to do this too and I am keen to hear from 
distutils-sig.

I can show you my currently favourite way, although I am not sure it’s 
applicable to your case.

class BuildExtensions(build_ext):
    def run(self):
        # At this point we can be sure pip has already installed numpy
        numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')

        for ext in self.extensions:
            if (hasattr(ext, 'include_dirs') and
                    numpy_incl not in ext.include_dirs):
                ext.include_dirs.append(numpy_incl)

        build_ext.run(self)

and then of course pass requires=[“numpy”] to setup.


This avoids running any of numpy’s code. It should work because as of version 
6.1.0 pip installs
project dependencies in the right (topological) order.

This should be enough for your version but the original repo was importing 
numpy also to access
other informations.

        from numpy.distutils.system_info import get_info, BlasNotFoundError 

and I am not sure how to access that without importing numpy.

> Any idea why that would be happening? Could it have anything to do
> with the relative path I'm giving for the include directories?

This is impossible to say without a build log. Can you upload one somewhere 
(gist/pastebin/etc) ?

Andrea

--
Andrea Bedini
@andreabedini, http://www.andreabedini.com
use https://keybase.io/andreabedini to send me private messages


_______________________________________________
Distutils-SIG maillist  -  [email protected]
https://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to