Skip to content

Commit a9e7cf9

Browse files
committed

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

scripts/pr-check.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import sys
2+
import yaml
3+
4+
from bioblend import toolshed
5+
6+
ts = toolshed.ToolShedInstance(url='https://toolshed.g2.bx.psu.edu')
7+
fn = sys.argv[1]
8+
9+
# never mind about fancy yaml linting, let's just make sure the files are openable
10+
sys.stdout.write('Checking modified yaml file {}...\n'.format(fn))
11+
with open(fn) as f:
12+
yml = [n['name'] for n in yaml.safe_load(f)['tools']]
13+
14+
with open('{}.lock'.format(fn)) as f:
15+
yml_lock = [n['name'] for n in yaml.safe_load(f)['tools']]
16+
17+
new_tools = [n for n in yml if n not in yml_lock]
18+
19+
for tool in new_tools: # check all new tools are in the tool shed
20+
sys.stdout.write('Checking new tool {} is in the toolshed...\n'.format(tool))
21+
search_hits = [hit['repository']['name'] for hit in ts.repositories.search_repositories(tool,page_size=600)['hits']]
22+
assert tool in search_hits, '{} not in toolshed.'.format(tool)

0 commit comments

Comments
 (0)