Skip to content

Commit

Permalink
main: use ab4cfg.sh
Browse files Browse the repository at this point in the history
It is now not necessary to have Autobuild3 installed.
  • Loading branch information
MingcongBai committed Jan 9, 2024
1 parent c803679 commit f573b72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions acbs/ab3cfg.py → acbs/ab4cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from pyparsing import ParseException # type: ignore


def is_in_stage2_file(ab3cfg_path: str) -> bool:
with open(ab3cfg_path) as f:
vars = bashvar.eval_bashvar(f.read(), filename=ab3cfg_path)
def is_in_stage2_file(ab4cfg_path: str) -> bool:
with open(ab4cfg_path) as f:
vars = bashvar.eval_bashvar(f.read(), filename=ab4cfg_path)
stage2_val: str = vars.get('ABSTAGE2')
return stage2_val == '1'
return False
Expand All @@ -21,12 +21,12 @@ def is_in_stage2() -> bool:
"""
Return whether the current environment is in a stage2 development phase.
"""
ab3cfg_path: str = os.path.join(AUTOBUILD_CONF_DIR, 'ab3cfg.sh')
ab4cfg_path: str = os.path.join(AUTOBUILD_CONF_DIR, 'ab4cfg.sh')
try:
return is_in_stage2_env() or is_in_stage2_file(ab3cfg_path)
return is_in_stage2_env() or is_in_stage2_file(ab4cfg_path)
except OSError as e:
raise RuntimeError(f'Unable to read Autobuild config file {ab3cfg_path}.') from e
raise RuntimeError(f'Unable to read Autobuild config file {ab4cfg_path}.') from e
except ParseException as e:
raise RuntimeError(f'Error occurred while parsing Autobuild config file {ab3cfg_path}.') from e
raise RuntimeError(f'Error occurred while parsing Autobuild config file {ab4cfg_path}.') from e
except Exception as e:
raise RuntimeError(f'Error occurred while checking whether stage 2 mode is enabled.') from e
2 changes: 1 addition & 1 deletion acbs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import acbs.parser

from acbs import __version__
from acbs.ab3cfg import is_in_stage2
from acbs.ab4cfg import is_in_stage2
from acbs.base import ACBSPackageInfo
from acbs.checkpoint import ACBSShrinkWrap, do_shrink_wrap, checkpoint_to_group
from acbs.const import CONF_DIR, DUMP_DIR, LOG_DIR, TMP_DIR, AUTOBUILD_CONF_DIR
Expand Down

0 comments on commit f573b72

Please sign in to comment.