Ejemplo n.º 1
0
def main():
    from aksetup_helper import hack_distutils, get_config, setup, Extension

    hack_distutils()
    conf = get_config(get_config_schema())

    INCLUDE_DIRS = conf["TAGLIB_INC_DIR"] + conf["BOOST_INC_DIR"]
    LIBRARY_DIRS = conf["TAGLIB_LIB_DIR"] + conf["BOOST_LIB_DIR"]
    LIBRARIES = conf["TAGLIB_LIBNAME"] + conf["BOOST_PYTHON_LIBNAME"]

    setup(name="tagpy",
          version="2018.1.1",
          description="Python Bindings for TagLib",
          long_description=open("README.rst", "rt").read(),
          author="Andreas Kloeckner",
          author_email="*****@*****.**",
          classifiers=
          [
              "Development Status :: 5 - Production/Stable",
              "Intended Audience :: Developers",
              "License :: OSI Approved :: MIT License",
              "Natural Language :: English",
              "Operating System :: OS Independent",
              "Operating System :: POSIX",
              "Operating System :: Unix",
              "Programming Language :: Python",
              "Programming Language :: Python :: 3",
              "Topic :: Multimedia :: Sound/Audio",
              "Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Ripping",
              "Topic :: Multimedia :: Sound/Audio :: Editors",
              "Topic :: Software Development :: Libraries :: Python Modules",
              "Topic :: Utilities"],
          license="MIT",

          install_requires=["pytest"],

          url="http://mathema.tician.de/software/tagpy",
          packages=["tagpy", "tagpy.ogg"],
          ext_modules=[
              Extension("_tagpy",
                  ["src/wrapper/basics.cpp",
                      "src/wrapper/id3.cpp",
                      "src/wrapper/rest.cpp"],
                  include_dirs=INCLUDE_DIRS,
                  library_dirs=LIBRARY_DIRS,
                  libraries=LIBRARIES,
                  extra_compile_args=conf["CXXFLAGS"],
                  ),
                        ]
          )
