build: Add environment variable to set alternative venv path

This commit is contained in:
2023-08-29 10:39:01 +02:00
parent a5b728dc7c
commit ee32621dcf
4 changed files with 22 additions and 9 deletions

2
.idea/misc.xml generated
View File

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

2
.idea/revpipyload.iml generated
View File

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

2
.idea/vcs.xml generated
View File

@@ -3,6 +3,8 @@
<component name="CommitMessageInspectionProfile">
<profile version="1.0">
<inspection_tool class="BodyLimit" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CommitFormat" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CommitNamingConvention" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SubjectBodySeparation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SubjectLimit" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>

View File

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