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 11from pkg_resources import iter_entry_points
22
33from .version import _warn_if_setuptools_outdated
4- from .config import Configuration
54from .utils import do , trace_exception
6- from . import get_version , _get_version
5+ from . import get_version
76
87
98def version_keyword (dist , keyword , value ):
@@ -31,9 +30,19 @@ def find_files(path=""):
3130 return []
3231
3332
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+
3442def infer_version (dist ):
43+
3544 try :
36- config = Configuration . from_file ()
45+ args = _args_from_toml ()
3746 except Exception :
3847 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):
1616
1717
1818def test_pyproject_support (tmpdir , monkeypatch ):
19+ pytest .importorskip ("toml" )
1920 monkeypatch .delenv ("SETUPTOOLS_SCM_DEBUG" )
2021 pkg = tmpdir .ensure ("package" , dir = 42 )
2122 pkg .join ("pyproject.toml" ).write (
@@ -28,7 +29,6 @@ def test_pyproject_support(tmpdir, monkeypatch):
2829 assert res == "12.34"
2930
3031
31- @pytest .mark .xfail (reason = "#174" )
3232def test_pyproject_support_with_git (tmpdir , monkeypatch , wd ):
3333 monkeypatch .delenv ("SETUPTOOLS_SCM_DEBUG" )
3434 pkg = tmpdir .join ("wd" )
You can’t perform that action at this time.
0 commit comments