Changeset 1423 for trunk/packages/invirt-base/python
- Timestamp:
- Oct 29, 2008, 12:44:46 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-base/python/invirt/config.py
r1422 r1423 8 8 from contextlib import closing 9 9 import yaml 10 import re 10 11 11 12 try: loader = yaml.CSafeLoader … … 34 35 return d1 35 36 37 def run_parts_list(dirname): 38 """Reimplements Debian's run-parts --list. 39 40 One difference from run-parts's behavior: run-parts --list /foo/ 41 will give output like /foo//bar, because Python code tends to expect this. 42 43 Matches documented behavior of run-parts in debianutils v2.28.2, dated 2007. 44 """ 45 # From run-parts(8). 46 lanana_re = re.compile('^[a-z0-9]+$') 47 lsb_re = re.compile('^_?([a-z0-9_.]+-)+[a-z0-9]+$') 48 deb_cron_re = re.compile('^[a-z0-9][a-z0-9-]*$') 49 for name in os.listdir(dirname): 50 if lanana_re.match(name) or lsb_re.match(name) or deb_cron_re.match(name): 51 yield os.path.join(dirname, name) 52 36 53 def list_files(): 37 54 yield src_path 38 for name in os.listdir(src_dirpath):39 yield os.path.join(src_dirpath, name)55 for name in run_parts_list(src_dirpath): 56 yield name 40 57 41 58 def load_master():
Note: See TracChangeset
for help on using the changeset viewer.