def _deploy_virtenv_init(args): _virtenv = utils.active_virtualenv() virtenv = getattr(args, 'virtenv') or _virtenv # skip if we're already in the targeted virtenv... if virtenv and virtenv != _virtenv: # we can't alrady be in a virtenv when running virtualenv.main() utils.virtualenv_deactivate() # scratch the existing virtenv directory, if requested if args.trash: utils.remove_file(virtenv, force=True) if args.trash_home: trash() # virtualenv.main; pass in only the virtenv path sys.argv = sys.argv[0:1] + [virtenv] # run the virtualenv script to install the virtenv virtualenv.main() # activate the newly installed virtenv utils.virtualenv_activate(args.virtenv) return virtenv
utils = imp.load_module(*utils_tup) except ImportError: import metrique.utils as utils log_format = "%(message)s" logger = utils.debug_setup('metrique', level=logging.INFO, log_format=log_format, log2file=False, log2stdout=True) pjoin = os.path.join env = os.environ USER = getpass.getuser() VIRTUAL_ENV = utils.active_virtualenv() NOW = datetime.datetime.utcnow().strftime('%FT%H%M%S') HOSTNAME = socket.gethostname() try: # try to get one of the local inet device ip addresses LOCAL_IP = socket.gethostbyname(HOSTNAME) except Exception: LOCAL_IP = '127.0.0.1' PASSWORD = utils.rand_chars(10) COOKIE_SECRET = utils.rand_chars(50) HOME_DIR = env.get('METRIQUE_HOME', os.path.expanduser('~/')) PREFIX_DIR = env.get('METRIQUE_PREFIX', pjoin(HOME_DIR, '.metrique'))
utils_tup = imp.find_module('metrique.utils') utils = imp.load_module(*utils_tup) except ImportError: import metrique.utils as utils log_format = "%(message)s" logger = utils.debug_setup( 'metrique', level=logging.INFO, log_format=log_format, log2file=False, log2stdout=True) pjoin = os.path.join env = os.environ USER = getpass.getuser() VIRTUAL_ENV = utils.active_virtualenv() NOW = datetime.datetime.utcnow().strftime('%FT%H%M%S') HOSTNAME = socket.gethostname() try: # try to get one of the local inet device ip addresses LOCAL_IP = socket.gethostbyname(HOSTNAME) except Exception: LOCAL_IP = '127.0.0.1' PASSWORD = utils.rand_chars(10) COOKIE_SECRET = utils.rand_chars(50) HOME_DIR = env.get('METRIQUE_HOME', os.path.expanduser('~/')) PREFIX_DIR = env.get('METRIQUE_PREFIX', pjoin(HOME_DIR, '.metrique'))