Ejemplo n.º 2
0
def main():
    import glob
    from aksetup_helper import (hack_distutils, get_config, setup, \
            NumpyExtension, Extension, set_up_shipped_boost_if_requested)

    hack_distutils()
    conf = get_config(get_config_schema())
    EXTRA_SOURCES, EXTRA_DEFINES = set_up_shipped_boost_if_requested(conf)

    EXTRA_DEFINES["PYGPU_PACKAGE"] = "pycuda"
    EXTRA_DEFINES["PYGPU_PYCUDA"] = "1"

    LIBRARY_DIRS = conf["BOOST_LIB_DIR"]
    LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] + conf["BOOST_THREAD_LIBNAME"]

    from os.path import dirname, join, normpath

    if conf["CUDA_ROOT"] is None:
        nvcc_path = search_on_path(["nvcc", "nvcc.exe"])
        if nvcc_path is None:
            print("*** CUDA_ROOT not set, and nvcc not in path. Giving up.")
            import sys
            sys.exit(1)

        conf["CUDA_ROOT"] = normpath(join(dirname(nvcc_path), ".."))

    if conf["CUDA_INC_DIR"] is None:
        conf["CUDA_INC_DIR"] = [join(conf["CUDA_ROOT"], "include")]
    if not conf["CUDADRV_LIB_DIR"]:
        conf["CUDADRV_LIB_DIR"] = [join(conf["CUDA_ROOT"], "lib")]

    verify_siteconfig(conf)

    EXTRA_INCLUDE_DIRS = []
    EXTRA_LIBRARY_DIRS = []
    EXTRA_LIBRARIES = []

    if conf["CUDA_TRACE"]:
        EXTRA_DEFINES["CUDAPP_TRACE_CUDA"] = 1

    if conf["CUDA_PRETEND_VERSION"]:
        EXTRA_DEFINES["CUDAPP_PRETEND_CUDA_VERSION"] = conf[
            "CUDA_PRETEND_VERSION"]

    INCLUDE_DIRS = ['src/cpp'] + conf["BOOST_INC_DIR"] + conf["CUDA_INC_DIR"]
    conf["USE_CUDA"] = True

    import sys

    if 'darwin' in sys.platform and sys.maxsize == 2147483647:
        # The Python interpreter is running in 32 bit mode on OS X
        if "-arch" not in conf["CXXFLAGS"]:
            conf["CXXFLAGS"].extend(['-arch', 'i386', '-m32'])
        if "-arch" not in conf["LDFLAGS"]:
            conf["LDFLAGS"].extend(['-arch', 'i386', '-m32'])

    ext_kwargs = dict()

    if conf["CUDA_ENABLE_GL"]:
        EXTRA_SOURCES.append("src/wrapper/wrap_cudagl.cpp")
        EXTRA_DEFINES["HAVE_GL"] = 1

    ver_dic = {}
    exec(
        compile(
            open("pycuda/__init__.py").read(), "pycuda/__init__.py", 'exec'),
        ver_dic)

    try:
        from distutils.command.build_py import build_py_2to3 as build_py
    except ImportError:
        # 2.x
        from distutils.command.build_py import build_py

    setup(
        name="pycuda",
        # metadata
        version=ver_dic["VERSION_TEXT"],
        description="Python wrapper for Nvidia CUDA",
        long_description="""
            PyCUDA lets you access `Nvidia <http://nvidia.com>`_'s `CUDA
            <http://nvidia.com/cuda/>`_ parallel computation API from Python.
            Several wrappers of the CUDA API already exist-so what's so special
            about PyCUDA?

            * Object cleanup tied to lifetime of objects. This idiom, often
              called
              `RAII <http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization>`_
              in C++, makes it much easier to write correct, leak- and
              crash-free code. PyCUDA knows about dependencies, too, so (for
              example) it won't detach from a context before all memory
              allocated in it is also freed.

            * Convenience. Abstractions like pycuda.driver.SourceModule and
              pycuda.gpuarray.GPUArray make CUDA programming even more
              convenient than with Nvidia's C-based runtime.

            * Completeness. PyCUDA puts the full power of CUDA's driver API at
              your disposal, if you wish. It also includes code for
              interoperability with OpenGL.

            * Automatic Error Checking. All CUDA errors are automatically
              translated into Python exceptions.

            * Speed. PyCUDA's base layer is written in C++, so all the niceties
              above are virtually free.

            * Helpful `Documentation <http://documen.tician.de/pycuda>`_ and a
              `Wiki <http://wiki.tiker.net/PyCuda>`_.

            Relatedly, like-minded computing goodness for `OpenCL <http://khronos.org>`_
            is provided by PyCUDA's sister project `PyOpenCL <http://pypi.python.org/pypi/pyopencl>`_.
            """,
        author="Andreas Kloeckner",
        author_email="*****@*****.**",
        license="MIT",
        url="http://mathema.tician.de/software/pycuda",
        classifiers=[
            'Environment :: Console',
            'Development Status :: 5 - Production/Stable',
            'Intended Audience :: Developers',
            'Intended Audience :: Other Audience',
            'Intended Audience :: Science/Research',
            'License :: OSI Approved :: MIT License',
            'Natural Language :: English',
            'Programming Language :: C++',
            'Programming Language :: Python',
            'Topic :: Scientific/Engineering',
            'Topic :: Scientific/Engineering :: Mathematics',
            'Topic :: Scientific/Engineering :: Physics',
            'Topic :: Scientific/Engineering :: Visualization',
        ],

        # build info
        packages=["pycuda", "pycuda.gl", "pycuda.sparse"],
        install_requires=["pytools>=2011.2", "pytest>=2", "decorator>=3.2.0"],
        ext_package="pycuda",
        ext_modules=[
            NumpyExtension(
                "_driver",
                [
                    "src/cpp/cuda.cpp",
                    "src/cpp/bitlog.cpp",
                    "src/wrapper/wrap_cudadrv.cpp",
                    "src/wrapper/mempool.cpp",
                ] + EXTRA_SOURCES,
                include_dirs=INCLUDE_DIRS + EXTRA_INCLUDE_DIRS,
                library_dirs=LIBRARY_DIRS + conf["CUDADRV_LIB_DIR"],
                libraries=LIBRARIES + conf["CUDADRV_LIBNAME"],
                define_macros=list(EXTRA_DEFINES.items()),
                extra_compile_args=conf["CXXFLAGS"],
                extra_link_args=conf["LDFLAGS"],
            ),
            Extension(
                "_pvt_struct",
                ["src/wrapper/_pycuda_struct.c"],
                extra_compile_args=conf["CXXFLAGS"],
                extra_link_args=conf["LDFLAGS"],
            )
        ],
        data_files=[("include/pycuda", glob.glob("src/cuda/*.hpp"))],

        # 2to3 invocation
        cmdclass={'build_py': build_py})
