Skip to content

Commit ee32621

Browse files
committed
build: Add environment variable to set alternative venv path
1 parent a5b728d commit ee32621

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/revpipyload.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,34 @@ MAKEFLAGS = --no-print-directory --no-builtin-rules
55
# Variables
66
PACKAGE = revpipyload
77

8-
# If virtualenv exists, use it. If not, use PATH to find, except python3
9-
SYSTEM_PYTHON = /usr/bin/python3
10-
PYTHON = $(or $(wildcard venv/bin/python), $(SYSTEM_PYTHON))
8+
# Set path to create the virtual environment with package name
9+
ifdef PYTHON3_VENV
10+
VENV_PATH = $(PYTHON3_VENV)/$(PACKAGE)
11+
else
12+
VENV_PATH = venv
13+
endif
14+
15+
# If virtualenv exists, use it. If not, use PATH to find commands
16+
SYSTEM_PYTHON = python3
17+
PYTHON = $(or $(wildcard $(VENV_PATH)/bin/python), $(SYSTEM_PYTHON))
1118

1219
all: build
1320

1421
.PHONY: all
1522

1623
## Environment
24+
venv-info:
25+
echo Using path: "$(VENV_PATH)"
26+
exit 0
27+
1728
venv:
18-
$(SYSTEM_PYTHON) -m venv venv
19-
source venv/bin/activate && \
29+
$(SYSTEM_PYTHON) -m venv "$(VENV_PATH)"
30+
source $(VENV_PATH)/bin/activate && \
2031
python3 -m pip install --upgrade pip && \
2132
python3 -m pip install -r requirements.txt
2233
exit 0
2334

24-
.PHONY: venv
35+
.PHONY: venv-info venv
2536

2637
## Build, install
2738
build:
@@ -38,6 +49,6 @@ clean:
3849
rm -rf build dist src/*.egg-info *.spec
3950

4051
clean-all: clean
41-
rm -R venv
52+
rm -R $(VENV_PATH)
4253

4354
.PHONY: clean clean-all

0 commit comments

Comments
 (0)