예제 #1
0
def get_includes():
    import eigency

    SOURCE_DIR = os.path.dirname(os.path.abspath(__file__))
    inc = eigency.get_includes(include_eigen=True)
    inc.append(SOURCE_DIR)
    return inc
예제 #2
0
 def finalize_options(self):
     build_ext.finalize_options(self)
     # Prevent numpy from thinking it is still in its setup process:
     __builtins__.__NUMPY_SETUP__ = False
     import numpy
     import eigency
     self.include_dirs += [r"GeneralTmm/src/CppTmm/CppTmm",
             r"GeneralTmm/src/eigen_3.2.4",
             r"GeneralTmm/src/Simplex",
             numpy.get_include()] + \
             eigency.get_includes(include_eigen = False)
예제 #3
0
def find_eigen_dir(output=False):
    if debug: output = True
    import distutils.sysconfig

    try_dirs = []
    if 'EIGEN_DIR' in os.environ:
        try_dirs.append(os.environ['EIGEN_DIR'])
        try_dirs.append(os.path.join(os.environ['EIGEN_DIR'], 'include'))
    # This is where conda will install it.
    try_dirs.append(distutils.sysconfig.get_config_var('INCLUDEDIR'))
    if 'posix' in os.name.lower():
        try_dirs.extend(['/usr/local/include', '/usr/include'])
    if 'darwin' in platform.system().lower():
        try_dirs.extend([
            '/usr/local/include', '/usr/include', '/sw/include',
            '/opt/local/include'
        ])
    for path in ['C_INCLUDE_PATH']:
        if path in os.environ:
            for dir in os.environ[path].split(':'):
                try_dirs.append(dir)
    # eigency is a python package that bundles the Eigen header files, so if that's there,
    # can use that.
    try:
        import eigency
        try_dirs.append(eigency.get_includes()[2])
    except ImportError:
        pass

    if output: print("Looking for Eigen:")
    for dir in try_dirs:
        if not os.path.isdir(dir): continue
        if output: print("  ", dir, end='')
        if os.path.isfile(os.path.join(dir, 'Eigen/Core')):
            if output: print("  (yes)")
            return dir
        if os.path.isfile(os.path.join(dir, 'eigen3', 'Eigen/Core')):
            dir = os.path.join(dir, 'eigen3')
            if output:
                # Only print this if the eigen3 addition was key to finding it.
                print("\n  ", dir, "  (yes)")
            return dir
        if output: print("  (no)")
    if output:
        print(
            "Could not find Eigen.  Make sure it is installed either in a standard "
        )
        print(
            "location such as /usr/local/include, or the installation directory is either in "
        )
        print("your C_INCLUDE_PATH or EIGEN_DIR environment variable.")
    raise OSError("Could not find Eigen")
예제 #4
0
def find_eigen_dir(output=False):
    import distutils.sysconfig

    try_dirs = []
    if 'EIGEN_DIR' in os.environ:
        try_dirs.append(os.environ['EIGEN_DIR'])
        try_dirs.append(os.path.join(os.environ['EIGEN_DIR'], 'include'))
    # This is where conda will install it.
    try_dirs.append(distutils.sysconfig.get_config_var('INCLUDEDIR'))
    if 'posix' in os.name.lower():
        try_dirs.extend(['/usr/local/include', '/usr/include'])
    if 'darwin' in platform.system().lower():
        try_dirs.extend(['/usr/local/include', '/usr/include', '/sw/include',
                            '/opt/local/include'])
    for path in ['C_INCLUDE_PATH']:
        if path in os.environ:
            for dir in os.environ[path].split(':'):
                try_dirs.append(dir)
    # eigency is a python package that bundles the Eigen header files, so if that's there,
    # can use that.
    try:
        import eigency
        try_dirs.append(eigency.get_includes()[2])
    except ImportError:
        pass

    if output: print("Looking for Eigen:")
    for dir in try_dirs:
        if not os.path.isdir(dir): continue
        if output: print("  ", dir, end='')
        if os.path.isfile(os.path.join(dir, 'Eigen/Core')):
            if output: print("  (yes)")
            return dir
        if os.path.isfile(os.path.join(dir, 'eigen3', 'Eigen/Core')):
            dir = os.path.join(dir, 'eigen3')
            if output:
                # Only print this if the eigen3 addition was key to finding it.
                print("\n  ", dir, "  (yes)")
            return dir
        if output: print("  (no)")
    if output:
        print("Could not find Eigen.  Make sure it is installed either in a standard ")
        print("location such as /usr/local/include, or the installation directory is either in ")
        print("your C_INCLUDE_PATH or EIGEN_DIR environment variable.")
    raise OSError("Could not find Eigen")
