mirror of
https://github.com/frappe/bench.git
synced 2025-01-23 15:08:24 +00:00
[fix] version backward compatibility fix
This commit is contained in:
parent
f08d7e2605
commit
2e02ec78a2
@ -140,7 +140,7 @@ def get_current_version(app, bench='.'):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
# backward compatibility
|
# backward compatibility
|
||||||
with open(os.path.join(repo_dir, 'setup.py')) as f:
|
with open(os.path.join(repo_dir, 'setup.py')) as f:
|
||||||
return get_version_from_string(f.read())
|
return get_version_from_string(f.read(), field='version')
|
||||||
|
|
||||||
def get_upstream_version(app, branch=None, bench='.'):
|
def get_upstream_version(app, branch=None, bench='.'):
|
||||||
repo_dir = get_repo_dir(app, bench=bench)
|
repo_dir = get_repo_dir(app, bench=bench)
|
||||||
@ -206,8 +206,8 @@ def switch_to_v4(apps=None, bench='.', upgrade=False):
|
|||||||
def switch_to_v5(apps=None, bench='.', upgrade=False):
|
def switch_to_v5(apps=None, bench='.', upgrade=False):
|
||||||
switch_branch('v5.x.x', apps=apps, bench=bench, upgrade=upgrade)
|
switch_branch('v5.x.x', apps=apps, bench=bench, upgrade=upgrade)
|
||||||
|
|
||||||
def get_version_from_string(contents):
|
def get_version_from_string(contents, field='__version__'):
|
||||||
match = re.search(r"^(\s*%s\s*=\s*['\\\"])(.+?)(['\"])(?sm)" % '__version__',
|
match = re.search(r"^(\s*%s\s*=\s*['\\\"])(.+?)(['\"])(?sm)" % field,
|
||||||
contents)
|
contents)
|
||||||
return match.group(2)
|
return match.group(2)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user