Skip to content

Commit 0ecc3d3

Browse files
committed
Share common makefile instructions, use venv for running build, and separate dist/build dirs
1 parent 237cd99 commit 0ecc3d3

File tree

17 files changed

+72
-208
lines changed

17 files changed

+72
-208
lines changed

src/bcf/Makefile

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with BCF. If not, see <http://www.gnu.org/licenses/>.
1818

19-
VERSION:=$(shell cat ../../VERSION)
20-
SED:=sed -i
21-
ifeq ($(UNAME_S),Darwin)
22-
SED:=sed -i '' -e
23-
endif
19+
PACKAGE_NAME:=bcf
20+
include ../common.mk
2421

2522
.PHONY: ci
2623
ci:
@@ -36,17 +33,6 @@ models:
3633
cd src && xsdata generate -p bcf.v2.model --unnest-classes --kw-only --slots -ds Google bcf/v2/xsd
3734
cd src && xsdata generate -p bcf.v3.model --unnest-classes --kw-only --slots -ds Google bcf/v3/xsd
3835

39-
.PHONY: dist
40-
dist:
41-
rm -rf dist
42-
cp pyproject.toml pyproject.toml.bak
43-
cp src/bcf/__init__.py __init__.py.bak
44-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
45-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' src/bcf/__init__.py
46-
python -m build
47-
mv pyproject.toml.bak pyproject.toml
48-
mv __init__.py.bak src/bcf/__init__.py
49-
5036
# .PHONY
5137
# api:
5238
# openapi-python-client generate --url https://api.swaggerhub.com/apis/buildingSMART/BCF/3.0

src/bsdd/Makefile

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,10 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with bSDD. If not, see <http://www.gnu.org/licenses/>.
1818

19-
VERSION:=$(shell cat ../../VERSION)
20-
SED:=sed -i
21-
ifeq ($(UNAME_S),Darwin)
22-
SED:=sed -i '' -e
23-
endif
19+
PACKAGE_NAME:=bsdd.py
20+
IS_MODULE:=true
21+
include ../common.mk
2422

2523
.PHONY: test
2624
test:
2725
pytest -p no:pytest-blender test
28-
29-
.PHONY: dist
30-
dist:
31-
rm -rf dist
32-
cp pyproject.toml pyproject.toml.bak
33-
cp bsdd.py bsdd.py.bak
34-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
35-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' bsdd.py
36-
python -m build
37-
mv pyproject.toml.bak pyproject.toml
38-
mv bsdd.py.bak bsdd.py

