Coverage for pesummary/__init__.py: 46.5%

43 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-05-02 08:42 +0000

1# Licensed under an MIT style license -- see LICENSE.md 

2 

3from ._version_helper import ( 

4 get_version_information, GitInformation, PackageInformation, GitDummy 

5) 

6from pathlib import Path 

7 

8__author__ = ["Charlie Hoy <charlie.hoy@ligo.org>"] 

9 

10version, last_stable_release, git_hash, git_author = [""] * 4 

11git_status, git_builder, git_build_date = [""] * 3 

12 

13try: 

14 path = Path(__file__).parent 

15 with open(path / ".version", "r") as f: 

16 data = f.read() 

17 exec(data) 

18 __version__ = version 

19 __last_release__ = last_stable_release 

20 __short_version__ = __last_release__ 

21 __git_hash__ = git_hash 

22 __git_author__ = git_author 

23 __git_status__ = git_status 

24 __git_builder__ = git_builder 

25 __git_build_date__ = git_build_date 

26except Exception: 

27 try: 

28 git_info = GitInformation() 

29 except TypeError: 

30 try: 

31 from pesummary import _version 

32 import os 

33 cfg = _version.get_config() 

34 ff = _version.__file__ 

35 root = os.path.realpath(ff) 

36 for i in cfg.versionfile_source.split('/'): 

37 root = os.path.dirname(root) 

38 git_info = GitInformation(directory=root) 

39 except Exception: 

40 git_info = GitDummy() 

41 

42 __version__ = get_version_information() 

43 __short_version__ = get_version_information(short=True) 

44 __last_release__ = git_info.last_version 

45 __git_hash__ = git_info.hash 

46 __git_author__ = git_info.author 

47 __git_status__ = git_info.status 

48 __git_builder__ = git_info.builder 

49 __git_build_date__ = git_info.build_date 

50 

51__version_string__ = ( 

52 "# pesummary version information\n\n" 

53 "version = '%s'\nlast_stable_release = '%s'\n\ngit_hash = '%s'\n" 

54 "git_author = '%s'\ngit_status = '%s'\ngit_builder = '%s'\n" 

55 "git_build_date = '%s'\n\n" % ( 

56 __version__, __last_release__, __git_hash__, __git_author__, 

57 __git_status__, __git_builder__, __git_build_date__ 

58 ) 

59) 

60 

61__bilby_compatibility__ = "0.3.6"