@@ -31,7 +31,7 @@ def version_from_scm(root):
3131 config = Configuration ()
3232 config .root = root
3333 # TODO: Is it API?
34- return _version_from_entrypoint (config , "setuptools_scm.parse_scm" )
34+ return _version_from_entrypoints (config )
3535
3636
3737def _call_entrypoint_fn (root , config , fn ):
@@ -47,11 +47,12 @@ def _call_entrypoint_fn(root, config, fn):
4747 return fn (root )
4848
4949
50- def _version_from_entrypoint (config , entrypoint , fallback = False ):
50+ def _version_from_entrypoints (config , fallback = False ):
5151 if fallback :
52- entrypoint + = "_fallback "
52+ entrypoint = "setuptools_scm.parse_scm_fallback "
5353 root = config .fallback_root
5454 else :
55+ entrypoint = "setuptools_scm.parse_scm"
5556 root = config .absolute_root
5657 for ep in iter_matching_entrypoints (root , entrypoint ):
5758 version = _call_entrypoint_fn (root , config , ep .load ())
@@ -91,16 +92,10 @@ def _do_parse(config):
9192 raise TypeError (
9293 "version parse result was a string\n please return a parsed version"
9394 )
94- version = parse_result or _version_from_entrypoint (
95- config , "setuptools_scm.parse_scm" , fallback = True
96- )
95+ version = parse_result or _version_from_entrypoints (config , fallback = True )
9796 else :
9897 # include fallbacks after dropping them from the main entrypoint
99- version = _version_from_entrypoint (
100- config , "setuptools_scm.parse_scm"
101- ) or _version_from_entrypoint (
102- config , "setuptools_scm.parse_scm" , fallback = True
103- )
98+ version = _version_from_entrypoints (config ) or _version_from_entrypoints (config , fallback = True )
10499
105100 if version :
106101 return version
@@ -126,6 +121,7 @@ def get_version(
126121 relative_to = None ,
127122 tag_regex = None ,
128123 fallback_version = None ,
124+ fallback_root = "." ,
129125 parse = None ,
130126 git_describe_command = None ,
131127):
@@ -138,6 +134,7 @@ def get_version(
138134
139135 config = Configuration ()
140136 config .root = root
137+ config .fallback_root = fallback_root
141138 config .version_scheme = version_scheme
142139 config .local_scheme = local_scheme
143140 config .write_to = write_to
0 commit comments