Hide keyboard shortcuts

Hot-keys 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

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 

12from setuptools import setup 

13from setuptools_cpp import ExtensionBuilder, Pybind11Extension 

14import os 

15import glob 

16 

17# Importing this automatically enables parallelized builds 

18import numpy.distutils.ccompiler # noqa: F401 

19 

20# Currently a fake version for testing 

21version = '0.0.1' 

22 

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

24# same location 

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

26 print(f""" 

27__all__ = ("__version__", ) 

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

29 

30 

31# read the contents of the README file 

32this_directory = os.path.abspath(os.path.dirname(__file__)) 

33with open(os.path.join(this_directory, "README.md"), encoding='utf-8') as f: 

34 long_description = f.read() 

35 

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

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

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

39 

40# Very inefficient approach since this compiles the maing sphgeom 

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

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

43 sorted(cpp_src + pybind_src), 

44 include_dirs=["include"])] 

45 

46setup( 

47 version=version, 

48 long_description=long_description, 

49 ext_modules=ext_modules, 

50 long_description_content_type="text/markdown", 

51 cmdclass={'build_ext': ExtensionBuilder}, 

52)