2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-11 15:51:03 +00:00

Merge branch 'master' into clean_code

This commit is contained in:
Ameya Shenoy 2018-02-28 19:28:33 +05:30
commit 3fb4d8f6c2
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:
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='.'):
repo_dir = get_repo_dir(app, bench_path=bench_path)
if not branch:

View File

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