build: Add environment variable to set alternative venv path

Signed-off-by: Sven Sager <akira@narux.de>
This commit is contained in:
2023-08-29 09:43:32 +02:00
parent b02c4011d7
commit b279209b2b
3 changed files with 20 additions and 9 deletions

2
.idea/misc.xml generated
View File

@@ -3,7 +3,7 @@
<component name="JavaScriptSettings"> <component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" /> <option name="languageLevel" value="ES6" />
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (revpimodio2)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (revpimodio2)" project-jdk-type="Python SDK" />
<component name="PythonCompatibilityInspectionAdvertiser"> <component name="PythonCompatibilityInspectionAdvertiser">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>

2
.idea/revpimodio2.iml generated
View File

@@ -5,7 +5,7 @@
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/venv" /> <excludeFolder url="file://$MODULE_DIR$/venv" />
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.9 (revpimodio2)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.11 (revpimodio2)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="PackageRequirementsSettings"> <component name="PackageRequirementsSettings">

View File

@@ -5,23 +5,34 @@ MAKEFLAGS = --no-print-directory --no-builtin-rules
# Variables # Variables
PACKAGE = revpimodio2 PACKAGE = revpimodio2
# If virtualenv exists, use it. If not, use PATH to find, except python3 # Set path to create the virtual environment with package name
SYSTEM_PYTHON = /usr/bin/python3 ifdef PYTHON3_VENV
PYTHON = $(or $(wildcard venv/bin/python), $(SYSTEM_PYTHON)) VENV_PATH = $(PYTHON3_VENV)/$(PACKAGE)
else
VENV_PATH = venv
endif
# If virtualenv exists, use it. If not, use PATH to find commands
SYSTEM_PYTHON = python3
PYTHON = $(or $(wildcard $(VENV_PATH)/bin/python), $(SYSTEM_PYTHON))
all: build docs all: build docs
.PHONY: all .PHONY: all
## Environment ## Environment
venv-info:
echo Using path: "$(VENV_PATH)"
exit 0
venv: venv:
$(SYSTEM_PYTHON) -m venv venv $(SYSTEM_PYTHON) -m venv "$(VENV_PATH)"
source venv/bin/activate && \ source $(VENV_PATH)/bin/activate && \
python3 -m pip install --upgrade pip && \ python3 -m pip install --upgrade pip && \
python3 -m pip install -r requirements.txt python3 -m pip install -r requirements.txt
exit 0 exit 0
.PHONY: venv .PHONY: venv-info venv
## Build, install ## Build, install
build: build:
@@ -41,6 +52,6 @@ clean:
rm -rf build docs/_build dist src/*.egg-info *.spec rm -rf build docs/_build dist src/*.egg-info *.spec
clean-all: clean clean-all: clean
rm -R venv rm -R $(VENV_PATH)
.PHONY: clean clean-all .PHONY: clean clean-all