def init(name): global dirName def _counterToName(c): return name + '/' + c + '.exec' if not os.path.exists(name): os.makedirs(name) dirName = uniqueDir(_counterToName)
from scriptRunnerDaemon import DIR, LOCK from utils.fileUtils import FileLock, copyDirFiltered, uniqueDir, uniqueFile def cpFilter(fileName): if fileName == '.git' or \ fileName.endswith('.swp') or \ fileName.endswith('.swo') or \ fileName.endswith('.pyc') or \ fileName.endswith('~'): return False return True def srcDirLoc(c): return constants['statePath'] + '/src/' + c srcDir = uniqueDir(srcDirLoc) copyDirFiltered(os.path.expanduser(sys.argv[1]), srcDir, cpFilter) def fileName(c): return DIR + '/' + c + '.task' def execName(c): return constants['statePath'] + '/execs/' + c + '.exec' l = FileLock(LOCK) l.acquire() try: fd = uniqueFile(fileName) if len(sys.argv) > 2: addToView = sys.argv[2] else: