Skip to content

Commit 40987e4

Browse files
authored
Merge pull request #1647 from mvdbeek/fix-shed-lint-required-files-symlink
Fix false-positive RequiredFilesExist lint in shed_lint (#1646)
2 parents d0687c4 + 1d24cc5 commit 40987e4

6 files changed

Lines changed: 49 additions & 1 deletion

File tree

planemo/shed/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ def realize_to(self, directory):
11391139
if os.path.isdir(source_path):
11401140
os.makedirs(target_path)
11411141
else:
1142-
os.symlink(source_path, target_path)
1142+
shutil.copy2(source_path, target_path)
11431143

11441144
@staticmethod
11451145
def realized_files_for(path, include_info):
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: "single_tool_required_files"
2+
owner: "iuc"
3+
description: "a simple tool with a required helper file"
4+
type: "unrestricted"
5+
remote_repository_url: "https://github.com/galaxyproject/planemo/tree/master/tests/data/repos/single_tool_required_files"
6+
homepage_url: "http://planemo.readthedocs.org/en/latest/"
7+
categories:
8+
- "Text Manipulation"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<tool id="cat_required" name="Concatenate with helper" version="1.0" profile="22.05">
2+
<description>tail-to-head, depends on a helper script</description>
3+
<required_files>
4+
<include path="helper.py" />
5+
</required_files>
6+
<command>
7+
python '$__tool_directory__/helper.py' &amp;&amp; cat $input1 > $out_file1
8+
</command>
9+
<inputs>
10+
<param name="input1" type="data" label="Concatenate Dataset" format="data" />
11+
</inputs>
12+
<outputs>
13+
<data name="out_file1" format_source="input1" metadata_source="input1"/>
14+
</outputs>
15+
<tests>
16+
<test>
17+
<param name="input1" value="1.bed"/>
18+
<output name="out_file1" file="1.bed"/>
19+
</test>
20+
</tests>
21+
<help>
22+
Concatenate datasets via a helper script.
23+
</help>
24+
<citations>
25+
<citation type="doi">10.1093/bioinformatics/bts573</citation>
26+
</citations>
27+
</tool>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""Helper script declared as a required file for the test tool."""
2+
3+
if __name__ == "__main__":
4+
print("hello from helper")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
chr1 147962192 147962580 CCDS989.1_cds_0_0_chr1_147962193_r 0 -
2+
chr1 147984545 147984630 CCDS990.1_cds_0_0_chr1_147984546_f 0 +

tests/test_shed_lint.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ def test_tool_linting(self):
4444
with self._isolate_repo("bad_tool_no_citations"):
4545
self._check_exit_code(["shed_lint", "--tools"], exit_code=1)
4646

47+
def test_tool_linting_required_files(self):
48+
# Regression test for https://github.com/galaxyproject/planemo/issues/1646:
49+
# a sibling file declared in <required_files> must be found in the
50+
# realized repository even though shed_lint copies files into a temp dir.
51+
with self._isolate_repo("single_tool_required_files"):
52+
self._check_exit_code(["shed_lint", "--tools", "--skip", "shed_remote_repository_url"])
53+
4754
def test_invalid_nested(self):
4855
# Created a nested repository with one good and one
4956
# invalid repository and make sure it runs and produces

0 commit comments

Comments
 (0)