diff --git a/src/bcf/Makefile b/src/bcf/Makefile
index a669362cc8..daf7696155 100644
--- a/src/bcf/Makefile
+++ b/src/bcf/Makefile
@@ -16,11 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with BCF. If not, see .
-VERSION:=$(shell cat ../../VERSION)
-SED:=sed -i
-ifeq ($(UNAME_S),Darwin)
-SED:=sed -i '' -e
-endif
+PACKAGE_NAME:=bcf
+include ../common.mk
.PHONY: ci
ci:
@@ -36,17 +33,6 @@ models:
cd src && xsdata generate -p bcf.v2.model --unnest-classes --kw-only --slots -ds Google bcf/v2/xsd
cd src && xsdata generate -p bcf.v3.model --unnest-classes --kw-only --slots -ds Google bcf/v3/xsd
-.PHONY: dist
-dist:
- rm -rf dist
- cp pyproject.toml pyproject.toml.bak
- cp src/bcf/__init__.py __init__.py.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' src/bcf/__init__.py
- python -m build
- mv pyproject.toml.bak pyproject.toml
- mv __init__.py.bak src/bcf/__init__.py
-
# .PHONY
# api:
# openapi-python-client generate --url https://api.swaggerhub.com/apis/buildingSMART/BCF/3.0
diff --git a/src/bsdd/Makefile b/src/bsdd/Makefile
index 4dc7bdc5f5..8eaf0bbf83 100644
--- a/src/bsdd/Makefile
+++ b/src/bsdd/Makefile
@@ -16,23 +16,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with bSDD. If not, see .
-VERSION:=$(shell cat ../../VERSION)
-SED:=sed -i
-ifeq ($(UNAME_S),Darwin)
-SED:=sed -i '' -e
-endif
+PACKAGE_NAME:=bsdd.py
+IS_MODULE:=true
+include ../common.mk
.PHONY: test
test:
pytest -p no:pytest-blender test
-
-.PHONY: dist
-dist:
- rm -rf dist
- cp pyproject.toml pyproject.toml.bak
- cp bsdd.py bsdd.py.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' bsdd.py
- python -m build
- mv pyproject.toml.bak pyproject.toml
- mv bsdd.py.bak bsdd.py
diff --git a/src/common.mk b/src/common.mk
new file mode 100644
index 0000000000..8889cd2106
--- /dev/null
+++ b/src/common.mk
@@ -0,0 +1,26 @@
+PYTHON:=python3.11
+PIP:=pip3.11
+VERSION:=$(shell cat ../../VERSION)
+SED:=sed -i
+ifeq ($(UNAME_S),Darwin)
+SED:=sed -i '' -e
+PYTHON:=python3
+endif
+
+.PHONY: dist
+dist:
+ rm -rf build
+ mkdir -p build
+ mkdir -p dist
+ cp -r $(PACKAGE_NAME) build/
+ cp pyproject.toml build/
+ $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/pyproject.toml
+ifdef IS_MODULE
+ $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/$(PACKAGE_NAME)
+else
+ $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/$(PACKAGE_NAME)/__init__.py
+endif
+ cd build && $(PYTHON) -m venv env && . env/bin/activate && $(PIP) install build
+ cd build && . env/bin/activate && $(PYTHON) -m build
+ cp build/dist/*.whl dist/
+ rm -rf build
diff --git a/src/ifc4d/Makefile b/src/ifc4d/Makefile
index f0d0d52c45..56bc078654 100644
--- a/src/ifc4d/Makefile
+++ b/src/ifc4d/Makefile
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Ifc4D. If not, see .
-VERSION:=$(shell cat ../../VERSION)
-SED:=sed -i
-ifeq ($(UNAME_S),Darwin)
-SED:=sed -i '' -e
-endif
+PACKAGE_NAME:=ifc4d
+include ../common.mk
.PHONY: qa
qa:
black .
-
-.PHONY: dist
-dist:
- rm -rf dist
- cp pyproject.toml pyproject.toml.bak
- cp ifc4d/__init__.py __init__.py.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifc4d/__init__.py
- python -m build
- mv pyproject.toml.bak pyproject.toml
- mv __init__.py.bak ifc4d/__init__.py
diff --git a/src/ifc5d/Makefile b/src/ifc5d/Makefile
index 8ae5d28733..e6bf8b36dc 100644
--- a/src/ifc5d/Makefile
+++ b/src/ifc5d/Makefile
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Ifc5D. If not, see .
-VERSION:=$(shell cat ../../VERSION)
-SED:=sed -i
-ifeq ($(UNAME_S),Darwin)
-SED:=sed -i '' -e
-endif
+PACKAGE_NAME:=ifc5d
+include ../common.mk
.PHONY: qa
qa:
black .
-
-.PHONY: dist
-dist:
- rm -rf dist
- cp pyproject.toml pyproject.toml.bak
- cp ifc5d/__init__.py __init__.py.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifc5d/__init__.py
- python -m build
- mv pyproject.toml.bak pyproject.toml
- mv __init__.py.bak ifc5d/__init__.py
diff --git a/src/ifccityjson/Makefile b/src/ifccityjson/Makefile
index d26a4b26f7..e3a45e4d39 100644
--- a/src/ifccityjson/Makefile
+++ b/src/ifccityjson/Makefile
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcCityJSON. If not, see .
-VERSION:=$(shell cat ../../VERSION)
-SED:=sed -i
-ifeq ($(UNAME_S),Darwin)
-SED:=sed -i '' -e
-endif
+PACKAGE_NAME:=ifccityjson
+include ../common.mk
.PHONY: qa
qa:
black .
-
-.PHONY: dist
-dist:
- rm -rf dist
- cp pyproject.toml pyproject.toml.bak
- cp ifccityjson/__init__.py __init__.py.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifccityjson/__init__.py
- python -m build
- mv pyproject.toml.bak pyproject.toml
- mv __init__.py.bak ifccityjson/__init__.py
diff --git a/src/ifcclash/Makefile b/src/ifcclash/Makefile
index 5c577b742f..276dabfd3c 100644
--- a/src/ifcclash/Makefile
+++ b/src/ifcclash/Makefile
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcClash. If not, see .
-VERSION:=$(shell cat ../../VERSION)
-SED:=sed -i
-ifeq ($(UNAME_S),Darwin)
-SED:=sed -i '' -e
-endif
+PACKAGE_NAME:=ifcclash
+include ../common.mk
.PHONY: qa
qa:
black .
-
-.PHONY: dist
-dist:
- rm -rf dist
- cp pyproject.toml pyproject.toml.bak
- cp ifcclash/__init__.py __init__.py.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifcclash/__init__.py
- python -m build
- mv pyproject.toml.bak pyproject.toml
- mv __init__.py.bak ifcclash/__init__.py
diff --git a/src/ifccsv/Makefile b/src/ifccsv/Makefile
index ef46788ad5..33b96336b2 100644
--- a/src/ifccsv/Makefile
+++ b/src/ifccsv/Makefile
@@ -16,23 +16,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcCSV. If not, see .
-VERSION:=$(shell cat ../../VERSION)
-SED:=sed -i
-ifeq ($(UNAME_S),Darwin)
-SED:=sed -i '' -e
-endif
+PACKAGE_NAME:=ifccsv.py
+IS_MODULE:=true
+include ../common.mk
.PHONY: qa
qa:
black .
-
-.PHONY: dist
-dist:
- rm -rf dist
- cp pyproject.toml pyproject.toml.bak
- cp ifccsv.py ifccsv.py.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifccsv.py
- python -m build
- mv pyproject.toml.bak pyproject.toml
- mv ifccsv.py.bak ifccsv.py
diff --git a/src/ifcdiff/Makefile b/src/ifcdiff/Makefile
index 5f9eb9818a..3a1b16b3e7 100644
--- a/src/ifcdiff/Makefile
+++ b/src/ifcdiff/Makefile
@@ -16,23 +16,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcDiff. If not, see .
-VERSION:=$(shell cat ../../VERSION)
-SED:=sed -i
-ifeq ($(UNAME_S),Darwin)
-SED:=sed -i '' -e
-endif
+PACKAGE_NAME:=ifcdiff.py
+IS_MODULE:=true
+include ../common.mk
.PHONY: qa
qa:
black .
-
-.PHONY: dist
-dist:
- rm -rf dist
- cp pyproject.toml pyproject.toml.bak
- cp ifcdiff.py ifcdiff.py.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifcdiff.py
- python -m build
- mv pyproject.toml.bak pyproject.toml
- mv ifcdiff.py.bak ifcdiff.py
diff --git a/src/ifcfm/Makefile b/src/ifcfm/Makefile
index 59b1ae81ec..1d78071fcc 100644
--- a/src/ifcfm/Makefile
+++ b/src/ifcfm/Makefile
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcFM. If not, see .
-VERSION:=$(shell cat ../../VERSION)
-SED:=sed -i
-ifeq ($(UNAME_S),Darwin)
-SED:=sed -i '' -e
-endif
+PACKAGE_NAME:=ifcfm
+include ../common.mk
.PHONY: qa
qa:
black .
-
-.PHONY: dist
-dist:
- rm -rf dist
- cp pyproject.toml pyproject.toml.bak
- cp ifcfm/__init__.py __init__.py.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifcfm/__init__.py
- python -m build
- mv pyproject.toml.bak pyproject.toml
- mv __init__.py.bak ifcfm/__init__.py
diff --git a/src/ifcopenshell-python/Makefile b/src/ifcopenshell-python/Makefile
index 404cfbfaca..341b9dda2c 100644
--- a/src/ifcopenshell-python/Makefile
+++ b/src/ifcopenshell-python/Makefile
@@ -3,6 +3,7 @@ PYVERSION:=py311
PLATFORM:=linux64
PYTHON:=python3.11
+PIP:=pip3.11
SED:=sed -i
ifeq ($(OS),Windows_NT)
HOSTOS:=win
@@ -105,28 +106,21 @@ dist:
ifndef PLATFORM
$(error PLATFORM is not set)
endif
- rm -rf dist
- mkdir -p dist/working
- mkdir -p dist/ifcopenshell
- cp -r ifcopenshell/* dist/ifcopenshell/
+ rm -rf build
+ mkdir -p build
+ mkdir -p dist
+ cp -r ifcopenshell build/
- cd dist/working && $(PYTHON) -m venv env
- cd dist/working && . env/bin/activate && $(PIP) install build
+ mkdir build/botbuild
+ cd build/botbuild && wget $(IOS_URL) && unzip ifcopenshell-python*
+ cp -r build/botbuild/ifcopenshell/*ifcopenshell_wrapper* build/ifcopenshell/
+ cp ../../README.md build/
+ cp pyproject.toml build/
+ $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/pyproject.toml
+ $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/ifcopenshell/__init__.py
- cd dist/working && wget $(IOS_URL)
- cd dist/working && unzip ifcopenshell-python*
- cp -r dist/working/ifcopenshell/*ifcopenshell_wrapper* dist/ifcopenshell/
- rm -rf dist/working
- # distutils cannot access anything outside the cwd, so hackishly swap out the README.md
- cp README.md ../README.bak
- cp ../../README.md README.md
- cp pyproject.toml pyproject.toml.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' dist/ifcopenshell/__init__.py
- . dist/working/env/bin/activate && $(PYTHON) -m build
- mv pyproject.toml.bak pyproject.toml
- mv ../README.bak README.md
- cd dist && mv ifcopenshell-$(VERSION)-py3-none-any.whl ifcopenshell-$(VERSION)-$(PYVERSION)-none-$(PLATFORMTAG).whl
- rm -rf dist/ifcopenshell
- rm -rf dist/ifcopenshell.egg-info
- rm -rf dist/ifcopenshell-$(VERSION).tar.gz
+ cd build && $(PYTHON) -m venv env && . env/bin/activate && $(PIP) install build
+ cd build && . env/bin/activate && $(PYTHON) -m build
+
+ mv build/dist/ifcopenshell-$(VERSION)-py3-none-any.whl dist/ifcopenshell-$(VERSION)-$(PYVERSION)-none-$(PLATFORMTAG).whl
+ rm -rf build
diff --git a/src/ifcopenshell-python/pyproject.toml b/src/ifcopenshell-python/pyproject.toml
index 73560d317b..ce752e4720 100644
--- a/src/ifcopenshell-python/pyproject.toml
+++ b/src/ifcopenshell-python/pyproject.toml
@@ -35,7 +35,6 @@ dev = ["pytest"]
"Bug Tracker" = "https://github.com/ifcopenshell/ifcopenshell/issues"
[tool.setuptools.packages.find]
-where = ["dist"]
include = ["ifcopenshell*"]
[tool.setuptools.package-data]
diff --git a/src/ifcpatch/Makefile b/src/ifcpatch/Makefile
index a55e7ea17a..49e1c677db 100644
--- a/src/ifcpatch/Makefile
+++ b/src/ifcpatch/Makefile
@@ -16,11 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see .
-VERSION:=$(shell cat ../../VERSION)
-SED:=sed -i
-ifeq ($(UNAME_S),Darwin)
-SED:=sed -i '' -e
-endif
+PACKAGE_NAME:=ifcpatch
+include ../common.mk
.PHONY: test
test:
@@ -29,14 +26,3 @@ test:
.PHONY: qa
qa:
black .
-
-.PHONY: dist
-dist:
- rm -rf dist
- cp pyproject.toml pyproject.toml.bak
- cp ifcpatch/__init__.py __init__.py.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifcpatch/__init__.py
- python -m build
- mv pyproject.toml.bak pyproject.toml
- mv __init__.py.bak ifcpatch/__init__.py
diff --git a/src/ifctester/Makefile b/src/ifctester/Makefile
index 35530255ff..3597bf96e1 100644
--- a/src/ifctester/Makefile
+++ b/src/ifctester/Makefile
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcTester. If not, see .
-VERSION:=$(shell cat ../../VERSION)
-SED:=sed -i
-ifeq ($(UNAME_S),Darwin)
-SED:=sed -i '' -e
-endif
+PACKAGE_NAME:=ifctester
+include ../common.mk
.PHONY: test
test:
pytest -p no:pytest-blender test
-
-.PHONY: dist
-dist:
- rm -rf dist
- cp pyproject.toml pyproject.toml.bak
- cp ifctester/__init__.py __init__.py.bak
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
- $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifctester/__init__.py
- python -m build
- mv pyproject.toml.bak pyproject.toml
- mv __init__.py.bak ifctester/__init__.py
diff --git a/src/ifctester/build/.gitignore b/src/ifctester/build/.gitignore
deleted file mode 100644
index d6b7ef32c8..0000000000
--- a/src/ifctester/build/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
diff --git a/src/ifctester/build/files/.gitignore b/src/ifctester/build/files/.gitignore
deleted file mode 100644
index d6b7ef32c8..0000000000
--- a/src/ifctester/build/files/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!.gitignore
diff --git a/src/ifctester/pyproject.toml b/src/ifctester/pyproject.toml
index 2f97bda807..04f67b5770 100644
--- a/src/ifctester/pyproject.toml
+++ b/src/ifctester/pyproject.toml
@@ -23,8 +23,8 @@ Documentation = "https://docs.ifcopenshell.org"
Issues = "https://github.com/IfcOpenShell/IfcOpenShell/issues"
[tool.setuptools.packages.find]
-include = ["ifctester"]
+include = ["ifctester*"]
exclude = ["test*"]
[tool.setuptools.package-data]
-ifctester = ["*.xsd", "templates/*.html"]
+"*" = ["*.*"]