Skip to content

Commit

Permalink
Support Windows (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat authored Feb 20, 2024
1 parent a93e37e commit 7f19683
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,33 @@ jobs:
- "3.8"
os:
- ubuntu-latest
# - windows-latest
- windows-latest
- macos-latest
steps:
- name: setup python for tox
uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/checkout@v4
- name: Install uv
run: python -m pip install uv
- name: Uninstall pip
run: python -m pip uninstall pip -y
- name: Active uv for global env
run: echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV
- name: Set up Python ${{ matrix.py }} on ${{ matrix.os }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
allow-prereleases: true
- name: Create and activate a virtual environment (Windows)
if: ${{ runner.os == 'Windows' }}
run: |
irm https://astral.sh/uv/install.ps1 | iex
uv venv .venv
"VIRTUAL_ENV=.venv" | Out-File -FilePath $env:GITHUB_ENV -Append
"$PWD/.venv/Scripts" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Create and activate a virtual environment (Unix)
if: ${{ runner.os != 'Windows' }}
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Install self
run: uv pip install tox-uv@.
- name: setup python for test ${{ matrix.py }}
Expand All @@ -56,7 +69,7 @@ jobs:
file_handler.write(env)
shell: python
- name: setup test suite
run: tox -vv --notest
run: tox -vvvv --notest
- name: run test suite
run: tox --skip-pkg-install

Expand Down
12 changes: 6 additions & 6 deletions src/tox_uv/_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def prepend_env_var_path(self) -> list[Path]:
def env_bin_dir(self) -> Path:
if sys.platform == "win32": # pragma: win32 cover
return self.venv_dir / "Scripts"
# pragma: win32 no cover
return self.venv_dir / "bin"
else: # pragma: win32 no cover # noqa: RET505
return self.venv_dir / "bin"

def env_python(self) -> Path:
suffix = ".exe" if sys.platform == "win32" else ""
Expand All @@ -137,10 +137,10 @@ def env_python(self) -> Path:
def env_site_package_dir(self) -> Path:
if sys.platform == "win32": # pragma: win32 cover
return self.venv_dir / "Lib" / "site-packages"
# pragma: win32 no cover
assert self.base_python.version_info.major is not None # noqa: S101
assert self.base_python.version_info.minor is not None # noqa: S101
return self.venv_dir / "lib" / f"python{self.base_python.version_dot}" / "site-packages"
else: # pragma: win32 no cover # noqa: RET505
assert self.base_python.version_info.major is not None # noqa: S101
assert self.base_python.version_info.minor is not None # noqa: S101
return self.venv_dir / "lib" / f"python{self.base_python.version_dot}" / "site-packages"


__all__ = [
Expand Down

0 comments on commit 7f19683

Please sign in to comment.