Ejemplo n.º 3
0
def main():
    import glob
    from aksetup_helper import hack_distutils, get_config, setup, Extension

    hack_distutils()
    conf = get_config(get_config_schema())

    INCLUDE_DIRS = conf["TAGLIB_INC_DIR"] + conf["BOOST_INC_DIR"]
    LIBRARY_DIRS = conf["TAGLIB_LIB_DIR"] + conf["BOOST_LIB_DIR"]
    LIBRARIES = conf["TAGLIB_LIBNAME"] + conf["BOOST_PYTHON_LIBNAME"]

    setup(name="tagpy",
          version="0.94.8",
          description="Python Bindings for TagLib",
          long_description="""
          TagPy is a set of Python bindings for Scott Wheeler's 
          `TagLib <http://developer.kde.org/~wheeler/taglib.html>`_. 
          It builds upon `Boost.Python <http://www.boost.org/libs/python/doc/>`_, 
          a wrapper generation library which is part of the renowned Boost 
          set of C++ libraries.

          Just like TagLib, TagPy can:

          * read and write ID3 tags of version 1 and 2, with many supported frame types
            for version 2 (in MPEG Layer 2 and MPEG Layer 3, FLAC and MPC),
          * access Xiph Comments in Ogg Vorbis Files and Ogg Flac Files,
          * access APE tags in Musepack and MP3 files.

          All these features have their own specific interfaces, but 
          TagLib's generic tag reading and writing mechanism is also 
          supported. It comes with a bunch of examples.
          """,
          author="Andreas Kloeckner",
          author_email="*****@*****.**",
          classifiers=[
              "Development Status :: 5 - Production/Stable",
              "Intended Audience :: Developers",
              "License :: OSI Approved :: MIT License",
              "Natural Language :: English",
              "Operating System :: OS Independent",
              "Operating System :: POSIX", "Operating System :: Unix",
              "Programming Language :: Python",
              "Topic :: Multimedia :: Sound/Audio",
              "Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Ripping",
              "Topic :: Multimedia :: Sound/Audio :: Editors",
              "Topic :: Software Development :: Libraries :: Python Modules",
              "Topic :: Utilities"
          ],
          license="MIT",
          url="http://mathema.tician.de/software/tagpy",
          packages=["tagpy", "tagpy.ogg"],
          ext_modules=[
              Extension(
                  "_tagpy",
                  [
                      "src/wrapper/basics.cpp", "src/wrapper/id3.cpp",
                      "src/wrapper/rest.cpp"
                  ],
                  include_dirs=INCLUDE_DIRS,
                  library_dirs=LIBRARY_DIRS,
                  libraries=LIBRARIES,
                  extra_compile_args=conf["CXXFLAGS"],
              ),
          ])
Ejemplo n.º 4
0
def main():
    from aksetup_helper import (hack_distutils,
            check_pybind11, get_config, setup, check_git_submodules,
            Extension,
            get_pybind_include, PybindBuildExtCommand)

    check_pybind11()
    check_git_submodules()

    hack_distutils(what_opt=1)
    conf = get_config(
            get_config_schema(),
            warn_about_no_config=False)

    triangle_macros = [
            ("EXTERNAL_TEST", 1),
            ("ANSI_DECLARATORS", 1),
            ("TRILIBRARY", 1),
            ]

    tetgen_macros = [
            ("TETLIBRARY", 1),
            ("SELF_CHECK", 1),
            ]

    # }}}

    include_dirs = [
            get_pybind_include(),
            get_pybind_include(user=True)
            ] + ["src/cpp"]

    init_filename = "meshpy/__init__.py"
    exec(compile(open(init_filename, "r").read(), init_filename, "exec"), conf)

    import codecs
    setup(name="MeshPy",
          version=conf["version"],
          description="Triangular and Tetrahedral Mesh Generator",
          long_description=codecs.open("README.rst", "r", "utf-8").read(),
          author="Andreas Kloeckner",
          author_email="*****@*****.**",
          license=("MIT for the wrapper/non-commercial for "
              "the Triangle/GNU Affero Public License for TetGen"),
          url="https://documen.tician.de/meshpy",
          classifiers=[
              "Development Status :: 4 - Beta",
              "Intended Audience :: Developers",
              "Intended Audience :: Other Audience",
              "Intended Audience :: Science/Research",
              "License :: OSI Approved :: MIT License",
              "License :: Free for non-commercial use",
              "Natural Language :: English",
              "Programming Language :: C++",
              "Programming Language :: Python",
              "Programming Language :: Python :: 3",
              "Topic :: Multimedia :: Graphics :: 3D Modeling",
              "Topic :: Scientific/Engineering",
              "Topic :: Scientific/Engineering :: Mathematics",
              "Topic :: Scientific/Engineering :: Physics",
              "Topic :: Scientific/Engineering :: Visualization",
              "Topic :: Software Development :: Libraries",
              ],

          packages=["meshpy"],
          setup_requires=["pybind11"],
          python_requires="~=3.6",
          install_requires=[
                  "pytools>=2011.2",
                  "pytest>=2",
                  "numpy",
                  "gmsh_interop",
                  ],
          ext_modules=[
              Extension(
                  "meshpy._internals",
                  [
                      "src/cpp/wrapper.cpp",

                      "src/cpp/wrap_triangle.cpp",
                      "src/cpp/triangle.cpp",

                      "src/cpp/wrap_tetgen.cpp",
                      "src/cpp/tetgen.cpp",
                      "src/cpp/predicates.cpp",
                      ],
                  include_dirs=include_dirs,
                  define_macros=triangle_macros + tetgen_macros,
                  extra_compile_args=conf["CXXFLAGS"],
                  extra_link_args=conf["LDFLAGS"],
                  ),
              ],
          cmdclass={"build_ext": PybindBuildExtCommand},
          zip_safe=False,
          )
