Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Windows #19

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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