src/common.mk

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
PYTHON:=python3.11
2+
PIP:=pip3.11
3+
VERSION:=$(shell cat ../../VERSION)
4+
SED:=sed -i
5+
ifeq ($(UNAME_S),Darwin)
6+
SED:=sed -i '' -e
7+
PYTHON:=python3
8+
endif
9+
10+
.PHONY: dist
11+
dist:
12+
rm -rf build
13+
mkdir -p build
14+
mkdir -p dist
15+
cp -r $(PACKAGE_NAME) build/
16+
cp pyproject.toml build/
17+
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/pyproject.toml
18+
ifdef IS_MODULE
19+
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/$(PACKAGE_NAME)
20+
else
21+
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/$(PACKAGE_NAME)/__init__.py
22+
endif
23+
cd build && $(PYTHON) -m venv env && . env/bin/activate && $(PIP) install build
24+
cd build && . env/bin/activate && $(PYTHON) -m build
25+
cp build/dist/*.whl dist/
26+
rm -rf build

src/ifc4d/Makefile

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,9 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Ifc4D. If not, see <http://www.gnu.org/licenses/>.
1818

19-
VERSION:=$(shell cat ../../VERSION)
20-
SED:=sed -i
21-
ifeq ($(UNAME_S),Darwin)
22-
SED:=sed -i '' -e
23-
endif
19+
PACKAGE_NAME:=ifc4d
20+
include ../common.mk
2421

2522
.PHONY: qa
2623
qa:
2724
black .
28-
29-
.PHONY: dist
30-
dist:
31-
rm -rf dist
32-
cp pyproject.toml pyproject.toml.bak
33-
cp ifc4d/__init__.py __init__.py.bak
34-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
35-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifc4d/__init__.py
36-
python -m build
37-
mv pyproject.toml.bak pyproject.toml
38-
mv __init__.py.bak ifc4d/__init__.py

src/ifc5d/Makefile

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,9 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Ifc5D. If not, see <http://www.gnu.org/licenses/>.
1818

19-
VERSION:=$(shell cat ../../VERSION)
20-
SED:=sed -i
21-
ifeq ($(UNAME_S),Darwin)
22-
SED:=sed -i '' -e
23-
endif
19+
PACKAGE_NAME:=ifc5d
20+
include ../common.mk
2421

2522
.PHONY: qa
2623
qa:
2724
black .
28-
29-
.PHONY: dist
30-
dist:
31-
rm -rf dist
32-
cp pyproject.toml pyproject.toml.bak
33-
cp ifc5d/__init__.py __init__.py.bak
34-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
35-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifc5d/__init__.py
36-
python -m build
37-
mv pyproject.toml.bak pyproject.toml
38-
mv __init__.py.bak ifc5d/__init__.py

src/ifccityjson/Makefile

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,9 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with IfcCityJSON. If not, see <http://www.gnu.org/licenses/>.
1818

19-
VERSION:=$(shell cat ../../VERSION)
20-
SED:=sed -i
21-
ifeq ($(UNAME_S),Darwin)
22-
SED:=sed -i '' -e
23-
endif
19+
PACKAGE_NAME:=ifccityjson
20+
include ../common.mk
2421

2522
.PHONY: qa
2623
qa:
2724
black .
28-
29-
.PHONY: dist
30-
dist:
31-
rm -rf dist
32-
cp pyproject.toml pyproject.toml.bak
33-
cp ifccityjson/__init__.py __init__.py.bak
34-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
35-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifccityjson/__init__.py
36-
python -m build
37-
mv pyproject.toml.bak pyproject.toml
38-
mv __init__.py.bak ifccityjson/__init__.py

src/ifcclash/Makefile

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,9 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with IfcClash. If not, see <http://www.gnu.org/licenses/>.
1818

19-
VERSION:=$(shell cat ../../VERSION)
20-
SED:=sed -i
21-
ifeq ($(UNAME_S),Darwin)
22-
SED:=sed -i '' -e
23-
endif
19+
PACKAGE_NAME:=ifcclash
20+
include ../common.mk
2421

2522
.PHONY: qa
2623
qa:
2724
black .
28-
29-
.PHONY: dist
30-
dist:
31-
rm -rf dist
32-
cp pyproject.toml pyproject.toml.bak
33-
cp ifcclash/__init__.py __init__.py.bak
34-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
35-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifcclash/__init__.py
36-
python -m build
37-
mv pyproject.toml.bak pyproject.toml
38-
mv __init__.py.bak ifcclash/__init__.py

src/ifccsv/Makefile

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,10 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with IfcCSV. If not, see <http://www.gnu.org/licenses/>.
1818

19-
VERSION:=$(shell cat ../../VERSION)
20-
SED:=sed -i
21-
ifeq ($(UNAME_S),Darwin)
22-
SED:=sed -i '' -e
23-
endif
19+
PACKAGE_NAME:=ifccsv.py
20+
IS_MODULE:=true
21+
include ../common.mk
2422

2523
.PHONY: qa
2624
qa:
2725
black .
28-
29-
.PHONY: dist
30-
dist:
31-
rm -rf dist
32-
cp pyproject.toml pyproject.toml.bak
33-
cp ifccsv.py ifccsv.py.bak
34-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
35-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifccsv.py
36-
python -m build
37-
mv pyproject.toml.bak pyproject.toml
38-
mv ifccsv.py.bak ifccsv.py

src/ifcdiff/Makefile

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,10 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with IfcDiff. If not, see <http://www.gnu.org/licenses/>.
1818

19-
VERSION:=$(shell cat ../../VERSION)
20-
SED:=sed -i
21-
ifeq ($(UNAME_S),Darwin)
22-
SED:=sed -i '' -e
23-
endif
19+
PACKAGE_NAME:=ifcdiff.py
20+
IS_MODULE:=true
21+
include ../common.mk
2422

2523
.PHONY: qa
2624
qa:
2725
black .
28-
29-
.PHONY: dist
30-
dist:
31-
rm -rf dist
32-
cp pyproject.toml pyproject.toml.bak
33-
cp ifcdiff.py ifcdiff.py.bak
34-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
35-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifcdiff.py
36-
python -m build
37-
mv pyproject.toml.bak pyproject.toml
38-
mv ifcdiff.py.bak ifcdiff.py

src/ifcfm/Makefile

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,9 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with IfcFM. If not, see <http://www.gnu.org/licenses/>.
1818

19-
VERSION:=$(shell cat ../../VERSION)
20-
SED:=sed -i
21-
ifeq ($(UNAME_S),Darwin)
22-
SED:=sed -i '' -e
23-
endif
19+
PACKAGE_NAME:=ifcfm
20+
include ../common.mk
2421

2522
.PHONY: qa
2623
qa:
2724
black .
28-
29-
.PHONY: dist
30-
dist:
31-
rm -rf dist
32-
cp pyproject.toml pyproject.toml.bak
33-
cp ifcfm/__init__.py __init__.py.bak
34-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
35-
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' ifcfm/__init__.py
36-
python -m build
37-
mv pyproject.toml.bak pyproject.toml
38-
mv __init__.py.bak ifcfm/__init__.py

0 commit comments

Comments
 (0)