Ejemplo n.º 5
0
def main():
    import glob
    from aksetup_helper import (hack_distutils, get_config, setup, Extension,
                                set_up_shipped_boost_if_requested)

    hack_distutils()
    conf = get_config(get_config_schema(), warn_about_no_config=False)

    EXTRA_OBJECTS, EXTRA_DEFINES = \
            set_up_shipped_boost_if_requested("pymetis", conf)

    INCLUDE_DIRS = conf["BOOST_INC_DIR"]  # noqa
    LIBRARY_DIRS = conf["BOOST_LIB_DIR"]  # noqa
    LIBRARIES = conf["BOOST_PYTHON_LIBNAME"]  # noqa

    EXTRA_DEFINES["HAVE_MREMAP"] = 0  # mremap() buggy on amd64?

    ver_filename = "pymetis/version.py"
    version_file = open(ver_filename)
    ver_dic = {}
    try:
        version_file_contents = version_file.read()
    finally:
        version_file.close()
    exec(compile(version_file_contents, ver_filename, 'exec'), ver_dic)

    setup(
        name="PyMetis",
        version=ver_dic["version"],
        description="A Graph Partitioning Package",
        long_description=open("README.rst", "rt").read(),
        author="Andreas Kloeckner",
        author_email="*****@*****.**",
        license="wrapper: MIT/METIS: Apache 2",
        url="http://mathema.tician.de/software/pymetis",
        classifiers=[
            'Development Status :: 4 - Beta',
            'Intended Audience :: Developers',
            'Intended Audience :: Other Audience',
            'Intended Audience :: Science/Research',
            'License :: OSI Approved :: MIT License',
            'License :: Free for non-commercial use',
            'Natural Language :: English',
            'Programming Language :: C',
            'Programming Language :: C++',
            'Programming Language :: Python',
            'Programming Language :: Python :: 2',
            'Programming Language :: Python :: 2.6',
            'Programming Language :: Python :: 2.7',
            'Programming Language :: Python :: 3',
            'Programming Language :: Python :: 3.3',
            'Programming Language :: Python :: 3.4',
            'Topic :: Multimedia :: Graphics :: 3D Modeling',
            'Topic :: Scientific/Engineering',
            'Topic :: Scientific/Engineering :: Mathematics',
            'Topic :: Scientific/Engineering :: Visualization',
            'Topic :: Software Development :: Libraries',
        ],
        packages=["pymetis"],
        install_requires=["six"],
        ext_modules=[
            Extension(
                "pymetis._internal",
                glob.glob("src/metis/GKlib/*.c") + glob.glob("src/metis/*.c") +
                glob.glob("src/metis/libmetis/*.c") +
                ["src/wrapper/wrapper.cpp"] + EXTRA_OBJECTS,
                define_macros=list(EXTRA_DEFINES.items()),
                include_dirs=["src/metis/GKlib"] + ["src/metis/include"] +
                ["src/metis/libmetis"] + INCLUDE_DIRS,
                library_dirs=LIBRARY_DIRS,
                libraries=LIBRARIES,
                extra_compile_args=conf["CXXFLAGS"],
            ),
        ])
