Skip to content

Commit 8038556

Browse files
Merge pull request #77 from johnscancella/master
fixes #75
2 parents 7684c79 + d21183c commit 8038556

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

bagit.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -787,14 +787,17 @@ def _make_tagmanifest_file(alg, bag_dir):
787787
tagmanifest.write('%s %s\n' % (digest, filename))
788788

789789
def _find_tag_files(bag_dir):
790-
for dir_name, _, filenames in os.walk(bag_dir):
791-
if not re.match(r'.*data$', dir_name):
792-
for filename in filenames:
793-
if filename.startswith('tagmanifest-'):
794-
continue
795-
#remove everything up to the bag_dir directory
796-
p = join(dir_name, filename)
797-
yield os.path.relpath(p, bag_dir)
790+
for dir in os.listdir(bag_dir):
791+
if dir != 'data':
792+
if os.path.isfile(dir) and not dir.startswith('tagmanifest-'):
793+
yield dir
794+
for dir_name, _, filenames in os.walk(dir):
795+
for filename in filenames:
796+
if filename.startswith('tagmanifest-'):
797+
continue
798+
#remove everything up to the bag_dir directory
799+
p = join(dir_name, filename)
800+
yield os.path.relpath(p, bag_dir)
798801

799802
def _walk(data_dir):
800803
for dirpath, dirnames, filenames in os.walk(data_dir):

0 commit comments

Comments
 (0)