Coverage for setup.py: 0%

Shortcuts on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

11 statements  

1""" 

2Basic setuptools description. 

3 

4This is not a complete definition. 

5 

6* Version number is not correct. 

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

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

9 interface. 

10""" 

11 

12import glob 

13 

14# Importing this automatically enables parallelized builds 

15import numpy.distutils.ccompiler # noqa: F401 

16from setuptools import setup 

17from pybind11.setup_helpers import Pybind11Extension, build_ext 

18 

19# Currently a fake version for testing 

20version = '0.0.1' 

21 

22# To enable consistency with sconsUtils we write the version to the 

23# same location 

24with open("./python/lsst/sphgeom/version.py", "w") as f: 

25 print(f""" 

26__all__ = ("__version__", ) 

27__version__ = '{version}'""", file=f) 

28 

29 

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

31pybind_src = sorted(glob.glob("python/lsst/sphgeom/*.cc")) 

32cpp_src = sorted(glob.glob("src/*.cc")) 

33 

34# Very inefficient approach since this compiles the maing sphgeom 

35# library code for every extension rather than building everything once 

36ext_modules = [Pybind11Extension("lsst.sphgeom._sphgeom", 

37 sorted(cpp_src + pybind_src), 

38 include_dirs=["include"])] 

39 

40setup( 

41 version=version, 

42 ext_modules=ext_modules, 

43 cmdclass={'build_ext': build_ext}, 

44)