Ejemplo n.º 6
0
def main():
    from aksetup_helper import (hack_distutils,
            get_config, setup, Extension, set_up_shipped_boost_if_requested,
            check_git_submodules)

    check_git_submodules()

    hack_distutils(what_opt=1)
    conf = get_config(get_config_schema())

    TRI_EXTRA_OBJECTS, TRI_EXTRA_DEFINES = \
            set_up_shipped_boost_if_requested("meshpy", conf)
    TET_EXTRA_OBJECTS, TET_EXTRA_DEFINES = TRI_EXTRA_OBJECTS, TRI_EXTRA_DEFINES

    triangle_macros = [
            ("EXTERNAL_TEST", 1),
            ("ANSI_DECLARATORS", 1),
            ("TRILIBRARY", 1),
            ] + list(TRI_EXTRA_DEFINES.items())

    tetgen_macros = [
            ("TETLIBRARY", 1),
            ("SELF_CHECK", 1),
            ] + list(TET_EXTRA_DEFINES.items())

    # }}}

    include_dirs = conf["BOOST_INC_DIR"] + ["src/cpp"]
    library_dirs = conf["BOOST_LIB_DIR"]
    libraries = conf["BOOST_PYTHON_LIBNAME"]

    init_filename = "meshpy/__init__.py"
    exec(compile(open(init_filename, "r").read(), init_filename, "exec"), conf)

    import codecs
    setup(name="MeshPy",
          version=conf["version"],
          description="Triangular and Tetrahedral Mesh Generator",
          long_description=codecs.open("README.rst", "r", "utf-8").read(),
          author="Andreas Kloeckner",
          author_email="*****@*****.**",
          license=("MIT for the wrapper/non-commercial for "
              "the Triangle/GNU Affero Public License for TetGen"),
          url="http://mathema.tician.de/software/meshpy",
          classifiers=[
              'Development Status :: 4 - Beta',
              'Intended Audience :: Developers',
              'Intended Audience :: Other Audience',
              'Intended Audience :: Science/Research',
              'License :: OSI Approved :: MIT License',
              'License :: Free for non-commercial use',
              'Natural Language :: English',
              'Programming Language :: C++',
              'Programming Language :: Python',
              'Programming Language :: Python :: 2.6',
              'Programming Language :: Python :: 2.7',
              'Programming Language :: Python :: 3',
              'Programming Language :: Python :: 3.2',
              'Programming Language :: Python :: 3.3',
              'Programming Language :: Python :: 3.4',
              'Topic :: Multimedia :: Graphics :: 3D Modeling',
              'Topic :: Scientific/Engineering',
              'Topic :: Scientific/Engineering :: Mathematics',
              'Topic :: Scientific/Engineering :: Physics',
              'Topic :: Scientific/Engineering :: Visualization',
              'Topic :: Software Development :: Libraries',
              ],

          packages=["meshpy"],
          install_requires=[
                  "pytools>=2011.2",
                  "pytest>=2",
                  "numpy",
                  "six",
                  ],
          ext_modules=[
              Extension(
                  "meshpy._triangle",
                  ["src/cpp/wrap_triangle.cpp", "src/cpp/triangle.c"]
                  + TRI_EXTRA_OBJECTS,
                  include_dirs=include_dirs,
                  library_dirs=library_dirs,
                  libraries=libraries,
                  define_macros=triangle_macros,
                  extra_compile_args=conf["CXXFLAGS"],
                  extra_link_args=conf["LDFLAGS"],
                  ),
              Extension(
                  "meshpy._tetgen",
                  [
                      "src/cpp/tetgen.cpp",
                      "src/cpp/predicates.cpp",
                      "src/cpp/wrap_tetgen.cpp"]
                  + TET_EXTRA_OBJECTS,
                  include_dirs=include_dirs,
                  library_dirs=library_dirs,
                  libraries=libraries,
                  define_macros=tetgen_macros,
                  extra_compile_args=conf["CXXFLAGS"],
                  extra_link_args=conf["LDFLAGS"],
                  ),
              ])
