mirror of
https://github.com/wassname/simpeg.git
synced 2026-09-09 11:34:26 +08:00
Merge pull request #302 from simpeg/fix/numpyDependency
Installation (i.e., setup.py) is no longer dependent on Numpy
This commit is contained in:
@@ -5,16 +5,17 @@ SimPEG is a python package for simulation and gradient based
|
|||||||
parameter estimation in the context of geophysical applications.
|
parameter estimation in the context of geophysical applications.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
from distutils.command.build_ext import build_ext
|
||||||
from setuptools import find_packages
|
from setuptools import find_packages
|
||||||
from distutils.extension import Extension
|
from distutils.extension import Extension
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASSIFIERS = [
|
CLASSIFIERS = [
|
||||||
'Development Status :: 4 - Beta',
|
'Development Status :: 4 - Beta',
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
@@ -51,11 +52,16 @@ if args.count("build_ext") > 0 and args.count("--inplace") == 0:
|
|||||||
try:
|
try:
|
||||||
from Cython.Build import cythonize
|
from Cython.Build import cythonize
|
||||||
from Cython.Distutils import build_ext
|
from Cython.Distutils import build_ext
|
||||||
cythonKwargs = dict(cmdclass={'build_ext': build_ext})
|
|
||||||
USE_CYTHON = True
|
USE_CYTHON = True
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
USE_CYTHON = False
|
USE_CYTHON = False
|
||||||
cythonKwargs = dict()
|
|
||||||
|
class NumpyBuild(build_ext):
|
||||||
|
def finalize_options(self):
|
||||||
|
build_ext.finalize_options(self)
|
||||||
|
__builtins__.__NUMPY_SETUP__ = False
|
||||||
|
import numpy
|
||||||
|
self.include_dirs.append(numpy.get_include())
|
||||||
|
|
||||||
ext = '.pyx' if USE_CYTHON else '.c'
|
ext = '.pyx' if USE_CYTHON else '.c'
|
||||||
|
|
||||||
@@ -94,8 +100,8 @@ setup(
|
|||||||
classifiers=CLASSIFIERS,
|
classifiers=CLASSIFIERS,
|
||||||
platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
|
platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
|
||||||
use_2to3 = False,
|
use_2to3 = False,
|
||||||
include_dirs=[np.get_include()],
|
cmdclass={'build_ext':NumpyBuild},
|
||||||
|
setup_requires=['numpy'],
|
||||||
ext_modules = extensions,
|
ext_modules = extensions,
|
||||||
scripts=scripts,
|
scripts=scripts,
|
||||||
**cythonKwargs
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user