Skip to content

Commit e60175a

Browse files
authored
Merge pull request #284 from blink1073/use-setuppy-version
Use setup.py --version by default
2 parents 9087040 + 035f9f3 commit e60175a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

jupyter_releaser/util.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ def get_repo():
137137

138138
def get_version():
139139
"""Get the current package version"""
140+
if SETUP_PY.exists():
141+
warnings.warn("Using deprecated setup.py invocation")
142+
try:
143+
return run("python setup.py --version").split("\n")[-1]
144+
except CalledProcessError as e:
145+
print(e)
146+
140147
if PYPROJECT.exists():
141148
text = PYPROJECT.read_text(encoding="utf-8")
142149
data = toml.loads(text)
@@ -153,10 +160,6 @@ def get_version():
153160
if PACKAGE_JSON.exists():
154161
return json.loads(PACKAGE_JSON.read_text(encoding="utf-8")).get("version", "")
155162

156-
if SETUP_PY.exists():
157-
warnings.warn("Using deprecated setup.py invocation")
158-
return run("python setup.py --version").split("\n")[-1]
159-
160163
raise ValueError("No version identifier could be found!")
161164

162165

0 commit comments

Comments
 (0)