Ejemplo n.º 7
0
def main():
    from aksetup_helper import (hack_distutils, get_config, setup, Extension,
                                set_up_shipped_boost_if_requested,
                                check_git_submodules)

    check_git_submodules()

    hack_distutils(what_opt=1)
    conf = get_config(get_config_schema())

    TRI_EXTRA_OBJECTS, TRI_EXTRA_DEFINES = \
            set_up_shipped_boost_if_requested("meshpy", conf)
    TET_EXTRA_OBJECTS, TET_EXTRA_DEFINES = TRI_EXTRA_OBJECTS, TRI_EXTRA_DEFINES

    triangle_macros = [
        ("EXTERNAL_TEST", 1),
        ("ANSI_DECLARATORS", 1),
        ("TRILIBRARY", 1),
    ] + list(TRI_EXTRA_DEFINES.items())

    tetgen_macros = [
        ("TETLIBRARY", 1),
        ("SELF_CHECK", 1),
    ] + list(TET_EXTRA_DEFINES.items())

    INCLUDE_DIRS = conf["BOOST_INC_DIR"] + ["src/cpp"]
    LIBRARY_DIRS = conf["BOOST_LIB_DIR"]
    LIBRARIES = conf["BOOST_PYTHON_LIBNAME"]

    ######## simple use CMAKE to find get the directories:

    boost_variables = ["VERSION", "INCLUDE_DIRS", "LIB_DIRS", "LIBRARIES"]
    boost_dict = {}
    if sys.version_info.major < 3:
        output = os.popen("cmake . -Dpy_version=2")
    else:
        output = os.popen("cmake .")

    for line in output:
        for var in boost_variables:
            if var in line:
                line = line.replace('-- ' + var,
                                    '').replace(': ', '').replace('\n', '')
                boost_dict[var] = line
    if not "VERSION" in boost_dict:
        print("CMake didn't find any boost library")
        print("default installation will be used instead.")
    else:
        print("use cmake to detect bost")
        lib_name = os.path.basename(boost_dict["LIBRARIES"])
        lib_name = lib_name.replace(".lib", "").replace("lib",
                                                        "").replace(".so", "")
        INCLUDE_DIRS = [boost_dict["INCLUDE_DIRS"]] + ["src/cpp"]
        LIBRARY_DIRS = [boost_dict["LIB_DIRS"]]
        LIBRARIES = [lib_name]
    ########## end of CMAKE configuration

    print("using the following configuration:")
    print("INCLUDE_DIRS: ", INCLUDE_DIRS)
    print("LIBRARY_DIRS: ", LIBRARY_DIRS)
    print("LIBRARIES: ", LIBRARIES)

    init_filename = "meshpy/__init__.py"
    exec(compile(open(init_filename, "r").read(), init_filename, "exec"), conf)

    import codecs
    setup(
        name="MeshPy",
        version=conf["version"],
        description="Triangular and Tetrahedral Mesh Generator",
        long_description=codecs.open("README.rst", "r", "utf-8").read(),
        author="Andreas Kloeckner",
        author_email="*****@*****.**",
        license=
        "MIT for the wrapper/non-commercial for the Triangle/GNU Affero Public License for TetGen",
        url="http://mathema.tician.de/software/meshpy",
        classifiers=[
            'Development Status :: 4 - Beta',
            'Intended Audience :: Developers',
            'Intended Audience :: Other Audience',
            'Intended Audience :: Science/Research',
            'License :: OSI Approved :: MIT License',
            'License :: Free for non-commercial use',
            'Natural Language :: English',
            'Programming Language :: C++',
            'Programming Language :: Python',
            'Programming Language :: Python :: 2.6',
            'Programming Language :: Python :: 2.7',
            'Programming Language :: Python :: 3',
            'Programming Language :: Python :: 3.2',
            'Programming Language :: Python :: 3.3',
            'Programming Language :: Python :: 3.4',
            'Topic :: Multimedia :: Graphics :: 3D Modeling',
            'Topic :: Scientific/Engineering',
            'Topic :: Scientific/Engineering :: Mathematics',
            'Topic :: Scientific/Engineering :: Physics',
            'Topic :: Scientific/Engineering :: Visualization',
            'Topic :: Software Development :: Libraries',
        ],
        packages=["meshpy"],
        install_requires=[
            "pytools>=2011.2",
            "pytest>=2",
            "numpy",
            "six",
        ],
        ext_modules=[
            Extension(
                "meshpy._triangle",
                ["src/cpp/wrap_triangle.cpp", "src/cpp/triangle.c"] +
                TRI_EXTRA_OBJECTS,
                include_dirs=INCLUDE_DIRS,
                library_dirs=LIBRARY_DIRS,
                libraries=LIBRARIES,
                define_macros=triangle_macros,
                extra_compile_args=conf["CXXFLAGS"],
                extra_link_args=conf["LDFLAGS"],
            ),
            Extension(
                "meshpy._tetgen",
                [
                    "src/cpp/tetgen.cpp", "src/cpp/predicates.cpp",
                    "src/cpp/wrap_tetgen.cpp"
                ] + TET_EXTRA_OBJECTS,
                include_dirs=INCLUDE_DIRS,
                library_dirs=LIBRARY_DIRS,
                libraries=LIBRARIES,
                define_macros=tetgen_macros,
                extra_compile_args=conf["CXXFLAGS"],
                extra_link_args=conf["LDFLAGS"],
            ),
        ])
