Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix no_link variable clobber. Add test. #1611

Merged
merged 2 commits into from
Jan 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -981,10 +981,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"