2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-28 06:49:06 +00:00

fix: sync apps file in init, imports and no warn in CI

This commit is contained in:
Gavin D'souza 2021-11-12 20:30:53 +05:30
parent ee6a967a20
commit 71d178dde9
4 changed files with 10 additions and 9 deletions

View File

@ -203,7 +203,8 @@ def setup_app_dependencies(repo_name, bench_path='.', branch=None):
files = glob.glob(os.path.join(apps_path, repo_name, '**', 'hooks.py'))
if files:
lines = [x for x in open(files[0]).read().split('\n') if x.strip().startswith('required_apps')]
with open(files[0]) as f:
lines = [x for x in f.read().split('\n') if x.strip().startswith('required_apps')]
if lines:
required_apps = eval(lines[0].strip('required_apps').strip().lstrip('=').strip())
# TODO: when the time comes, add version check here

View File

@ -37,6 +37,7 @@ def cli():
global from_command_line
from_command_line = True
command = " ".join(sys.argv)
is_envvar_warn_set = not (os.environ.get("BENCH_DEVELOPER") or os.environ.get("CI"))
change_working_directory()
logger = setup_logging()
@ -47,7 +48,7 @@ def cli():
change_uid()
change_dir()
if not os.environ.get("BENCH_DEVELOPER") and (
if is_envvar_warn_set and (
is_dist_editable(bench.PROJECT_NAME)
and len(sys.argv) > 1
and sys.argv[1] != "src"

View File

@ -37,7 +37,7 @@ def retry_upgrade(version):
@click.argument('apps', nargs=-1)
@click.option('--upgrade',is_flag=True)
def switch_to_branch(branch, apps, upgrade=False):
from bench.app import switch_to_branch
from bench.utils.app import switch_to_branch
switch_to_branch(branch=branch, apps=list(apps), upgrade=upgrade)

View File

@ -2,15 +2,14 @@
import grp
import os
import pwd
import shutil
import sys
# imports - module imports
import bench
from bench.utils import exec_cmd, get_process_manager, log, run_frappe_cmd, sudoers_file, which
from bench.utils.bench import build_assets, clone_apps_from
# TODO: Fix this
import bench.utils
from bench.utils import *
from bench.utils.bench import build_assets
def init(path, apps_path=None, no_procfile=False, no_backups=False,
@ -58,6 +57,8 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
if apps_path:
install_apps_from_path(apps_path, bench_path=path)
bench.sync()
if not skip_assets:
build_assets(bench_path=path)
@ -174,8 +175,6 @@ def fix_prod_setup_perms(bench_path='.', frappe_user=None):
def setup_fonts():
import shutil
fonts_path = os.path.join('/tmp', 'fonts')
if os.path.exists('/etc/fonts_backup'):