Ejemplo n.º 8
0
def main():
    import glob
    from setuptools import find_packages
    from aksetup_helper import (check_pybind11, hack_distutils, get_config,
                                setup, Extension, get_pybind_include,
                                PybindBuildExtCommand)
    from setuptools.command.build_clib import build_clib

    check_pybind11()

    hack_distutils()
    conf = get_config(get_config_schema(), warn_about_no_config=False)

    extra_defines = {}

    extra_defines["HAVE_MREMAP"] = 0  # mremap() buggy on amd64?

    ver_filename = "pymetis/version.py"
    version_file = open(ver_filename)
    ver_dic = {}
    try:
        version_file_contents = version_file.read()
    finally:
        version_file.close()
    exec(compile(version_file_contents, ver_filename, 'exec'), ver_dic)

    setup(name="PyMetis",
          version=ver_dic["version"],
          description="A Graph Partitioning Package",
          long_description=open("README.rst", "rt").read(),
          author="Andreas Kloeckner",
          author_email="*****@*****.**",
          license="wrapper: MIT/METIS: Apache 2",
          url="http://mathema.tician.de/software/pymetis",
          classifiers=[
              'Development Status :: 4 - Beta',
              'Intended Audience :: Developers',
              'Intended Audience :: Other Audience',
              'Intended Audience :: Science/Research',
              'License :: OSI Approved :: MIT License',
              'License :: Free for non-commercial use',
              'Natural Language :: English',
              'Programming Language :: C',
              'Programming Language :: C++',
              'Programming Language :: Python',
              'Programming Language :: Python :: 3',
              'Topic :: Multimedia :: Graphics :: 3D Modeling',
              'Topic :: Scientific/Engineering',
              'Topic :: Scientific/Engineering :: Mathematics',
              'Topic :: Scientific/Engineering :: Visualization',
              'Topic :: Software Development :: Libraries',
          ],
          packages=find_packages(),
          setup_requires=[
              "pybind11",
          ],
          install_requires=["six"],
          ext_modules=[
              Extension(
                  "pymetis._internal",
                  (["src/wrapper/wrapper.cpp"] +
                   glob.glob("src/metis/GKlib/*.c") +
                   glob.glob("src/metis/*.c") +
                   glob.glob("src/metis/libmetis/*.c")),
                  define_macros=list(extra_defines.items()),
                  include_dirs=[
                      "src/metis/include", "src/metis/GKlib",
                      "src/metis/include", "src/metis/libmetis",
                      get_pybind_include(),
                      get_pybind_include(user=True)
                  ],
                  extra_compile_args=conf["CXXFLAGS"],
              ),
          ],
          cmdclass={
              'build_clib': build_clib,
              'build_ext': PybindBuildExtCommand
          },
          zip_safe=False)
