Coverage for src/debputy/dh_migration/migrators.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.6.0, created at 2025-01-27 13:59 +0000

1from typing import Callable, List, Mapping, Protocol, Optional 

2 

3from debputy.commands.debputy_cmd.output import OutputStylingBase 

4from debputy.dh_migration.migrators_impl import ( 

5 migrate_links_files, 

6 migrate_maintscript, 

7 migrate_tmpfile, 

8 migrate_install_file, 

9 migrate_installdocs_file, 

10 migrate_installexamples_file, 

11 migrate_dh_hook_targets, 

12 migrate_misspelled_readme_debian_files, 

13 migrate_doc_base_files, 

14 migrate_lintian_overrides_files, 

15 detect_unsupported_zz_debputy_features, 

16 detect_pam_files, 

17 detect_dh_addons_with_zz_integration, 

18 migrate_not_installed_file, 

19 migrate_installman_file, 

20 migrate_bash_completion, 

21 migrate_installinfo_file, 

22 migrate_dh_installsystemd_files, 

23 detect_obsolete_substvars, 

24 detect_dh_addons_zz_debputy_rrr, 

25 detect_dh_addons_with_full_integration, 

26 migrate_shell_completions, 

27) 

28from debputy.dh_migration.models import AcceptableMigrationIssues, FeatureMigration 

29from debputy.highlevel_manifest import HighLevelManifest 

30from debputy.plugin.api import VirtualPath 

31from debputy.plugin.api.spec import ( 

32 DebputyIntegrationMode, 

33 INTEGRATION_MODE_DH_DEBPUTY_RRR, 

34 INTEGRATION_MODE_DH_DEBPUTY, 

35 INTEGRATION_MODE_FULL, 

36) 

37 

38Migrator = Callable[ 

39 [ 

40 VirtualPath, 

41 HighLevelManifest, 

42 AcceptableMigrationIssues, 

43 FeatureMigration, 

44 DebputyIntegrationMode, 

45 ], 

46 None, 

47] 

48 

49_DH_DEBPUTY_MIGRATORS = [ 

50 detect_unsupported_zz_debputy_features, 

51 detect_pam_files, 

52 migrate_dh_hook_targets, 

53 migrate_dh_installsystemd_files, 

54 migrate_install_file, 

55 migrate_installdocs_file, 

56 migrate_installexamples_file, 

57 migrate_installman_file, 

58 migrate_installinfo_file, 

59 migrate_misspelled_readme_debian_files, 

60 migrate_doc_base_files, 

61 migrate_links_files, 

62 migrate_maintscript, 

63 migrate_tmpfile, 

64 migrate_lintian_overrides_files, 

65 migrate_bash_completion, 

66 migrate_shell_completions, 

67 detect_obsolete_substvars, 

68 # not-installed should go last, so its rules appear after other installations 

69 # It is not perfect, but it is a start. 

70 migrate_not_installed_file, 

71] 

72 

73MIGRATORS: Mapping[DebputyIntegrationMode, List[Migrator]] = { 

74 INTEGRATION_MODE_DH_DEBPUTY_RRR: [ 

75 migrate_dh_hook_targets, 

76 migrate_misspelled_readme_debian_files, 

77 detect_dh_addons_zz_debputy_rrr, 

78 detect_obsolete_substvars, 

79 ], 

80 INTEGRATION_MODE_DH_DEBPUTY: [ 

81 *_DH_DEBPUTY_MIGRATORS, 

82 detect_dh_addons_with_zz_integration, 

83 ], 

84 INTEGRATION_MODE_FULL: [ 

85 *_DH_DEBPUTY_MIGRATORS, 

86 detect_dh_addons_with_full_integration, 

87 ], 

88} 

89del _DH_DEBPUTY_MIGRATORS