diff options
-rwxr-xr-x | linaro-cp.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/linaro-cp.py b/linaro-cp.py index 803beef..7ec858d 100755 --- a/linaro-cp.py +++ b/linaro-cp.py @@ -9,7 +9,6 @@ import sys import tempfile import time import re -import fnmatch # Public artifacts BUILD-INFO.txt build_info = 'Format-Version: 0.5\n\nFiles-Pattern: *\nLicense-Type: open\n' @@ -78,26 +77,24 @@ class API_v1(object): return transfer_queue for root, dirs, files in os.walk(src_dir): - dst_dir = dst - if not root.endswith(dst): # in sub directory - dst_dir = os.path.join(dst, root[len(src_dir) + 1:]) + rel_dir = root[len(src_dir) + 1:] for f in files: + rel_path = os.path.join(rel_dir, f) # If there's at least one include pattern, skip unless # some pattern matches skip = len(options.include) > 0 - for pat2 in options.include: - for pat in pat2.split(","): - if fnmatch.fnmatch('%s/%s' % (dst_dir, f), "*/" + pat): - skip = False - break + for pat in options.include: + if re.search(pat, rel_path): + skip = False + break if not skip: - dst_file = '%s%s/%s' % (self.api_base, dst_dir, f) + dst_file = '%s%s/%s' % (self.api_base, dst, rel_path) transfer_queue[dst_file] = os.path.join(root, f) if not options.no_build_info: build_info_file = os.path.join(root, 'BUILD-INFO.txt') if not os.path.exists(build_info_file): - dst_file = '%s%s/%s' % ( - self.api_base, dst_dir, 'BUILD-INFO.txt') + dst_file = '%s%s/%s/%s' % ( + self.api_base, dst, rel_path, 'BUILD-INFO.txt') transfer_queue[dst_file] = self.build_info return transfer_queue |