Ejemplo n.º 9
0
def main():
    check_pybind11()
    check_git_submodules()

    conf = get_config(get_config_schema(), warn_about_no_config=False)

    CXXFLAGS = conf["CXXFLAGS"]  # noqa: N806

    EXTRA_OBJECTS = []  # noqa: N806
    EXTRA_DEFINES = {}  # noqa: N806

    INCLUDE_DIRS = ["src/wrapper"]  # noqa: N806
    LIBRARY_DIRS = []  # noqa: N806
    LIBRARIES = []  # noqa: N806

    if conf["USE_SHIPPED_ISL"]:
        from glob import glob
        isl_blacklist = [
            "_templ.c",
            "_templ_yaml.c",
            "mp_get",
            "extract_key.c",
            "isl_multi_templ.c",
            "isl_multi_apply_set.c",
            "isl_multi_gist.c",
            "isl_multi_coalesce.c",
            "isl_multi_intersect.c",
            "isl_multi_floor.c",
            "isl_multi_apply_union_set.c",
            "isl_multi_cmp.c",
            "isl_multi_pw_aff_explicit_domain.c",
            "isl_multi_hash.c",
            "isl_multi_dims.c",
            "isl_multi_explicit_domain.c",
            "isl_multi_no_explicit_domain.c",
            "isl_multi_align_set.c",
            "isl_multi_align_union_set.c",
            "isl_multi_union_pw_aff_explicit_domain.c",
            "isl_union_templ.c",
            "isl_union_multi.c",
            "isl_union_eval.c",
            "isl_union_neg.c",
            "isl_union_single.c",
            "isl_pw_hash.c",
            "isl_pw_eval.c",
            "isl_pw_union_opt.c",
            "isl_pw_union_opt.c",
        ]

        for fn in glob("isl/*.c"):
            blacklisted = False
            for bl in isl_blacklist:
                if bl in fn:
                    blacklisted = True
                    break

            if "no_piplib" in fn:
                pass
            elif "piplib" in fn:
                blacklisted = True

            if "gmp" in fn:
                if conf["USE_SHIPPED_IMATH"]:
                    continue
            if "imath" in fn:
                if not conf["USE_SHIPPED_IMATH"]:
                    continue

                if "sioimath" in fn and not conf["USE_IMATH_SIO"]:
                    continue
                if "isl_val_imath" in fn and conf["USE_IMATH_SIO"]:
                    continue

            if "isl_ast_int.c" in fn and conf["USE_SHIPPED_IMATH"]:
                continue

            inf = open(fn, "r", encoding="utf-8")
            try:
                contents = inf.read()
            finally:
                inf.close()

            if "int main(" not in contents and not blacklisted:
                EXTRA_OBJECTS.append(fn)

        conf["ISL_INC_DIR"] = ["isl-supplementary", "isl/include", "isl"]

        if conf["USE_SHIPPED_IMATH"]:
            EXTRA_OBJECTS.extend([
                "isl/imath/imath.c",
                "isl/imath/imrat.c",
                "isl/imath/gmp_compat.c",
                #"isl/imath_wrap/imath.c",
                #"isl/imath_wrap/imrat.c",
                #"isl/imath_wrap/gmp_compat.c",
            ])
            EXTRA_DEFINES["USE_IMATH_FOR_MP"] = 1
            if conf["USE_IMATH_SIO"]:
                EXTRA_DEFINES["USE_SMALL_INT_OPT"] = 1

            conf["ISL_INC_DIR"].append("isl/imath")
        else:
            EXTRA_DEFINES["USE_GMP_FOR_MP"] = 1

    else:
        LIBRARY_DIRS.extend(conf["ISL_LIB_DIR"])
        LIBRARIES.extend(conf["ISL_LIBNAME"])

    wrapper_dirs = conf["ISL_INC_DIR"][:]

    # {{{ configure barvinok

    if conf["USE_BARVINOK"]:
        if conf["USE_SHIPPED_ISL"]:
            raise RuntimeError("barvinok wrapper is not compatible with using "
                               "shipped isl")
        if conf["USE_SHIPPED_IMATH"]:
            raise RuntimeError("barvinok wrapper is not compatible with using "
                               "shipped imath")

        INCLUDE_DIRS.extend(conf["BARVINOK_INC_DIR"])
        LIBRARY_DIRS.extend(conf["BARVINOK_LIB_DIR"])
        LIBRARIES.extend(conf["BARVINOK_LIBNAME"])

        wrapper_dirs.extend(conf["BARVINOK_INC_DIR"])

        EXTRA_DEFINES["ISLPY_INCLUDE_BARVINOK"] = 1

    # }}}

    INCLUDE_DIRS.extend(conf["ISL_INC_DIR"])

    if not (conf["USE_SHIPPED_ISL"] and conf["USE_SHIPPED_IMATH"]) and \
            conf["USE_GMP"]:
        INCLUDE_DIRS.extend(conf["GMP_INC_DIR"])
        LIBRARY_DIRS.extend(conf["GMP_LIB_DIR"])
        LIBRARIES.extend(conf["GMP_LIBNAME"])

    init_filename = "islpy/version.py"
    with open(init_filename, "r") as version_f:
        version_py = version_f.read()
    exec(compile(version_py, init_filename, "exec"), conf)

    from gen_wrap import gen_wrapper
    gen_wrapper(wrapper_dirs, include_barvinok=conf["USE_BARVINOK"])

    with open("README.rst", "rt") as readme_f:
        readme = readme_f.read()

    setup(
        name="islpy",
        version=conf["VERSION_TEXT"],
        description="Wrapper around isl, an integer set library",
        long_description=readme,
        author="Andreas Kloeckner",
        author_email="*****@*****.**",
        license="MIT",
        url="http://documen.tician.de/islpy",
        classifiers=[
            "Development Status :: 4 - Beta",
            "Intended Audience :: Developers",
            "Intended Audience :: Other Audience",
            "Intended Audience :: Science/Research",
            "License :: OSI Approved :: MIT License",
            "Natural Language :: English",
            "Programming Language :: C++",
            "Programming Language :: Python",
            "Programming Language :: Python :: 3",
            "Topic :: Multimedia :: Graphics :: 3D Modeling",
            "Topic :: Scientific/Engineering",
            "Topic :: Scientific/Engineering :: Mathematics",
            "Topic :: Scientific/Engineering :: Physics",
            "Topic :: Scientific/Engineering :: Visualization",
            "Topic :: Software Development :: Libraries",
        ],
        packages=["islpy"],
        python_requires="~=3.6",
        setup_requires=[
            "pybind11",
        ],
        install_requires=[
            "pytest>=2",
            # "Mako>=0.3.6",
            "six",
        ],
        ext_modules=[
            Extension(
                "islpy._isl",
                [
                    "src/wrapper/wrap_isl.cpp",
                    "src/wrapper/wrap_isl_part1.cpp",
                    "src/wrapper/wrap_isl_part2.cpp",
                    "src/wrapper/wrap_isl_part3.cpp",
                ] + EXTRA_OBJECTS,
                include_dirs=INCLUDE_DIRS +
                [get_pybind_include(),
                 get_pybind_include(user=True)],
                library_dirs=LIBRARY_DIRS,
                libraries=LIBRARIES,
                define_macros=list(EXTRA_DEFINES.items()),
                extra_compile_args=CXXFLAGS,
                extra_link_args=conf["LDFLAGS"],
            ),
        ],
        cmdclass={"build_ext": IslPyBuildExtCommand},
    )