Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dist_dir.remove(rec=1, ignore_errors=True)
dist_dir.ensure_dir()
result = package_venv._pcall(
[
package_venv.envconfig.envpython,
BUILD_ISOLATED,
str(dist_dir),
build_info.backend_module,
build_info.backend_object,
],
returnout=True,
action=action,
cwd=setup_dir,
)
reporter.verbosity2(result)
return dist_dir.join(result.split("\n")[-2])
venv=True,
is_test_command=False,
action=None,
redirect=True,
ignore_ret=False,
returnout=False,
env=None,
):
if env is None:
env = self._get_os_environ(is_test_command=is_test_command)
# construct environment variables
env.pop("VIRTUALENV_PYTHON", None)
bin_dir = str(self.envconfig.envbindir)
env["PATH"] = os.pathsep.join([bin_dir, os.environ["PATH"]])
reporter.verbosity2("setting PATH={}".format(env["PATH"]))
# get command
args[0] = self.getcommandpath(args[0], venv, cwd)
if sys.platform != "win32" and "TOX_LIMITED_SHEBANG" in os.environ:
args = prepend_shebang_interpreter(args)
cwd.ensure(dir=1) # ensure the cwd exists
return action.popen(
args,
cwd=cwd,
env=env,
redirect=redirect,
ignore_ret=ignore_ret,
returnout=returnout,
report_fail=not is_test_command,
)
def exe_spec(python_exe, base):
if not isinstance(python_exe, str):
python_exe = str(python_exe)
with _SPECK_LOCK[python_exe]:
if python_exe not in _SPECS:
info = get_python_info(python_exe)
if info is not None:
found = PythonSpec(
info["name"],
info["version_info"][0],
info["version_info"][1],
64 if info["is_64"] else 32,
info["executable"],
)
reporter.verbosity2("{} ({}) is {}".format(base, python_exe, info))
else:
found = None
_SPECS[python_exe] = found
return _SPECS[python_exe]
def tox_cleanup(session):
for tox_env in session.venv_dict.values():
if hasattr(tox_env, "package") and isinstance(tox_env.package, py.path.local):
package = tox_env.package
if package.exists():
verbosity2("cleanup {}".format(package))
package.remove()
py.path.local(package.dirname).remove(ignore_errors=True)