Python venv.main() Examples
The following are 5
code examples of venv.main().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
venv
, or try the search function
.
Example #1
Source File: setup.py From nginx-config-builder with BSD 2-Clause "Simplified" License | 6 votes |
def run(self): venv_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'venv', 'nginx-config-builder') print('Creating virtual environment in {path}'.format(path=venv_path)) if '3' in self.python or sys.version_info[0] >= 3: import venv venv.main(args=[venv_path]) else: venv_cmd = ['virtualenv'] if self.python: venv_cmd.extend(['-p', self.python]) venv_cmd.append(venv_path) subprocess.check_call(venv_cmd) print('Linking `activate` to top level of project.\n') print('To activate, simply run `source activate`.') try: os.symlink( os.path.join(venv_path, 'bin', 'activate'), os.path.join(os.path.dirname(os.path.abspath(__file__)), 'activate') ) except OSError: # symlink already exists pass
Example #2
Source File: setup.py From asciietch with BSD 2-Clause "Simplified" License | 5 votes |
def run_tests(self): import tox errno = -1 try: tox.session.main() except SystemExit as e: errno = e.code sys.exit(errno)
Example #3
Source File: setup.py From asciietch with BSD 2-Clause "Simplified" License | 5 votes |
def run_tests(self): import pytest errno = pytest.main() sys.exit(errno)
Example #4
Source File: setup.py From asciietch with BSD 2-Clause "Simplified" License | 5 votes |
def run(self): venv_path = Path(__file__).absolute().parent / 'venv' / 'asciietch' print(f'Creating virtual environment in {venv_path}') venv.main(args=[str(venv_path)]) print( 'Linking `activate` to top level of project.\n' 'To activate, simply run `source activate`.' ) activate = Path(venv_path, 'bin', 'activate') activate_link = Path(__file__).absolute().parent / 'activate' try: activate_link.symlink_to(activate) except FileExistsError: ...
Example #5
Source File: setup.py From shiv with BSD 2-Clause "Simplified" License | 5 votes |
def run(self): venv_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'venv', 'shiv') print('Creating virtual environment in {}'.format(venv_path)) venv.main(args=[venv_path]) print( 'Linking `activate` to top level of project.\n' 'To activate, simply run `source activate`.' ) try: os.symlink( Path(venv_path, 'bin', 'activate'), Path(Path(__file__).absolute().parent, 'activate'), ) except FileExistsError: pass