diff options
author | Te-jé Rodgers <tjd.rodgers@gmail.com> | 2015-07-20 13:54:27 -0400 |
---|---|---|
committer | Te-jé Rodgers <tjd.rodgers@gmail.com> | 2015-07-20 13:54:27 -0400 |
commit | 95ad537a8e595700a4d1964c4b1c2d8ce8aeb38c (patch) | |
tree | 639a2016168c218690f86b0cd35937c4e02d681b | |
parent | 389811c25ed5f4c8e8d24178aaaae189a79b4e94 (diff) | |
download | setuptools-scm-95ad537a8e595700a4d1964c4b1c2d8ce8aeb38c.tar.gz |
Error in 'dump_version' now correctly raised
This error occurred because the function wasn't correctly extracting the
file extension from a filename while trying to raise an Exception, and
so the descriptive error never got printed.
-rw-r--r-- | setuptools_scm/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/setuptools_scm/__init__.py b/setuptools_scm/__init__.py index 9e5a9eb..42f8169 100644 --- a/setuptools_scm/__init__.py +++ b/setuptools_scm/__init__.py @@ -30,13 +30,16 @@ def version_from_scm(root): def dump_version(root, version, write_to): if not write_to: return - target = os.path.join(root, write_to) + target = os.path.normpath(os.path.join(root, write_to)) if target.endswith('.txt'): dump = version elif target.endswith('.py'): dump = PYTHON_TEMPLATE.format(version=version) else: - raise ValueError('bad file format: ' + os.path.splitext(target)) + raise ValueError("bad file format: '%s' (of %s) " % ( + os.path.splitext(target)[1], + target + )) with open(target, 'w') as fp: fp.write(dump) |