Blame external/pybind11/setup.py

Packit 534379
#!/usr/bin/env python
Packit 534379
Packit 534379
# Setup script for PyPI; use CMakeFile.txt to build extension modules
Packit 534379
Packit 534379
from setuptools import setup
Packit 534379
from distutils.command.install_headers import install_headers
Packit 534379
from pybind11 import __version__
Packit 534379
import os
Packit 534379
Packit 534379
# Prevent installation of pybind11 headers by setting
Packit 534379
# PYBIND11_USE_CMAKE.
Packit 534379
if os.environ.get('PYBIND11_USE_CMAKE'):
Packit 534379
    headers = []
Packit 534379
else:
Packit 534379
    headers = [
Packit 534379
        'include/pybind11/detail/class.h',
Packit 534379
        'include/pybind11/detail/common.h',
Packit 534379
        'include/pybind11/detail/descr.h',
Packit 534379
        'include/pybind11/detail/init.h',
Packit 534379
        'include/pybind11/detail/internals.h',
Packit 534379
        'include/pybind11/detail/typeid.h',
Packit 534379
        'include/pybind11/attr.h',
Packit 534379
        'include/pybind11/buffer_info.h',
Packit 534379
        'include/pybind11/cast.h',
Packit 534379
        'include/pybind11/chrono.h',
Packit 534379
        'include/pybind11/common.h',
Packit 534379
        'include/pybind11/complex.h',
Packit 534379
        'include/pybind11/eigen.h',
Packit 534379
        'include/pybind11/embed.h',
Packit 534379
        'include/pybind11/eval.h',
Packit 534379
        'include/pybind11/functional.h',
Packit 534379
        'include/pybind11/iostream.h',
Packit 534379
        'include/pybind11/numpy.h',
Packit 534379
        'include/pybind11/operators.h',
Packit 534379
        'include/pybind11/options.h',
Packit 534379
        'include/pybind11/pybind11.h',
Packit 534379
        'include/pybind11/pytypes.h',
Packit 534379
        'include/pybind11/stl.h',
Packit 534379
        'include/pybind11/stl_bind.h',
Packit 534379
    ]
Packit 534379
Packit 534379
Packit 534379
class InstallHeaders(install_headers):
Packit 534379
    """Use custom header installer because the default one flattens subdirectories"""
Packit 534379
    def run(self):
Packit 534379
        if not self.distribution.headers:
Packit 534379
            return
Packit 534379
Packit 534379
        for header in self.distribution.headers:
Packit 534379
            subdir = os.path.dirname(os.path.relpath(header, 'include/pybind11'))
Packit 534379
            install_dir = os.path.join(self.install_dir, subdir)
Packit 534379
            self.mkpath(install_dir)
Packit 534379
Packit 534379
            (out, _) = self.copy_file(header, install_dir)
Packit 534379
            self.outfiles.append(out)
Packit 534379
Packit 534379
Packit 534379
setup(
Packit 534379
    name='pybind11',
Packit 534379
    version=__version__,
Packit 534379
    description='Seamless operability between C++11 and Python',
Packit 534379
    author='Wenzel Jakob',
Packit 534379
    author_email='wenzel.jakob@epfl.ch',
Packit 534379
    url='https://github.com/pybind/pybind11',
Packit 534379
    download_url='https://github.com/pybind/pybind11/tarball/v' + __version__,
Packit 534379
    packages=['pybind11'],
Packit 534379
    license='BSD',
Packit 534379
    headers=headers,
Packit 534379
    cmdclass=dict(install_headers=InstallHeaders),
Packit 534379
    classifiers=[
Packit 534379
        'Development Status :: 5 - Production/Stable',
Packit 534379
        'Intended Audience :: Developers',
Packit 534379
        'Topic :: Software Development :: Libraries :: Python Modules',
Packit 534379
        'Topic :: Utilities',
Packit 534379
        'Programming Language :: C++',
Packit 534379
        'Programming Language :: Python :: 2.7',
Packit 534379
        'Programming Language :: Python :: 3',
Packit 534379
        'Programming Language :: Python :: 3.2',
Packit 534379
        'Programming Language :: Python :: 3.3',
Packit 534379
        'Programming Language :: Python :: 3.4',
Packit 534379
        'Programming Language :: Python :: 3.5',
Packit 534379
        'Programming Language :: Python :: 3.6',
Packit 534379
        'License :: OSI Approved :: BSD License'
Packit 534379
    ],
Packit 534379
    keywords='C++11, Python bindings',
Packit 534379
    long_description="""pybind11 is a lightweight header-only library that
Packit 534379
exposes C++ types in Python and vice versa, mainly to create Python bindings of
Packit 534379
existing C++ code. Its goals and syntax are similar to the excellent
Packit 534379
Boost.Python by David Abrahams: to minimize boilerplate code in traditional
Packit 534379
extension modules by inferring type information using compile-time
Packit 534379
introspection.
Packit 534379
Packit 534379
The main issue with Boost.Python-and the reason for creating such a similar
Packit 534379
project-is Boost. Boost is an enormously large and complex suite of utility
Packit 534379
libraries that works with almost every C++ compiler in existence. This
Packit 534379
compatibility has its cost: arcane template tricks and workarounds are
Packit 534379
necessary to support the oldest and buggiest of compiler specimens. Now that
Packit 534379
C++11-compatible compilers are widely available, this heavy machinery has
Packit 534379
become an excessively large and unnecessary dependency.
Packit 534379
Packit 534379
Think of this library as a tiny self-contained version of Boost.Python with
Packit 534379
everything stripped away that isn't relevant for binding generation. Without
Packit 534379
comments, the core header files only require ~4K lines of code and depend on
Packit 534379
Python (2.7 or 3.x, or PyPy2.7 >= 5.7) and the C++ standard library. This
Packit 534379
compact implementation was possible thanks to some of the new C++11 language
Packit 534379
features (specifically: tuples, lambda functions and variadic templates). Since
Packit 534379
its creation, this library has grown beyond Boost.Python in many ways, leading
Packit 534379
to dramatically simpler binding code in many common situations.""")