예제 #5
0
from setuptools import setup, Extension
#from distutils.core import setup
from Cython.Build import cythonize
import eigency

extensions = [
        Extension(name = "rect.rect", # Need the . to put *.so in right location
            sources = ["rect/rect.pyx"],
            include_dirs = [".", "cython/src"]
            ),
        Extension(name = "eigen_example.eigen_example",
            sources = ["eigen_example/eigen_example.pyx"],
            include_dirs = [".", "cython/src"] + eigency.get_includes()
            ),
        ]

config = {
    'name': 'ProjectSkeleton',  # Replace with project name
    'version': '0.0',  # Replace with module_name.__version__
    'url': '',  # Replace with url to github
    'description': 'This is a template',  # Replace with project description
    'author': 'Christopher Aicher',
    'license': 'license',
    'packages': ['rect', 'eigen_example'],  # Replace with package names
    'ext_modules': cythonize(extensions), # Cythonized Packages
    'scripts': [], # Scripts with #!/usr/bin/env python
}

setup(**config)
# Develop: python setup.py develop
# Remove: python setup.py develop --uninstall
예제 #6
0
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize

import eigency

extensions = [
    Extension("pyov2sgd/ov2sgd",
              ["pyov2sgd/ov2sgd.pyx"],
              language="c++",
              include_dirs=[".", "include", "src"] + eigency.get_includes()
              ),
]

setup(
    name="ov2sgd",
    ext_modules=cythonize(extensions),
)
예제 #7
0
from setuptools import setup
from setuptools.extension import Extension
from Cython.Build import cythonize

import eigency

extensions = [
    Extension("eigency_tests.eigency_tests", ["eigency_tests/eigency_tests.pyx"],
        include_dirs = [".", "eigency_tests"] + eigency.get_includes()
    ),
]

dist = setup(
    name = "eigency_tests",
    version = "1.0",
    ext_modules = cythonize(extensions),
    packages = ["eigency_tests"]
)

예제 #8
0
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import eigency

extensions = [
    Extension(
        name="ml_project",
        sources=[
            "ml_project.pyx", "kernel.cpp", "model.cpp", "gradient_descent.cpp"
        ],
        extra_compile_args=['-std=c++11'],
        include_dirs=eigency.get_includes(include_eigen=True),
        language="c++",
    )
]

setup(ext_modules=cythonize(extensions))
예제 #9
0
from setuptools import setup
from setuptools.extension import Extension
from Cython.Build import cythonize

import eigency

extensions = [
    Extension("fastronWrapper.fastronWrapper",
              ["fastronWrapper/fastronWrapper.pyx"],
              include_dirs=[".", "fastronWrapper"] + eigency.get_includes()),
]

dist = setup(ext_modules=cythonize(extensions), )
예제 #10
0
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import eigency

setup(
    # Information
    name = "beliefEvolution",
    version = "1.0.0",
    license = "BSD",
    # Build instructions
    ext_modules = cythonize([Extension("beliefEvolution",
                             ["beliefEvolution.pyx", "../src/dynamics/belief_evolution.cpp", "../src/dynamics/utils.cpp"],
                             include_dirs=["../include", "/usr/include/eigen3"]+ eigency.get_includes(include_eigen=False), extra_compile_args = ["-std=c++11", "-fopenmp"], extra_link_args=['-lgomp'], language='c++')]),
)
예제 #11
0
from Cython.Build import cythonize

#os.environ["CC"] = "g++-5" 
#os.environ["CXX"] = "g++-5"

COMPILE_ARGS = ['-O3', '-DEIGEN_NO_AUTOMATIC_RESIZING', 
                '-march=native', '-std=c++11']

if sys.platform == 'darwin':
    COMPILE_ARGS.append('-stdlib=libc++')

extensions = [Extension(name = "chirpz.cychirpz",
                        sources = ["chirpz/cychirpz.pyx", "chirpz/chirpz.cc"],
                        extra_compile_args =COMPILE_ARGS, 
                        include_dirs = [np.get_include(), "./", os.environ['CONDA_PREFIX'] + "/include"] \
                        + eigency.get_includes(include_eigen=True), 
                        extra_link_args = ['-lm', '-lfftw3f', '-lfftw3', '-lboost_system', '-lboost_timer'], 
                        language='c++')
]


setup(name='chirpz',
      version='1.0',
      description='Python and C++ implementation of Chirp-Z transform',
      author='Eric Jonas',
      author_email='*****@*****.**',
      url='https://www.github.com/ericmjonas/pychirpz/',
      packages=['chirpz'],
      package_data={"chirpz" : ['chirpz.h', 'chirpz.cc']}, 
      ext_modules = cythonize(extensions),
     )
예제 #12
0
# -*- coding: utf-8 -*-

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import eigency

setup(
    ext_modules = cythonize([Extension("sophus", 
        sources=["sophus.pyx"],
        include_dirs = [".", "/usr/include/eigen3", "./Sophus"] + eigency.get_includes(include_eigen=False),
        language="c++",
        extra_compile_args=["-std=c++11"])])
)
예제 #13
0
from distutils.core import setup, Extension
from Cython.Build import cythonize
import eigency

setup(ext_modules=cythonize(
    Extension(
        name='propagation',
        author='anonymous',
        version='0.0.1',
        sources=['propagation.pyx'],
        language='c++',
        extra_compile_args=["-std=c++11"],
        include_dirs=[".", "module-dir-name"] + eigency.get_includes() +
        ["./eigen3"],
        #If you have installed eigen, you can configure your own path. When numpy references errors, you need to import its header file
        install_requires=['Cython>=0.2.15', 'eigency>=1.77'],
        packages=['little-try'],
        python_requires='>=3')))
예제 #14
0
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize

import eigency

extensions = [
    Extension("pyov2sgd/ov2sgd", ["pyov2sgd/ov2sgd.pyx"],
              language="c++",
              include_dirs=[".", "include", "src"] + eigency.get_includes()),
]

setup(
    name="ov2sgd",
    ext_modules=cythonize(extensions),
)
예제 #15
0
파일: setup.py 프로젝트: c-elvira/IBPDL-SVA
    ]
else:
    # Linux and Windows
    extensions = [
        Extension(
            'cSvaIbpDl',
            glob('ibpdlsva/*.pyx') + glob('ibpdlsva/*.cxx'),
            extra_compile_args=["-std=c++11"])
    ]



setup(
    name = "cSvaIbpDl",
    ext_modules = cythonize(extensions),
    include_dirs = [".", "ibpdlsva/includes/", "ibpdlsva/sources/", 'ibpdlsva/lib/'] + eigency.get_includes(include_eigen=True),


    version='0.1.dev',

    description = 'A sample Python project',
    long_description = 'A sample Python project',

    # The project's main homepage.
    url='https://github.com/c-elvira/ibpdlsva',

    # Author details
    author='celvira, hphongdang',
    author_email='*****@*****.**',

    # Choose your license
예제 #16
0
            if not len(v1) or not len(v2) or not len(v3):
                continue
            v = "{0}.{1}.{2}".format(v1[0], v2[0], v3[0])
            print("Found Eigen version {0} in: {1}".format(v, d))
            return d
    return None

eigen_loc = find_eigen()

setup(
    name='eit',
    version='',
    packages=['eit'],
    url='',
    license='',
    author='benorn',
    author_email='',
    description='',
    requires=['numpy'],
    ext_modules=cythonize([
        Extension('*',
                  ['eit/*.pyx'],
                  extra_objects=['../cpp/lib/libeit.a', '../cpp/lib/libcmcmc.a'],
                  extra_compile_args=["-std=c++11", "-fopenmp"],
                  extra_link_args=['-lgomp'],
                  language='c++'
                  )
        ]
    ),
    include_dirs=[numpy.get_include(), '../cpp/include'] + [eigen_loc] + eigency.get_includes(include_eigen=False)
)
예제 #17
0
파일: setup.py 프로젝트: bbahiam/MTK
inc_dirs = []


# find the eigen root directory and add it to the include path
inc_dirs = ReadConfigFile("Includes.config")

# Relative paths for the include/library directories
rel_inc_dirs = ['MTK/include/']


# Convert from relative to absolute directories
inc_dirs.extend(GlobalDirectory(rel_inc_dirs))


exts = [Extension('MTK.MTK', sources=['MTK/MTK.pyx'],
            include_dirs=inc_dirs + eigency.get_includes())
    ]

for e in exts:
    e.cython_directives = {"embedsignature": True, "binding":True}
    
setup(name='modaltoolkit',
    version='3.0.0',
    description='Modal Tool Kit',
    author='Christopher A. Lupp',
    author_email='*****@*****.**',
    include_package_data=True,
    packages = find_packages(),
    package_data = {"MTK": ['*.pxd','include/*']},
    ext_modules=cythonize(exts),
    install_requires = ['numpy','h5py','eigency','sphinx', 'matplotlib']
예제 #18
0
def find_eigen_dir(output=False):
    if debug: output = True
    import distutils.sysconfig

    try_dirs = []
    if 'EIGEN_DIR' in os.environ:
        try_dirs.append(os.environ['EIGEN_DIR'])
        try_dirs.append(os.path.join(os.environ['EIGEN_DIR'], 'include'))
    # This is where conda will install it.
    try_dirs.append(distutils.sysconfig.get_config_var('INCLUDEDIR'))
    if 'posix' in os.name.lower():
        try_dirs.extend(['/usr/local/include', '/usr/include'])
    if 'darwin' in platform.system().lower():
        try_dirs.extend([
            '/usr/local/include', '/usr/include', '/sw/include',
            '/opt/local/include'
        ])
    for path in ['C_INCLUDE_PATH']:
        if path in os.environ:
            for dir in os.environ[path].split(':'):
                try_dirs.append(dir)
    if os.path.isdir('downloaded_eigen'):
        try_dirs.extend(glob.glob(os.path.join('downloaded_eigen', '*')))
    # eigency is a python package that bundles the Eigen header files, so if that's there,
    # can use that.
    try:
        import eigency
        try_dirs.append(eigency.get_includes()[2])
    except ImportError:
        pass

    if output: print("Looking for Eigen:")
    for dir in try_dirs:
        if not os.path.isdir(dir): continue
        if output: print("  ", dir, end='')
        if os.path.isfile(os.path.join(dir, 'Eigen/Core')):
            if output: print("  (yes)")
            return dir
        if os.path.isfile(os.path.join(dir, 'eigen3', 'Eigen/Core')):
            dir = os.path.join(dir, 'eigen3')
            if output:
                # Only print this if the eigen3 addition was key to finding it.
                print("\n  ", dir, "  (yes)")
            return dir
        if output: print("  (no)")

    if output:
        print("Could not find Eigen in any of the standard locations.")
        print(
            "Will now try to download it from gitlab.com. This requires an internet"
        )
        print("connection, so it will fail if you are currently offline.")
        print(
            "If Eigen is installed in a non-standard location, and you want to use that"
        )
        print(
            "instead, you should make sure the right directory is either in your"
        )
        print(
            "C_INCLUDE_PATH or specified in an EIGEN_DIR environment variable."
        )

    try:
        dir = 'downloaded_eigen'
        if os.path.isdir(dir):
            # If this exists, it was tried above and failed.  Something must be wrong with it.
            print(
                "Previous attempt to download eigen found. Deleting and trying again."
            )
            shutil.rmtree(dir)
        os.mkdir(dir)
        url = 'https://gitlab.com/libeigen/eigen/-/archive/3.3.4/eigen-3.3.4.tar.bz2'
        if output:
            print("Downloading eigen from ", url)
        # Unfortunately, gitlab doesn't allow direct downloads. We need to spoof the request
        # so it thinks we're a web browser.
        # cf. https://stackoverflow.com/questions/42863240/how-to-get-round-the-http-error-403-forbidden-with-urllib-request-using-python
        page = urllib2.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
        data = urllib2.urlopen(page).read()
        fname = 'eigen.tar.bz2'
        with open(fname, 'wb') as f:
            f.write(data)
        if output:
            print("Downloaded %s.  Unpacking tarball." % fname)
        with tarfile.open(fname) as tar:
            tar.extractall(dir)
        os.remove(fname)
        # This actually extracts into a subdirectory with a name eigen-eigen-5a0156e40feb/
        # I'm not sure if that name is reliable, so use glob to get it.
        dir = glob.glob(os.path.join(dir, '*'))[0]
        if os.path.isfile(os.path.join(dir, 'Eigen/Core')):
            return dir
        elif output:
            print(
                "Downloaded eigen, but it didn't have the expected Eigen/Core file."
            )
    except Exception as e:
        if output:
            print(
                "Error encountered while downloading Eigen from the internet")
            print(e)

    raise OSError("Could not find Eigen")
예제 #19
0
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import eigency
setup(ext_modules=[
    Extension(
        "pyCalc",
        ["master.pyx", "Variable.cpp", "Dataset.cpp"],
        language="c++",
    )
],
      cmdclass={'build_ext': build_ext},
      include_dirs=[".", "pyCulus"] + eigency.get_includes())
예제 #20
0
from setuptools import setup
from setuptools.extension import Extension
from Cython.Build import cythonize

import eigency

sourcefiles = [
    'get_homography_25pt.pyx', '../c++/solver_homography_planar.cpp'
]
extensions = [
    Extension("get_homograpy_25pt.get_homography_25pt",
              sourcefiles,
              include_dirs=[".", "../c++"] + eigency.get_includes()),
]

dist = setup(name="get_homography_25pt",
             version="0.1",
             ext_modules=cythonize(extensions),
             packages=["get_homography_25pt"])
예제 #21
0
파일: setup.py 프로젝트: safelix/JCDec
if os.name == "posix":
    __conda_include_dir__ = os.path.join(__conda_dir__, "include")
if os.name == "nt":
    __conda_include_dir__ = os.path.join(__conda_dir__, "Library", "include")

__eigen__include_dir__ = os.path.join(__conda_include_dir__, "eigen3")

if os.name == "posix":
    compile_args = ["-std=c++17", "-Wall"]
if os.name == "nt":
    compile_args = ["/std:c++17"]  # /Wall is too aggressive

extensions = [
    Extension(
        language="c++",
        name="jordanchevalley",
        sources=__core_src__ + __python_src__,
        include_dirs=[
            __conda_include_dir__, __eigen__include_dir__, __core_dir__
        ] + eigency.get_includes(include_eigen=False),
        extra_compile_args=compile_args,
    )
]

dist = setup(
    name="jordanchevalley",
    install_requires=["numpy"],
    setup_requires=["setuptools>=18.0", "cython", "eigency"],
    ext_modules=extensions,
)
예제 #22
0
def find_eigen_dir(output=False):
    if debug: output = True
    import distutils.sysconfig

    try_dirs = []
    if 'EIGEN_DIR' in os.environ:
        try_dirs.append(os.environ['EIGEN_DIR'])
        try_dirs.append(os.path.join(os.environ['EIGEN_DIR'], 'include'))
    # This is where conda will install it.
    try_dirs.append(distutils.sysconfig.get_config_var('INCLUDEDIR'))
    if 'posix' in os.name.lower():
        try_dirs.extend(['/usr/local/include', '/usr/include'])
    if 'darwin' in platform.system().lower():
        try_dirs.extend([
            '/usr/local/include', '/usr/include', '/sw/include',
            '/opt/local/include'
        ])
    for path in ['C_INCLUDE_PATH']:
        if path in os.environ:
            for dir in os.environ[path].split(':'):
                try_dirs.append(dir)
    if os.path.isdir('downloaded_eigen'):
        try_dirs.extend(glob.glob(os.path.join('downloaded_eigen', '*')))
    # eigency is a python package that bundles the Eigen header files, so if that's there,
    # can use that.
    try:
        import eigency
        try_dirs.append(eigency.get_includes()[2])
    except ImportError:
        pass

    if output: print("Looking for Eigen:")
    for dir in try_dirs:
        if not os.path.isdir(dir): continue
        if output: print("  ", dir, end='')
        if os.path.isfile(os.path.join(dir, 'Eigen/Core')):
            if output: print("  (yes)")
            return dir
        if os.path.isfile(os.path.join(dir, 'eigen3', 'Eigen/Core')):
            dir = os.path.join(dir, 'eigen3')
            if output:
                # Only print this if the eigen3 addition was key to finding it.
                print("\n  ", dir, "  (yes)")
            return dir
        if output: print("  (no)")

    if output:
        print("Could not find Eigen in any of the standard locations.")
        print(
            "Will now try to download it from bitbucket.org. This requires an internet"
        )
        print("connection, so it will fail if you are currently offline.")
        print(
            "If Eigen is installed in a non-standard location, and you want to use that"
        )
        print(
            "instead, you should make sure the right directory is either in your"
        )
        print(
            "C_INCLUDE_PATH or specified in an EIGEN_DIR environment variable."
        )

    try:
        dir = 'downloaded_eigen'
        if os.path.isdir(dir):
            # If this exists, it was tried above and failed.  Something must be wrong with it.
            print(
                "Previous attempt to download eigen found. Deleting and trying again."
            )
            shutil.rmtree(dir)
        os.mkdir(dir)
        url = 'https://bitbucket.org/eigen/eigen/get/3.3.4.tar.bz2'
        if output:
            print("Downloading eigen from ", url)
        u = urlopen(url)
        fname = 'eigen.tar.bz2'
        block_sz = 32 * 1024
        with open(fname, 'wb') as f:
            buffer = u.read(block_sz)
            while buffer:
                f.write(buffer)
                buffer = u.read(block_sz)
        if output:
            print("Downloaded %s.  Unpacking tarball." % fname)
        with tarfile.open(fname) as tar:
            tar.extractall(dir)
        os.remove(fname)
        # This actually extracts into a subdirectory with a name eigen-eigen-5a0156e40feb/
        # I'm not sure if that name is reliable, so use glob to get it.
        dir = glob.glob(os.path.join(dir, '*'))[0]
        if os.path.isfile(os.path.join(dir, 'Eigen/Core')):
            return dir
        elif output:
            print(
                "Downloaded eigen, but it didn't have the expected Eigen/Core file."
            )
    except Exception as e:
        if output:
            print(
                "Error encountered while downloading Eigen from the internet")
            print(e)

    raise OSError("Could not find Eigen")