#! /usr/bin/python # To change this template, choose Tools | Templates # and open the template in the editor. __author__="bjschuma" __date__ ="$Mar 13, 2010 5:27:12 PM$" import os import sys import re def expand(path): return os.path.expanduser(path) def join(a,b): return os.path.join(a,b) def exists(path): return os.path.exists( expand(path) ) def isdir(path): if exists(path) == True: return os.path.isdir( expand(path) ) return False def isfile(path): if exists(path) == True: return os.path.isfile(path) return False def ls(path): try: return os.listdir( expand(path) ) except: return None def rm(path): if isfile(path): os.remove(path) def mkdir(path): if exists(path) == False: os.mkdir(path) def addPyPath(path): mods = [] if exists(path) == True: sys.path.append(path) for file in ls(path): if re.match("(.*?)\.py(?!c)",file): mods += [file.rsplit(".py",1)[0]] return mods