2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-14 09:14:04 +00:00
This commit is contained in:
Ameya Shenoy 2018-02-28 18:48:11 +05:30
parent ac30619178
commit 59d6c99614
No known key found for this signature in database
GPG Key ID: 735490161CD5C91E
2 changed files with 11 additions and 4 deletions

View File

@ -262,6 +262,11 @@ def get_current_version(app, bench_path='.'):
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(), field='version') return get_version_from_string(f.read(), field='version')
def get_develop_version(app, bench_path='.'):
repo_dir = get_repo_dir(app, bench_path=bench_path)
with open(os.path.join(repo_dir, os.path.basename(repo_dir), 'hooks.py')) as f:
return get_version_from_string(f.read(), field='develop_version')
def get_upstream_version(app, branch=None, bench_path='.'): def get_upstream_version(app, branch=None, bench_path='.'):
repo_dir = get_repo_dir(app, bench_path=bench_path) repo_dir = get_repo_dir(app, bench_path=bench_path)
if not branch: if not branch:

View File

@ -432,12 +432,14 @@ def update_requirements(bench_path='.'):
def update_node_packages(bench_path='.'): def update_node_packages(bench_path='.'):
print('Updating node packages...') print('Updating node packages...')
from bench.app import get_current_version from bench.app import get_develop_version
v = semantic_version.Version(get_current_version('frappe', bench_path = bench_path)) v = semantic_version.Version(get_current_version('frappe', bench_path = bench_path)) + from distutils.version import LooseVersion
v = LooseVersion(get_develop_version('frappe', bench_path = bench_path))
# After rollup was merged, frappe_version = 10.1 # After rollup was merged, frappe_version = 10.1
# anything before that was npm based # if develop_verion is 11 and up, only then install yarn
if v.major <= 10 and v.minor < 1: if v < LooseVersion('11.x.x-develop'):
update_npm_packages(bench_path) update_npm_packages(bench_path)
else: else:
update_yarn_packages(bench_path) update_yarn_packages(bench_path)