setup.py 1.18 KB
Newer Older
1
2
3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
Tim Dettmers's avatar
Tim Dettmers committed
4
# LICENSE file in the root directory of this source tree.
5
6
7
from distutils.errors import DistutilsModuleError
from warnings import warn

8
from setuptools import find_packages, setup
9
from setuptools.command.build_py import build_py
10
from setuptools.dist import Distribution
11

12

13
14
15
16
17
18
# Tested with wheel v0.29.0
class BinaryDistribution(Distribution):
    def has_ext_modules(self):
        return True


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class ExtBuildPy(build_py):
    def run(self):
        # build_cmake needs to be called prior to build_py, as the latter
        # collects the files output into the package directory.
        try:
            self.run_command("build_cmake")
        except DistutilsModuleError:
            warn(
                "scikit-build-core not installed, CMake will not be invoked automatically. "
                "Please install scikit-build-core or run CMake manually to build extensions."
            )
        super().run()


setup(
Matthew Douglas's avatar
Matthew Douglas committed
34
    version="0.48.0.dev0",
35
36
37
38
39
40
41
    packages=find_packages(),
    distclass=BinaryDistribution,
    cmake_source_dir=".",
    cmdclass={
        "build_py": ExtBuildPy,
    },
)