diff --git a/src/blenderbim/Makefile b/src/blenderbim/Makefile index 1603e887b5..ac666761d0 100644 --- a/src/blenderbim/Makefile +++ b/src/blenderbim/Makefile @@ -189,6 +189,10 @@ else ifeq ($(PLATFORM), macos) else cd build && . env/$(VENV_ACTIVATE) && $(PIP) download pyradiance $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels endif + # tomllib replacement for < Python 3.11, used to parse blender_manifest +ifeq ($(PYVERSION), py310) + cd build && . env/$(VENV_ACTIVATE) && $(PIP) download tomli --dest=./wheels +endif # Provides jsgantt-improved supports for web-based construction sequencing gantt charts cd build/blenderbim/bim/data/gantt/ && wget https://raw.githubusercontent.com/jsGanttImproved/jsgantt-improved/master/dist/jsgantt.js diff --git a/src/blenderbim/blenderbim/__init__.py b/src/blenderbim/blenderbim/__init__.py index 10bcee7006..f11732590f 100644 --- a/src/blenderbim/blenderbim/__init__.py +++ b/src/blenderbim/blenderbim/__init__.py @@ -68,11 +68,14 @@ def initialize_bbim_semver(): in `addon_utils.modules()->bl_info['version']`, therefore we just parse it from .toml. """ - import tomllib + if sys.version_info >= (3, 11): + import tomllib as toml + else: + import tomli as toml toml_path = Path(__file__).parent / "blender_manifest.toml" with open(toml_path, "rb") as f: - manifest = tomllib.load(f) + manifest = toml.load(f) semver_pattern = r"^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" version_str = manifest["version"] re_version = re.match(semver_pattern, version_str)