Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@eventhook('init-post-script')
def activate_capn(self, file):
if self.active:
file.write("source capn\n")
if CAPN:
@eventhook('venv-post-create')
def install(self, path, **kwargs):
if self.active:
activate_path = os.path.join(path, 'bin', 'activate')
add_external_hook(self.default_hook_file, os.getcwd(), hooktype='tree',
enter=['source %s' % activate_path],
exit=['deactivate'], unique=True)
@eventhook('init-post-exec')
def create_venv(self, path, **kwargs):
if self.options and self.options.venv:
print "Creating virtualenv..."
path = os.path.join(path, '.pin', 'env')
self.fire("pre-create", path)
create_virtualenv(path)
self.fire("post-create", path)
@eventhook('init-post-args')
def parse_args(self, args, **kwargs):
parser = ArgumentParser()
parser.add_argument('--venv', action='store_true')
self.options, extargs = parser.parse_known_args(args)
@eventhook('init-post-args')
def postargs(self, args):
parser = ArgumentParser()
parser.add_argument('--autoenv', action='store_true')
parser.add_argument('--venv', action='store_true')
self.options, extargs = parser.parse_known_args(args)