build: setup.py ohne OctoPrint-Build-Abhängigkeit (dict_merge Fallback); project requirements.txt; build script nutzt requirements.txt
This commit is contained in:
@@ -88,7 +88,18 @@ setup_parameters = octoprint_setuptools.create_plugin_setup_parameters(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if len(additional_setup_parameters):
|
if len(additional_setup_parameters):
|
||||||
|
try:
|
||||||
from octoprint.util import dict_merge
|
from octoprint.util import dict_merge
|
||||||
|
except Exception:
|
||||||
|
# Fallback to allow building without the octoprint package installed
|
||||||
|
def dict_merge(a, b):
|
||||||
|
result = dict(a)
|
||||||
|
for k, v in b.items():
|
||||||
|
if k in result and isinstance(result[k], dict) and isinstance(v, dict):
|
||||||
|
result[k] = dict_merge(result[k], v)
|
||||||
|
else:
|
||||||
|
result[k] = v
|
||||||
|
return result
|
||||||
setup_parameters = dict_merge(setup_parameters, additional_setup_parameters)
|
setup_parameters = dict_merge(setup_parameters, additional_setup_parameters)
|
||||||
|
|
||||||
setup(**setup_parameters)
|
setup(**setup_parameters)
|
6
requirements.txt
Normal file
6
requirements.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
setuptools>=68
|
||||||
|
wheel>=0.41
|
||||||
|
build>=1.0
|
||||||
|
packaging>=23
|
||||||
|
octoprint_setuptools>=1.7.0
|
||||||
|
|
@@ -23,7 +23,12 @@ if [[ ! -x "$VENV_DIR/bin/python" ]]; then
|
|||||||
python3 -m venv "$VENV_DIR"
|
python3 -m venv "$VENV_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$VENV_DIR/bin/pip" install -q --upgrade pip setuptools wheel build packaging octoprint_setuptools
|
if [[ -f "$ROOT_DIR/requirements.txt" ]]; then
|
||||||
|
"$VENV_DIR/bin/pip" install -q --upgrade pip
|
||||||
|
"$VENV_DIR/bin/pip" install -q -r "$ROOT_DIR/requirements.txt"
|
||||||
|
else
|
||||||
|
"$VENV_DIR/bin/pip" install -q --upgrade pip setuptools wheel build packaging octoprint_setuptools
|
||||||
|
fi
|
||||||
|
|
||||||
# Optional: bump version
|
# Optional: bump version
|
||||||
if [[ -n "$VERSION_INPUT" ]]; then
|
if [[ -n "$VERSION_INPUT" ]]; then
|
||||||
|
Reference in New Issue
Block a user