Skip to content

Commit

Permalink
fix: sync apps file in init, imports and no warn in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
gavindsouza committed Nov 12, 2021
1 parent ee6a967 commit 71d178d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion bench/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion bench/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion bench/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
11 changes: 5 additions & 6 deletions bench/utils/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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'):
Expand Down

0 comments on commit 71d178d

Please sign in to comment.