File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 1
1
from pkg_resources import iter_entry_points
2
2
3
3
from .version import _warn_if_setuptools_outdated
4
- from .config import Configuration
5
4
from .utils import do , trace_exception
6
- from . import get_version , _get_version
5
+ from . import get_version
7
6
8
7
9
8
def version_keyword (dist , keyword , value ):
@@ -31,9 +30,19 @@ def find_files(path=""):
31
30
return []
32
31
33
32
33
+ def _args_from_toml (name = "pyproject.toml" ):
34
+ # todo: more sensible config initialization
35
+ # move this elper back to config and unify it with the code from get_config
36
+
37
+ with open (name ) as strm :
38
+ defn = __import__ ("toml" ).load (strm )
39
+ return defn .get ("tool" , {})["setuptools_scm" ]
40
+
41
+
34
42
def infer_version (dist ):
43
+
35
44
try :
36
- config = Configuration . from_file ()
45
+ args = _args_from_toml ()
37
46
except Exception :
38
47
return trace_exception ()
39
- dist .metadata .version = _get_version ( config )
48
+ dist .metadata .version = get_version ( ** args )
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ def wd(wd):
16
16
17
17
18
18
def test_pyproject_support (tmpdir , monkeypatch ):
19
+ pytest .importorskip ("toml" )
19
20
monkeypatch .delenv ("SETUPTOOLS_SCM_DEBUG" )
20
21
pkg = tmpdir .ensure ("package" , dir = 42 )
21
22
pkg .join ("pyproject.toml" ).write (
@@ -28,7 +29,6 @@ def test_pyproject_support(tmpdir, monkeypatch):
28
29
assert res == "12.34"
29
30
30
31
31
- @pytest .mark .xfail (reason = "#174" )
32
32
def test_pyproject_support_with_git (tmpdir , monkeypatch , wd ):
33
33
monkeypatch .delenv ("SETUPTOOLS_SCM_DEBUG" )
34
34
pkg = tmpdir .join ("wd" )
You can’t perform that action at this time.
0 commit comments