Skip to content

Commit

Permalink
Support Windows and enable verbose mode in uv with more than two verb…
Browse files Browse the repository at this point in the history
…ose flag

Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Feb 19, 2024
1 parent 194a908 commit 872e579
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- "3.8"
os:
- ubuntu-latest
# - windows-latest # not yet supported
- windows-latest
- macos-latest
steps:
- name: setup python for tox
Expand All @@ -50,7 +50,7 @@ jobs:
file_handler.write(env)
shell: python
- name: setup test suite
run: tox -vv --notest
run: tox -vvv --notest
- name: run test suite
run: tox --skip-pkg-install

Expand Down
5 changes: 4 additions & 1 deletion src/tox_uv/_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def uv(self) -> str:
return str(Path(sys.executable).parent / "uv")

def default_install_command(self, conf: Config, env_name: str | None) -> Command: # noqa: ARG002
return Command([self.uv, "pip", "install", "{opts}", "{packages}"])
cmd = [self.uv, "pip", "install", "{opts}", "{packages}"]
if self._env.options.verbosity > 2: # noqa: PLR2004
cmd.append("-v")
return Command(cmd)

def post_process_install_command(self, cmd: Command) -> Command:
install_command = cmd.args
Expand Down
7 changes: 5 additions & 2 deletions src/tox_uv/_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from tox.execute.local_sub_process import LocalSubProcessExecutor
from tox.execute.request import StdinSource
from tox.tox_env.python.api import Python, PythonInfo, VersionInfo
from uv.__main__ import find_uv_bin # noqa: PLC2701
from virtualenv.discovery.py_spec import PythonSpec

from ._installer import UvInstaller
Expand Down Expand Up @@ -90,7 +91,7 @@ def _get_python(self, base_python: list[str]) -> PythonInfo | None: # noqa: PLR

@property
def uv(self) -> str:
return str(Path(sys.executable).parent / "uv")
return find_uv_bin()

@property
def venv_dir(self) -> Path:
Expand All @@ -105,10 +106,12 @@ def environment_variables(self) -> dict[str, str]:
def create_python_env(self) -> None:
base = self.base_python
cmd = [self.uv, "venv", "-p", base.version_dot]
if self.options.verbosity > 2: # noqa: PLR2004
cmd.append("-v")
if self.conf["uv_seed"]:
cmd.append("--seed")
cmd.append(str(self.venv_dir))
outcome = self.execute(cmd, stdin=StdinSource.OFF, run_id="venv", show=False)
outcome = self.execute(cmd, stdin=StdinSource.OFF, run_id="venv", show=None)
outcome.assert_success()

@property
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package = wheel
wheel_build_env = .pkg
extras =
test
pass_env =
PATH
set_env =
COVERAGE_FILE = {toxworkdir}{/}.coverage.{envname}
commands =
Expand Down

0 comments on commit 872e579

Please sign in to comment.