Coverage for setup.py: 0%

20 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-11-07 01:40 -0800

1# This file is part of scarlet_lite. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (https://www.lsst.org). 

6# See the COPYRIGHT file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

9# This program is free software: you can redistribute it and/or modify 

10# it under the terms of the GNU General Public License as published by 

11# the Free Software Foundation, either version 3 of the License, or 

12# (at your option) any later version. 

13# 

14# This program is distributed in the hope that it will be useful, 

15# but WITHOUT ANY WARRANTY; without even the implied warranty of 

16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

17# GNU General Public License for more details. 

18# 

19# You should have received a copy of the GNU General Public License 

20# along with this program. If not, see <https://www.gnu.org/licenses/>. 

21 

22# This uses the code at 

23# https://github.com/pybind/python_example/blob/master/setup.py 

24# as a template to integrate pybind11 

25 

26""" 

27Basic setuptools description. 

28This is not a complete definition. 

29* Version number is not correct. 

30* The shared library and include files are not installed. This makes it 

31 unusable with other python packages that directly reference the C++ 

32 interface. 

33""" 

34 

35import glob 

36import os 

37 

38# Importing this automatically enables parallelized builds 

39from pybind11.setup_helpers import Pybind11Extension, build_ext 

40from setuptools import setup 

41 

42eigen_path = None 

43if "EIGEN_DIR" in os.environ: 

44 eigen_path = os.environ["EIGEN_DIR"] 

45 

46 

47class GetEigenInclude(object): 

48 """Helper class to determine the peigen include path 

49 The purpose of this class is to postpone importing peigen 

50 until it is actually installed, so that the ``get_include()`` 

51 method can be invoked. 

52 """ 

53 

54 def __init__(self, user=False): 

55 self.user = user 

56 

57 def __str__(self): 

58 if "EIGEN_INCLUDE" in os.environ: 

59 return os.environ["EIGEN_INCLUDE"] 

60 if eigen_path is not None: 

61 return os.path.join(os.environ["EIGEN_DIR"], "include") 

62 else: 

63 import peigen 

64 

65 return peigen.header_path 

66 

67 

68# Find the source code -- we can combine it into a single module 

69pybind_src = sorted(glob.glob("python/lsst/scarlet/lite/*.cc")) 

70 

71ext_modules = [ 

72 Pybind11Extension("lsst.scarlet.lite.detect_pybind11", pybind_src, include_dirs=[GetEigenInclude()]), 

73 Pybind11Extension("lsst.scarlet.lite.operators_pybind11", pybind_src, include_dirs=[GetEigenInclude()]), 

74] 

75 

76setup( 

77 ext_modules=ext_modules, 

78 cmdclass={"build_ext": build_ext}, 

79)