Skip to content

Commit

Permalink
chore: fix Python virtualenv commands on Windows (#5883)
Browse files Browse the repository at this point in the history
Using a virtual environment avoids polluting the system Python
installation.

Reverts #5880
  • Loading branch information
alex-chew authored Oct 31, 2024
1 parent 9ecb19f commit e410ead
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Source/DafnyRuntime/DafnyRuntimePython/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ DAFNY = dotnet run --project ../../Dafny --no-build --
GENERATED_SYSTEM_MODULE_SOURCE=../obj/systemModulePopulator-py/System_.py
GENERATED_SYSTEM_MODULE_TARGET=System_/__init__.py

# Use a virtual environment in order to avoid polluting the system installation,
# dependency conflicts, etc.
VIRTUALENV = venv
ifeq ($(OS),Windows_NT)
VIRTUALENV_PYTHON = $(VIRTUALENV)/Scripts/python.exe
else
VIRTUALENV_PYTHON = $(VIRTUALENV)/bin/python
endif

all: check-system-module

Expand All @@ -20,16 +27,16 @@ update-system-module: build-system-module

setup-venv:
python -m venv --clear $(VIRTUALENV)
python -m pip install --upgrade build twine
$(VIRTUALENV_PYTHON) -m pip install --upgrade build twine

clean-package:
rm -rf dist/ *.egg-info/

build-package:
python -m build
$(VIRTUALENV_PYTHON) -m build

upload-package-testpypi:
python -m twine upload --repository testpypi dist/*
$(VIRTUALENV_PYTHON) -m twine upload --repository testpypi dist/*

upload-package-pypi:
python -m twine upload dist/*
$(VIRTUALENV_PYTHON) -m twine upload dist/*

0 comments on commit e410ead

Please sign in to comment.