Skip to content

Commit

Permalink
Merge pull request #3288 from msarahan/fix_bld_bat_win
Browse files Browse the repository at this point in the history
omit LIEF on win for now; fix behavior with no bld.bat on win
  • Loading branch information
nehaljwani authored Dec 4, 2018
2 parents 5bf0a75 + 486c77d commit 14e02c4
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ requirements:
- patchelf # [linux]
- pkginfo
- psutil
- py-lief # [not win or py>27]
- py-lief # [not win]
- python
- pyyaml
- scandir # [py<34]
Expand Down
5 changes: 3 additions & 2 deletions conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1845,8 +1845,9 @@ def construct_metadata_for_test(recipedir_or_package, config):


def write_build_scripts(m, script, build_file):
with utils.path_prepended(m.config.build_prefix):
env = environ.get_dict(m=m)
with utils.path_prepended(m.config.host_prefix):
with utils.path_prepended(m.config.build_prefix):
env = environ.get_dict(m=m)
env["CONDA_BUILD_STATE"] = "BUILD"

# hard-code this because we never want pip's build isolation
Expand Down
2 changes: 1 addition & 1 deletion conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,7 @@ def clean(self):
@property
def activate_build_script(self):
b = self.meta.get('build', {}) or {}
should_activate = (self.uses_new_style_compiler_activation or b.get('activate_in_script'))
should_activate = (self.uses_new_style_compiler_activation or b.get('activate_in_script') is not False)
return bool(self.config.activate and should_activate) and not self.name() == 'conda'

@property
Expand Down
4 changes: 3 additions & 1 deletion conda_build/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,9 @@ def post_build(m, files, build_python):
if binary_relocation is True or (isinstance(binary_relocation, list) and
f in binary_relocation):
post_process_shared_lib(m, f, prefix_files)
check_overlinking(m, files)
# disable overlinking check on win right now, until Ray has time for it.
if not utils.on_win:
check_overlinking(m, files)


def check_symlinks(files, prefix, croot):
Expand Down
25 changes: 15 additions & 10 deletions conda_build/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ def append_hash_to_fn(fn, hash_value):
return ext_re.sub(r"\1_{}\2".format(hash_value[:10]), fn)


def download_to_cache(cache_folder, recipe_path, source_dict):
def download_to_cache(cache_folder, recipe_path, source_dict, verbose=False):
''' Download a source to the local cache. '''
print('Source cache directory is: %s' % cache_folder)
log = get_logger(__name__)
if verbose:
log.info('Source cache directory is: %s' % cache_folder)
if not isdir(cache_folder):
os.makedirs(cache_folder)

Expand All @@ -53,14 +55,15 @@ def download_to_cache(cache_folder, recipe_path, source_dict):
hash_added = True
break
else:
log = get_logger(__name__)
log.warn("No hash (md5, sha1, sha256) provided for {}. Source download forced. "
"Add hash to recipe to use source cache.".format(unhashed_fn))
path = join(cache_folder, fn)
if isfile(path):
print('Found source in cache: %s' % fn)
if verbose:
log.info('Found source in cache: %s' % fn)
else:
print('Downloading source to cache: %s' % fn)
if verbose:
log.info('Downloading source to cache: %s' % fn)

for url in source_urls:
if "://" not in url:
Expand All @@ -73,17 +76,19 @@ def download_to_cache(cache_folder, recipe_path, source_dict):
if url.startswith('file:///~'):
url = 'file:///' + expanduser(url[8:]).replace('\\', '/')
try:
print("Downloading %s" % url)
if verbose:
log.info("Downloading %s" % url)
with LoggingContext():
download(url, path)
except CondaHTTPError as e:
print("Error: %s" % str(e).strip(), file=sys.stderr)
log.warn("Error: %s" % str(e).strip(), file=sys.stderr)
rm_rf(path)
except RuntimeError as e:
print("Error: %s" % str(e).strip(), file=sys.stderr)
log.warn("Error: %s" % str(e).strip(), file=sys.stderr)
rm_rf(path)
else:
print("Success")
if verbose:
log.info("Success")
break
else: # no break
rm_rf(path)
Expand Down Expand Up @@ -131,7 +136,7 @@ def hoist_single_extracted_folder(nested_folder):
def unpack(source_dict, src_dir, cache_folder, recipe_path, croot, verbose=False,
timeout=900, locking=True):
''' Uncompress a downloaded source. '''
src_path, unhashed_fn = download_to_cache(cache_folder, recipe_path, source_dict)
src_path, unhashed_fn = download_to_cache(cache_folder, recipe_path, source_dict, verbose)

if not isdir(src_dir):
os.makedirs(src_dir)
Expand Down
8 changes: 4 additions & 4 deletions conda_build/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ def write_build_scripts(m, env, bld_bat):


def build(m, bld_bat, stats, provision_only=False):
with path_prepended(m.config.build_prefix):
with path_prepended(m.config.host_prefix):
with path_prepended(m.config.host_prefix):
with path_prepended(m.config.build_prefix):
env = environ.get_dict(m=m)
env["CONDA_BUILD_STATE"] = "BUILD"

Expand Down Expand Up @@ -326,9 +326,9 @@ def build(m, bld_bat, stats, provision_only=False):
if not isdir(path):
os.makedirs(path)

write_build_scripts(m, env, bld_bat)
work_script, env_script = write_build_scripts(m, env, bld_bat)

if not provision_only:
if not provision_only and os.path.isfile(work_script):
cmd = ['cmd.exe', '/c', 'bld.bat']
# rewrite long paths in stdout back to their env variables
if m.config.debug:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# We cannot build lief for Python 2.7 on Windows (unless we use mingw-w64 for it, which
# would be a non-trivial amount of work).
if sys.platform != 'win-32' or sys.version_info >= (3, 0):
if sys.platform != 'win32':
deps.extend(['lief'])

if sys.version_info < (3, 4):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ outputs:
- mkdir -p $PREFIX/etc/conda/activate.d # [unix]
- echo "export ACTIVATION_VAR=1" > $PREFIX/etc/conda/activate.d/activate_script.sh # [unix]
- echo export ACTIVATION_VAR=1 > %PREFIX%\etc\conda\activate.d\activate_script.sh # [win]
- name: no_activate_by_default
- name: no_activate_explicit
script: install_not_activated.sh
build:
activate_in_script: False
requirements:
build:
- {{ pin_subpackage('activation_package') }}
Expand Down

0 comments on commit 14e02c4

Please sign in to comment.