Coverage for packages/pyswig/src/pyswig/__init__.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.14.3, created at 2026-06-26 21:05 +0000

1# Copyright (c) 2015-2020 Michel Gillet 

2# SPDX-License-Identifier: MIT 

3 

4"""PySwig — generate SWIG input files from annotated C/C++ headers.""" 

5 

6from __future__ import annotations 

7 

8from pathlib import Path 

9 

10__version__ = "0.4.0" 

11 

12from pyswig.binding_layout import ( 

13 BindingLayout, 

14 add_gen_dir_argument, 

15 parse_binding_layout, 

16 versioned_module_name, 

17) 

18from pyswig.exceptions import PySwigError 

19from pyswig.fileconfig import FileConfig 

20from pyswig.maininterfacefile import MainInterfaceFile 

21from pyswig.processsrcfile import ProcessSrcFile 

22from pyswig.pyswig import PySwig 

23from pyswig.swig import Swig 

24from pyswig.types import ( 

25 DefineRecord, 

26 ReplaceStringPair, 

27 SourceFileEntry, 

28 SourceFileSpec, 

29 TagRecord, 

30 normalize_source_entry, 

31) 

32 

33__all__ = [ 

34 "BindingLayout", 

35 "DefineRecord", 

36 "FileConfig", 

37 "MainInterfaceFile", 

38 "ProcessSrcFile", 

39 "PySwig", 

40 "PySwigError", 

41 "ReplaceStringPair", 

42 "SourceFileEntry", 

43 "SourceFileSpec", 

44 "Swig", 

45 "TagRecord", 

46 "__version__", 

47 "add_gen_dir_argument", 

48 "cmake_dir", 

49 "cmake_prefix_path", 

50 "normalize_source_entry", 

51 "parse_binding_layout", 

52 "versioned_module_name", 

53] 

54 

55 

56def cmake_dir() -> str: 

57 """Return the directory containing PySwig CMake modules.""" 

58 return str(Path(__file__).resolve().parent / "cmake") 

59 

60 

61def cmake_prefix_path() -> str: 

62 """Return CMAKE_PREFIX_PATH entry for find_package(Pyswig CONFIG).""" 

63 return str(Path(cmake_dir()) / "Pyswig")