Skip to content

Commit

Permalink
Merge pull request #4092 from mingwandroid/master.nupatch.4merge
Browse files Browse the repository at this point in the history
Master.nupatch.4merge
  • Loading branch information
mingwandroid authored Oct 14, 2020
2 parents 9222453 + 170a01b commit ae08afb
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 120 deletions.
13 changes: 8 additions & 5 deletions conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2009,6 +2009,8 @@ def build(m, stats, post=None, need_source_download=True, need_reparse_in_env=Fa
if any(out.get('type') == 'wheel' for out in m.meta.get('outputs', [])):
specs.extend(['pip', 'wheel'])

# TODO :: This is broken. It does not respect build/script for example and also if you need git
# you should add it as s build dep manually.
vcs_source = m.uses_vcs_in_build
if vcs_source and vcs_source not in specs:
vcs_executable = "hg" if vcs_source == "mercurial" else vcs_source
Expand All @@ -2034,12 +2036,13 @@ def build(m, stats, post=None, need_source_download=True, need_reparse_in_env=Fa

exclude_pattern = None
excludes = set(top_level_pkg.config.variant.get('ignore_version', []))
for key in top_level_pkg.config.variant.get('pin_run_as_build', {}).keys():
if key in excludes:
excludes.remove(key)
if excludes:
exclude_pattern = re.compile(r'|'.join(r'(?:^{}(?:\s|$|\Z))'.format(exc)
for exc in excludes))
for key in top_level_pkg.config.variant.get('pin_run_as_build', {}).keys():
if key in excludes:
excludes.remove(key)
if excludes:
exclude_pattern = re.compile(r'|'.join(r'(?:^{}(?:\s|$|\Z))'.format(exc)
for exc in excludes))
add_upstream_pins(m, False, exclude_pattern)

create_build_envs(top_level_pkg, notest)
Expand Down
2 changes: 2 additions & 0 deletions conda_build/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

from .utils import get_build_folders, rm_rf, get_logger, get_conda_operation_locks


on_win = (sys.platform == 'win32')


# Don't "save" an attribute of this module for later, like build_prefix =
# conda_build.config.config.build_prefix, as that won't reflect any mutated
# changes.
Expand Down
5 changes: 3 additions & 2 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,7 @@ def uses_vcs_in_meta(self):

@property
def uses_vcs_in_build(self):
# TODO :: Re-work this. Is it even useful? We can declare any vcs in our build deps.
build_script = "bld.bat" if on_win else "build.sh"
build_script = os.path.join(self.path, build_script)
for recipe_file in (build_script, self.meta_path):
Expand Down Expand Up @@ -2207,12 +2208,12 @@ def _get_used_vars_meta_yaml(self, force_top_level=False, force_global=False):
force_top_level=force_top_level, force_global=force_global, apply_selectors=False)

all_used_selectors = variants.find_used_variables_in_text(variant_keys, recipe_text,
selectors=True)
selectors_only=True)

reqs_text, recipe_text = self._get_used_vars_meta_yaml_helper(
force_top_level=force_top_level, force_global=force_global, apply_selectors=True)
all_used_reqs = variants.find_used_variables_in_text(variant_keys, recipe_text,
selectors=False)
selectors_only=False)

all_used = all_used_reqs.union(all_used_selectors)

Expand Down
8 changes: 6 additions & 2 deletions conda_build/skeletons/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,10 @@ def run_setuppy(src_dir, temp_dir, python_version, extra_specs, config, setup_op
# needs it in recent versions. At time of writing, it is not a package in defaults, so this
# actually breaks conda-build right now. Omit it until packaging is on defaults.
# specs = ['python %s*' % python_version, 'pyyaml', 'setuptools', 'six', 'packaging', 'appdirs']
specs = ['python %s*' % python_version, 'pyyaml', 'setuptools']
subdir = config.host_subdir
specs = ['python {}*'.format(python_version),
'pyyaml', 'setuptools'] + (['m2-patch', 'm2-gcc-libs'] if config.host_subdir.startswith('win')
else ['patch'])
with open(os.path.join(src_dir, "setup.py")) as setup:
text = setup.read()
if 'import numpy' in text or 'from numpy' in text:
Expand All @@ -1160,8 +1163,9 @@ def run_setuppy(src_dir, temp_dir, python_version, extra_specs, config, setup_op
specs.extend(extra_specs)

rm_rf(config.host_prefix)

create_env(config.host_prefix, specs_or_actions=specs, env='host',
subdir=config.host_subdir, clear_cache=False, config=config)
subdir=subdir, clear_cache=False, config=config)
stdlib_dir = join(config.host_prefix,
'Lib' if sys.platform == 'win32'
else 'lib/python%s' % python_version)
Expand Down
Loading

0 comments on commit ae08afb

Please sign in to comment.