comparison piecrust/sources/autoconfig.py @ 360:95874699ec2e

sources: Fix how the `autoconfig` source iterates over its structure.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 20 Apr 2015 23:57:10 -0700
parents a2d283d1033d
children dd25bd3ce1f9
comparison
equal deleted inserted replaced
359:2cd2b5d07129 360:95874699ec2e
250 rel_path = rel_path.lstrip('/') 250 rel_path = rel_path.lstrip('/')
251 path = self.fs_endpoint_path 251 path = self.fs_endpoint_path
252 if rel_path != '': 252 if rel_path != '':
253 parts = rel_path.split('/') 253 parts = rel_path.split('/')
254 for p in parts: 254 for p in parts:
255 p_pat = r'(\d+_)?' + re.escape(p) 255 p_pat = r'(\d+_)?' + re.escape(p) + '$'
256 for name in os.listdir(path): 256 for name in os.listdir(path):
257 if re.match(p_pat, name): 257 if re.match(p_pat, name):
258 path = os.path.join(path, name) 258 path = os.path.join(path, name)
259 break 259 break
260 else: 260 else: