13
13
from importlib import import_module
14
14
from types import ModuleType
15
15
16
- from incremental import Version
16
+ from incremental import Version as IncrementalVersion
17
17
18
18
19
19
def _get_package (package_dir : str , package : str ) -> ModuleType :
@@ -50,8 +50,12 @@ def get_version(package_dir: str, package: str) -> str:
50
50
if isinstance (version , str ):
51
51
return version .strip ()
52
52
53
- if isinstance (version , Version ):
54
- return version .base ().strip ()
53
+ if isinstance (version , IncrementalVersion ):
54
+ # FIXME:https://github.com/twisted/incremental/issues/81
55
+ # Incremental uses `.rcN`.
56
+ # importlib uses `rcN` (without a dot separation).
57
+ # Here we make incremental work like importlib.
58
+ return version .base ().strip ().replace (".rc" , "rc" )
55
59
56
60
if isinstance (version , tuple ):
57
61
return "." .join (map (str , version )).strip ()
@@ -76,7 +80,7 @@ def get_project_name(package_dir: str, package: str) -> str:
76
80
if isinstance (version , str ):
77
81
return package .title ()
78
82
79
- if isinstance (version , Version ):
83
+ if isinstance (version , IncrementalVersion ):
80
84
# Incremental has support for package names
81
85
return version .package
82
86
0 commit comments