Skip to content
This repository was archived by the owner on Nov 22, 2020. It is now read-only.

Commit 20ce99f

Browse files
committed
1 parent 4d65649 commit 20ce99f

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 fname in listdir(bag_dir):
791+
if fname == 'data' or fname.startswith('tagmanifest-'):
792+
continue
793+
absfname = join(bag_dir, fname)
794+
if isfile(absfname):
795+
yield(fname)
796+
elif isdir(absfname):
797+
for dir_name, _, filenames in os.walk(absfname):
798+
for f in filenames:
799+
p = join(dir_name, f)
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)