Skip to content

Commit 74d423f

Browse files
aesteve-rhnirs
authored andcommitted
Makefile: add venv target
Add venv target to the Makefile, which automatically creates the Python virtual environment in a consistent folder and installs all requirements in a single step. Signed-off-by: Albert Esteve <aesteve@redhat.com>
1 parent ecc69d6 commit 74d423f

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ PACKAGE_NAME=ovirt-imageio
33
PACKAGE_VERSION=$(shell python3 ovirt_imageio/_internal/version.py)
44
OUTDIR=dist
55

6+
VENV_DIR = $(HOME)/.venv/ovirt-imageio
7+
68
RPM_TOPDIR?=$(PWD)/build/rpm
79
TAR_NAME=$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
810
SPEC_NAME=$(PACKAGE_NAME).spec
@@ -12,7 +14,7 @@ GENERATED = \
1214

1315
METADATA = ovirt_imageio/_internal/version.py Makefile
1416

15-
.PHONY: build check dist srpm rpm clean images clean-images storage clean-storage $(SPEC_NAME)
17+
.PHONY: build check dist srpm rpm clean images clean-images storage clean-storage $(SPEC_NAME) venv
1618

1719
build:
1820
python3 setup.py build_ext --build-lib .
@@ -59,6 +61,11 @@ storage:
5961
clean-storage:
6062
userstorage delete storage.py
6163

64+
venv:
65+
python3 -m venv $(VENV_DIR) && \
66+
$(VENV_DIR)/bin/python3 -m pip install --upgrade pip && \
67+
$(VENV_DIR)/bin/python3 -m pip install -r containers/requirements.txt
68+
6269
$(GENERATED) : % : %.in $(METADATA)
6370
@sed \
6471
-e 's|@PACKAGE_NAME@|$(PACKAGE_NAME)|g' \

docs/development.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,14 @@ Install the runtime requirements:
4545

4646
Create a virtual environment for running the tests:
4747

48-
python3 -m venv ~/venv/ovirt-imageio
49-
source ~/venv/ovirt-imageio/bin/activate
50-
pip install --upgrade pip
51-
pip install --upgrade -r containers/requirements.txt
52-
deactivate
48+
make venv
5349

5450

5551
## Running the tests
5652

5753
Before running the tests, enter the virtual environment:
5854

59-
source ~/venv/ovirt-imageio/bin/activate
55+
source ~/.venv/ovirt-imageio/bin/activate
6056

6157
When you are done, you can deactivate the environment using:
6258

0 commit comments

Comments
 (0)