mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
base version should keep unchanged
This commit is contained in:
parent
415d858f71
commit
342e5aa5b4
1 changed files with 6 additions and 3 deletions
9
setup.py
9
setup.py
|
@ -126,7 +126,7 @@ def dirty_version():
|
|||
print('failed to parse git version', file=sys.stderr)
|
||||
return False
|
||||
sha = sha.strip('g')
|
||||
replace_version(base, N)
|
||||
replace_version(N)
|
||||
with open('xonsh/dev.githash', 'w') as f:
|
||||
f.write(sha)
|
||||
print('wrote git version: ' + sha, file=sys.stderr)
|
||||
|
@ -136,14 +136,15 @@ def dirty_version():
|
|||
ORIGINAL_VERSION_LINE = None
|
||||
|
||||
|
||||
def replace_version(base, N):
|
||||
def replace_version(N):
|
||||
"""Replace version in `__init__.py` with devN suffix"""
|
||||
global ORIGINAL_VERSION_LINE
|
||||
with open('xonsh/__init__.py', 'r') as f:
|
||||
raw = f.read()
|
||||
lines = raw.splitlines()
|
||||
assert '__version__' in lines[0], 'version should define at the top'
|
||||
ORIGINAL_VERSION_LINE = lines[0]
|
||||
lines[0] = "__version__ = '{}.dev{}'".format(base, N)
|
||||
lines[0] = lines[0].rstrip(" '") + ".dev{}'".format(N)
|
||||
upd = '\n'.join(lines) + '\n'
|
||||
with open('xonsh/__init__.py', 'w') as f:
|
||||
f.write(upd)
|
||||
|
@ -151,6 +152,8 @@ def replace_version(base, N):
|
|||
|
||||
def restore_version():
|
||||
"""If we touch the version in __init__.py discard changes after install."""
|
||||
if ORIGINAL_VERSION_LINE is None:
|
||||
return
|
||||
with open('xonsh/__init__.py', 'r') as f:
|
||||
raw = f.read()
|
||||
lines = raw.splitlines()
|
||||
|
|
Loading…
Add table
Reference in a new issue