Skip to content

Commit 667270b

Browse files
committed
Merge pull request #99 from bgruening/master
Ignore list of files/directories that are specified in .shed.yml
2 parents 4c1c021 + 1c3ae20 commit 667270b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

planemo/shed.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from tempfile import mkstemp
33
import tarfile
44
import yaml
5+
import glob
6+
57
try:
68
from bioblend import toolshed
79
except ImportError:
@@ -119,14 +121,19 @@ def build_tarball(tool_path):
119121
responsible for deleting this file.
120122
"""
121123
fd, temp_path = mkstemp()
124+
repo_config = shed_repo_config(tool_path)
125+
ignore_list = []
126+
for shed_ignore in repo_config.get('ignore', []):
127+
ignore_list.extend(glob.glob(os.path.join(tool_path, shed_ignore)))
122128
try:
123129
with tarfile.open(temp_path, "w:gz") as tar:
124130
for name in os.listdir(tool_path):
125-
if os.path.islink(name):
126-
path = os.path.realpath(name)
127-
else:
128-
path = os.path.join(tool_path, name)
129-
tar.add(path, name, recursive=True, exclude=_tar_excludes)
131+
if not os.path.join(tool_path, name) in ignore_list:
132+
if os.path.islink(name):
133+
path = os.path.realpath(name)
134+
else:
135+
path = os.path.join(tool_path, name)
136+
tar.add(path, name, recursive=True, exclude=_tar_excludes)
130137
finally:
131138
os.close(fd)
132139
return temp_path

0 commit comments

Comments
 (0)