From 88117941c5dac0c6c9d8c76c6a8682bd6daf4659 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 7 Sep 2022 20:26:44 +1000 Subject: [PATCH] Fix #2387. Bundling for Blender makefile now works on Mac. Thanks dirkolbrich! --- src/blenderbim/Makefile | 34 +++++++++++++++++------ src/blenderbim/docs/devs/installation.rst | 13 +++++---- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/blenderbim/Makefile b/src/blenderbim/Makefile index c9dd15b758..1797e9a243 100644 --- a/src/blenderbim/Makefile +++ b/src/blenderbim/Makefile @@ -16,6 +16,24 @@ # You should have received a copy of the GNU General Public License # along with BlenderBIM Add-on. If not, see . +PYTHON:=python +PATCH:=patch +SED:=sed -i +ifeq ($(OS),Windows_NT) +HOSTOS:=win +else +UNAME_S:=$(shell uname -s) +ifeq ($(UNAME_S),Linux) +HOSTOS:=linux +endif +ifeq ($(UNAME_S),Darwin) +HOSTOS:=macos +PYTHON:=python3 +PATCH:=patch -d +SED:=sed -i '' -e +endif +endif + VERSION:=`date '+%y%m%d'` PYVERSION:=py37 @@ -138,7 +156,7 @@ endif # Provides IFCClash functionality cp -r dist/working/IfcOpenShell-0.7.0/src/ifcclash/ifcclash dist/blenderbim/libs/site/packages/ # Provides BIMTester functionality - cd dist/working && python -m venv env + cd dist/working && $(PYTHON) -m venv env cd dist/working && . env/bin/activate && pip install pybabel cd dist/working && . env/bin/activate && pip install babel cd dist/working && . env/bin/activate && ./env/bin/pybabel compile -d ./IfcOpenShell-0.7.0/src/ifcbimtester/bimtester/locale/ @@ -163,9 +181,9 @@ endif # Provides Mustache templating in construction documentation mkdir dist/working - cd dist/working && wget https://files.pythonhosted.org/packages/d6/fd/eb8c212053addd941cc90baac307c00ac246ac3fce7166b86434c6eae963/pystache-0.5.4.tar.gz + cd dist/working && wget https://files.pythonhosted.org/packages/3f/e7/8750ba6c6101d6aa5ceeb20c013adf2c6f3554a12c71d75654b468404bfa/pystache-0.6.0.tar.gz cd dist/working && tar -xzvf pystache* - cd dist/working/pystache-0.5.4/ && python setup.py build && cp -r build/lib/pystache ../../blenderbim/libs/site/packages/ + cd dist/working/pystache-0.6.0/ && $(PYTHON) setup.py build && cp -r build/lib/pystache ../../blenderbim/libs/site/packages/ rm -rf dist/working # Provides SVG export in construction documentation @@ -283,7 +301,7 @@ endif # Required by IFCCityJSON mkdir dist/working - cd dist/working && python -m venv env + cd dist/working && $(PYTHON) -m venv env cd dist/working && mkdir site-packages cd dist/working && . env/bin/activate && pip install cjio --target=./site-packages cd dist/working/site-packages/ && rm -r *dist-info* @@ -391,11 +409,11 @@ endif # See bug #1294 cd dist/working/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.7.0/src/ifcbimtester/patch/model_core.patch cd dist/working/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.7.0/src/ifcbimtester/patch/runner_util.patch - cd dist/working/ && patch ../blenderbim/libs/site/packages/behave/model_core.py < model_core.patch - cd dist/working/ && patch ../blenderbim/libs/site/packages/behave/runner_util.py < runner_util.patch + cd dist/working/ && $(PATCH) ../blenderbim/libs/site/packages/behave/model_core.py < model_core.patch + cd dist/working/ && $(PATCH) ../blenderbim/libs/site/packages/behave/runner_util.py < runner_util.patch # See bug #2159 cd dist/working/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.7.0/src/ifcbimtester/patch/junit.patch - cd dist/working/ && patch ../blenderbim/libs/site/packages/behave/reporter/junit.py < junit.patch + cd dist/working/ && $(PATCH) ../blenderbim/libs/site/packages/behave/reporter/junit.py < junit.patch rm -rf dist/working # Required by ids - uh, not any more, but I'm trying it out in the drawing module @@ -523,7 +541,7 @@ endif cd dist/working/ && cp -r pkg_resources ../blenderbim/libs/site/packages/ rm -rf dist/working - cd dist/blenderbim && sed -i "s/999999/$(VERSION)/" __init__.py + cd dist/blenderbim && $(SED) "s/999999/$(VERSION)/" __init__.py cd dist && zip -r blenderbim-$(VERSION)-$(PYVERSION)-$(PLATFORM).zip ./* rm -rf dist/blenderbim diff --git a/src/blenderbim/docs/devs/installation.rst b/src/blenderbim/docs/devs/installation.rst index ac345ff1d0..10fbbfd339 100644 --- a/src/blenderbim/docs/devs/installation.rst +++ b/src/blenderbim/docs/devs/installation.rst @@ -4,7 +4,7 @@ Installation There are different methods of installation, depending on your situation. 1. **Unstable installation** is recommended for power users helping with testing. -2. **Building from source** is recommended for distributing a build from source. +2. **Bundling for Blender** is recommended for distributing the add-on. 3. **Live development environment** is recommended for developers who are actively coding. 4. **Packaged installation** is recommended for those who use a package manager. @@ -27,12 +27,13 @@ You will need to choose which build to download. Sometimes, a build may be delayed, or contain broken code. We try to avoid this, but it happens. -Building from source +Bundling for Blender -------------------- -It is possible to run the latest bleeding edge version of BlenderBIM without -having to wait for an official release, since BlenderBIM is coded in Python and -doesn't require any compilation. +Instead of waiting for an official release on the BlenderBIM Add-on website, it +is possible to make your own Blender add-on from the bleeding edge source code +of BlenderBIM. BlenderBIM is coded in Python and doesn't require any +compilation, so this is a relatively easy process. Note that the BlenderBIM Add-on does depend on IfcOpenShell, and IfcOpenShell does require compilation. The following instructions will use a pre-built @@ -55,7 +56,7 @@ Live development environment ---------------------------- One option for developers who want to actively develop from source is to follow -the instructions from **Building from source**. However, creating a build, +the instructions from **Bundling for Blender**. However, creating a build, uninstalling the old add-on, and installing a new build is a slow process. Although it works, it is very slow, so we do not recommend it.