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

Makefile assume incorrect location for virtualenv binaries on Windows #6885

Closed
YngveNPettersen opened this issue May 26, 2023 · 3 comments
Closed

Comments

@YngveNPettersen
Copy link
Contributor

Configuration:

In this configuration make virtualenv fails.

The reason is that it (and the quickstart recipe) assumes activate, pip, and python is located in .venv/bin when on Windows the binaries are in .venv/Scripts .

One way to avoid this is to activate the sandbox and let the PATH do the work, but that also requires using .venv/Scripts/activate , not .venv/bin/activate .

At present, I'll patch the paths locally.

@mokibit
Copy link
Collaborator

mokibit commented Sep 20, 2023

Hi, @YngveNPettersen,
unfortunatelly, the script make virtualenv does not support Windows operating system.
This issue was addressed in updated Buildbot documentation #7119.

@p12tic
Copy link
Member

p12tic commented Sep 24, 2023

Indeed, in this particular case Windows is too much work to support. Creating virtualenv manually is just a couple of further commands.

@p12tic p12tic closed this as completed Sep 24, 2023
@YngveNPettersen
Copy link
Contributor Author

Not that much of a change, actually. On current master AFAICT the diff is below.

In 3.11 there also had to be a change to the file www/base/webpack.config.js , using path.join() on the command in onBuildEnd.

That builds the tarball target without problems.

diff --git a/Makefile b/Makefile
index 82039c96e..6529cde13 100644
--- a/Makefile
+++ b/Makefile
@@ -7,11 +7,19 @@ ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

 .PHONY: docs pylint flake8 virtualenv

+ifeq ($(OS),Windows_NT)
+  VENV_BIN_DIR := Scripts
+  VENV_PY_VERSION ?= python
+  VENV_CREATE := python -m venv
+else
+  VENV_BIN_DIR := bin
+       VENV_PY_VERSION ?= python3
+  VENV_CREATE := virtualenv -p $(VENV_PY_VERSION)
+endif

 VENV_NAME := .venv$(VENV_PY_VERSION)
-PIP ?= $(ROOT_DIR)/$(VENV_NAME)/bin/pip
-PYTHON ?= $(ROOT_DIR)/$(VENV_NAME)/bin/python
-VENV_PY_VERSION ?= python3
+PIP ?= $(ROOT_DIR)/$(VENV_NAME)/$(VENV_BIN_DIR)/pip
+PYTHON ?= $(ROOT_DIR)/$(VENV_NAME)/$(VENV_BIN_DIR)/python
 YARN := $(shell which yarnpkg || which yarn)

 WWW_PKGS := www/react-base www/react-console_view www/react-grid_view www/react-waterfall_view www/react-wsgi_dashboards www/badges
@@ -112,8 +120,9 @@ docker-buildbot-master:
        $(DOCKERBUILD) -t buildbot/buildbot-master:master master

 $(VENV_NAME):
-       virtualenv -p $(VENV_PY_VERSION) $(VENV_NAME)
-       $(PIP) install -U build pip setuptools wheel
+       $(VENV_CREATE) $(VENV_NAME)
+       $(PYTHON) -m pip install --upgrade pip
+       $(PIP) install -U setuptools wheel

 # helper for virtualenv creation
 virtualenv: $(VENV_NAME)   # usage: make virtualenv VENV_PY_VERSION=python3.4
@@ -122,13 +131,13 @@ virtualenv: $(VENV_NAME)   # usage: make virtualenv VENV_PY_VERSION=python3.4
                -r requirements-cidocs.txt \
                packaging towncrier
        @echo now you can type following command  to activate your virtualenv
-       @echo . $(VENV_NAME)/bin/activate
+       @echo . $(VENV_NAME)/$(VENV_BIN_DIR)/activate

 TRIALOPTS?=buildbot

 .PHONY: trial
 trial: virtualenv
-       . $(VENV_NAME)/bin/activate && trial $(TRIALOPTS)
+       . $(VENV_NAME)/$(VENV_BIN_DIR)/activate && trial $(TRIALOPTS)

 release_notes: $(VENV_NAME)
        test ! -z "$(VERSION)"  #  usage: make release_notes VERSION=0.9.2
@@ -136,7 +145,7 @@ release_notes: $(VENV_NAME)
        git commit -m "Release notes for $(VERSION)"

 $(ALL_PKGS_TARGETS): cleanup_for_tarballs frontend_deps
-       . $(VENV_NAME)/bin/activate && ./common/maketarball.sh $(patsubst %_pkg,%,$@)
+       . $(VENV_NAME)/$(VENV_BIN_DIR)/activate && ./common/maketarball.sh $(patsubst %_pkg,%,$@)

 cleanup_for_tarballs:
        find master pkg worker www -name VERSION -exec rm {} \;
@@ -168,4 +177,4 @@ finishrelease:

 pyinstaller: virtualenv
        $(PIP) install pyinstaller
-       $(VENV_NAME)/bin/pyinstaller pyinstaller/buildbot-worker.spec
+       $(VENV_NAME)/$(VENV_BIN_DIR)/pyinstaller pyinstaller/buildbot-worker.spec

YngveNPettersen added a commit to YngveNPettersen/buildbot that referenced this issue Feb 28, 2024
Also modified the webpack config file to handle Windows paths.
YngveNPettersen added a commit to YngveNPettersen/buildbot that referenced this issue Feb 28, 2024
Also modified the webpack config file to handle Windows paths.
YngveNPettersen added a commit to YngveNPettersen/buildbot that referenced this issue Feb 28, 2024
Also modified the webpack config file to handle Windows paths.
YngveNPettersen added a commit to YngveNPettersen/buildbot that referenced this issue Feb 29, 2024
YngveNPettersen added a commit to YngveNPettersen/buildbot that referenced this issue Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants