-
-def cp_to_dir (pattern, dir):
- "Copy files matching re PATTERN from cwd to DIR"
- # Duh. Python style portable: cp *.EXT OUTDIR
- # system ('cp *.%s %s' % (ext, outdir), 1)
- files = filter (lambda x, p=pattern: re.match (p, x), os.listdir ('.'))
- map (lambda x, d=dir: shutil.copy2 (x, os.path.join (d, x)), files)
-
-# Python < 1.5.2 compatibility
-#
-# On most platforms, this is equivalent to
-#`normpath(join(os.getcwd()), PATH)'. *Added in Python version 1.5.2*
-if os.path.__dict__.has_key ('abspath'):
- abspath = os.path.abspath
-else:
- def abspath (path):
- return os.path.normpath (os.path.join (os.getcwd (), path))
-
-if os.__dict__.has_key ('makedirs'):
- makedirs = os.makedirs
-else:
- def makedirs (dir, mode=0777):
- system ('mkdir -p %s' % dir)
-
-def mkdir_p (dir, mode=0777):
- if not os.path.isdir (dir):
- makedirs (dir, mode)
-