Skip to content

Commit

Permalink
Merge pull request #1611 from msarahan/fix_is_no_link
Browse files Browse the repository at this point in the history
fix no_link variable clobber.  Add test.
  • Loading branch information
msarahan authored Jan 2, 2017
2 parents fa38b16 + 88852cc commit afe6709
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
9 changes: 4 additions & 5 deletions conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def path_type(path):


def build_info_files_json_v1(m, prefix, files, files_with_prefix):
no_link = m.get_value('build/no_link')
no_link_files = m.get_value('build/no_link')
files_json = []
for fi in sorted(files):
prefix_placeholder, file_mode = has_prefix(fi, files_with_prefix)
Expand All @@ -571,7 +571,7 @@ def build_info_files_json_v1(m, prefix, files, files_with_prefix):
"size_in_bytes": os.path.getsize(path),
"path_type": path_type(path),
}
no_link = is_no_link(no_link, fi)
no_link = is_no_link(no_link_files, fi)
if no_link:
file_info["no_link"] = no_link
if prefix_placeholder and file_mode:
Expand Down Expand Up @@ -982,10 +982,9 @@ def build(m, config, post=None, need_source_download=True, need_reparse_in_env=F
f.write(u'\n')

# Use script from recipe?
script = m.get_value('build/script', None)
script = utils.ensure_list(m.get_value('build/script', None))
if script:
if isinstance(script, list):
script = '\n'.join(script)
script = '\n'.join(script)

if isdir(src_dir):
if utils.on_win:
Expand Down
13 changes: 13 additions & 0 deletions tests/test-recipes/metadata/no_link/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package:
name: test_no_link
version: 1.0

build:
no_link:
- no_link_file.example
- no_link_file.example2
script:
- echo "something" > $PREFIX/no_link_file.example # [not win]
- echo "something_else" > $PREFIX/no_link_file.example2 # [not win]
- echo "something" > %PREFIX%/no_link_file.example # [win]
- echo "something_else" > %PREFIX%/no_link_file.example2 # [win]
5 changes: 5 additions & 0 deletions tests/test-recipes/metadata/no_link/run_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import os
f = os.path.join(os.getenv('PREFIX'), 'no_link_file.example')
assert os.path.isfile(f), "File does not exist"
assert os.stat(f).st_nlink <= 1, "File is hard-linked where it should not be (link count = {})".format(os.stat(f).st_nlink)
assert not os.path.islink(f), "File is a symlink where it should not be"

0 comments on commit afe6709

Please sign in to comment.