def tox_package(session: session.Session, venv: VirtualEnv) -> Any: with venv.new_action("buildpkg") as action: tox_testenv_create(venv, action) if not detect_pdm_files(venv.path): return if not hasattr(session, "package"): session.package, session.dist = get_package(session, venv) # Patch the install command to install to local __pypackages__ folder for i, arg in enumerate(venv.envconfig.install_command): if arg == "python": venv.envconfig.install_command[i] = venv.getsupportedinterpreter() venv.envconfig.install_command.extend( ["-t", get_env_lib_path(venv.envconfig.config.option.pdm, venv.path)]) return session.package
def acquire_package(config: config.Config, venv: VirtualEnv) -> py.path.local: target_dir: py.path.local = config.toxworkdir.join( config.isolated_build_env) ensure_empty_dir(target_dir) args = [ venv.envconfig.config.option.pdm, "build", "--no-wheel", "-d", target_dir, ] with venv.new_action("buildpkg") as action: venv._pcall(args, cwd=venv.envconfig.config.toxinidir, venv=False, action=action) path = next(target_dir.visit("*.tar.gz")) action.setactivity("buildpkg", path) return path
def _newaction(venv: VirtualEnv, message: str) -> Action: try: # tox 3.7 and later return venv.new_action(message) except AttributeError: return venv.session.newaction(venv, message)