Skip to content

Commit

Permalink
Merge pull request #1 from msarahan/bash_x_debug
Browse files Browse the repository at this point in the history
carry debug through with config object
  • Loading branch information
maddenp authored Oct 7, 2017
2 parents fa2d275 + 137af75 commit 54807bf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,8 +843,8 @@ def scan_metadata(path):
}


def build(m, debug=False, post=None, need_source_download=True, need_reparse_in_env=False,
built_packages=None, notest=False):
def build(m, post=None, need_source_download=True, need_reparse_in_env=False, built_packages=None,
notest=False):
'''
Build the package with the specified metadata.
Expand Down Expand Up @@ -1117,7 +1117,7 @@ def build(m, debug=False, post=None, need_source_download=True, need_reparse_in_

os.chmod(work_file, 0o766)

cmd = [shell_path] + (['-x'] if debug else []) + ['-e', work_file]
cmd = [shell_path] + (['-x'] if m.config.debug else []) + ['-e', work_file]
# this should raise if any problems occur while building
utils.check_call_env(cmd, env=env, cwd=src_dir)
utils.remove_pycache_from_scripts(m.config.build_prefix)
Expand Down Expand Up @@ -1431,7 +1431,7 @@ def construct_metadata_for_test(recipedir_or_package, config):
return m, hash_input


def test(recipedir_or_package_or_metadata, config, debug=False, move_broken=True):
def test(recipedir_or_package_or_metadata, config, move_broken=True):
'''
Execute any test scripts for the given package.
Expand All @@ -1443,14 +1443,15 @@ def test(recipedir_or_package_or_metadata, config, debug=False, move_broken=True
need_cleanup = False
hash_input = {}
recipe_dir = ''
trace = '-x ' if debug else ''

if hasattr(recipedir_or_package_or_metadata, 'config'):
metadata = recipedir_or_package_or_metadata
else:
metadata, hash_input = construct_metadata_for_test(recipedir_or_package_or_metadata,
config)

trace = '-x ' if metadata.config.debug else ''

metadata.append_metadata_sections(hash_input, merge=False)
metadata.config.compute_build_id(metadata.name())
# When testing a .tar.bz2 in the pkgs dir, clean_pkg_cache() will remove it.
Expand Down Expand Up @@ -1635,7 +1636,7 @@ def test(recipedir_or_package_or_metadata, config, debug=False, move_broken=True
if utils.on_win:
cmd = ['cmd.exe', "/d", "/c", test_script]
else:
cmd = [shell_path] + (['-x'] if debug else []) + ['-e', test_script]
cmd = [shell_path] + (['-x'] if metadata.config.debug else []) + ['-e', test_script]
try:
utils.check_call_env(cmd, env=env, cwd=metadata.config.test_dir)
except subprocess.CalledProcessError:
Expand Down Expand Up @@ -1768,7 +1769,6 @@ def build_tree(recipe_list, config, build_only=False, post=False, notest=False,
metadata.config.compute_build_id(metadata.name(), reset=True)

packages_from_this = build(metadata,
debug=config.debug,
post=post,
need_source_download=need_source_download,
need_reparse_in_env=need_reparse_in_env,
Expand All @@ -1779,7 +1779,7 @@ def build_tree(recipe_list, config, build_only=False, post=False, notest=False,
for pkg, dict_and_meta in packages_from_this.items():
if pkg.endswith('.tar.bz2'):
# we only know how to test conda packages
test(pkg, config=metadata.config, debug=config.debug)
test(pkg, config=metadata.config)
built_packages.update({pkg: dict_and_meta})
else:
built_packages.update(packages_from_this)
Expand Down

0 comments on commit 54807bf

Please sign in to comment.