#!/usr/bin/python import sys,os,os.path,getopt import getopt opts, pargs = getopt.getopt(sys.argv[1:],'p',['help']) print_name = None for k,v in opts: if k=='-p': print_name = 1 elif k=='--help': print """usage: -p : print the generated directory""" sys.exit(0) # Get compil root dir root_key = "COMPIL_ROOT" if not os.environ.has_key(root_key): print "environment variable %s is not set. Aborting." % root_key sys.exit(1) root = os.environ[root_key] # Get current working dir pwd = os.getcwd() # Make the compil dir if necessary compil = os.path.abspath(root+"/"+pwd) if not os.path.isdir(compil): os.makedirs(compil) if print_name: print compil