-
-
Notifications
You must be signed in to change notification settings - Fork 901
Expand file tree
/
Copy pathMakefile
More file actions
161 lines (138 loc) · 4.67 KB
/
Makefile
File metadata and controls
161 lines (138 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
SHELL := sh
IS_STABLE:=FALSE
VERSION:=$(shell cat ../../VERSION)
VERSION_DATE:=$(shell date '+%y%m%d')
PYVERSION:=py311
PLATFORM:=linux64
PYTHON:=python3.11
PIP:=pip3.11
SED:=sed -i
VENV_ACTIVATE:=bin/activate
ifeq ($(OS),Windows_NT)
HOSTOS:=win
PYTHON:=python
VENV_ACTIVATE:=Scripts/activate
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
SUPPORTED_PYVERSIONS := py310 py311 py312 py313 py314
ifeq ($(filter $(PYVERSION),$(SUPPORTED_PYVERSIONS)),)
$(error Unsupported PYVERSION=$(PYVERSION). Must be one of $(SUPPORTED_PYVERSIONS))
endif
PYMINOR:=$(subst py3,,$(PYVERSION))
PYNUMBER:=3$(PYMINOR)
# We actually do support glibc 2.28-2.30 (see #5636)
# but those are old and there's no demand for it.
ifeq ($(PLATFORM), linux64)
PLATFORMTAG:=manylinux_2_31_x86_64
endif
ifeq ($(PLATFORM), linuxarm64)
PLATFORMTAG:=manylinux_2_31_aarch64
endif
ifeq ($(PLATFORM), macos64)
PLATFORMTAG:=macosx_10_15_x86_64
endif
ifeq ($(PLATFORM), macosm164)
PLATFORMTAG:=macosx_11_0_arm64
endif
ifeq ($(PLATFORM), win64)
PLATFORMTAG:=win_amd64
endif
BINARY_VERSION:=0.8.5
BUILD_COMMIT:=1c5b825
IOS_URL:=https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-$(PYNUMBER)-v$(BINARY_VERSION)-$(BUILD_COMMIT)-$(PLATFORM).zip
IFCCONVERT_URL:=https://s3.amazonaws.com/ifcopenshell-builds/IfcConvert-v$(BINARY_VERSION)-$(BUILD_COMMIT)-$(PLATFORM).zip
.PHONY: build-urls
build-urls:
@echo "You can provide one of the 4 platforms (linux64, macos64, macosm164, win64) using 'PLATFORM=xxx'."
@echo "And Python version using 'PYNUMBER=xx' (e.g. 'PYNUMBER=311')."
@echo ${IOS_URL}
@echo ${IFCCONVERT_URL}
.PHONY: test
test:
pytest -p no:pytest-blender test --ignore=test/util/test_shape_builder.py
.PHONY: test-parallel
test-parallel:
@NPROCS=$$(nproc 2>/dev/null || sysctl -n hw.ncpu); \
pytest -p no:pytest-blender -n $$NPROCS test --ignore=test/util/test_shape_builder.py
.PHONY: test-mathutils
test-mathutils:
pytest -p no:pytest-blender test/util/test_shape_builder.py
.PHONY: qa
qa:
black .
pylint ./* --output-format=colorized --disable all --enable E
.PHONY: license
license:
#copyright-header --license LGPL3 --copyright-holder "Thomas Krijnen <thomas@aecgeeks.com>" --copyright-year "2022" --copyright-software "IfcOpenShell" --copyright-software-description "IFC toolkit and geometry engine" -a ./ -o ./
copyright-header --license LGPL3 --copyright-holder "Dion Moult <dion@thinkmoult.com>" --copyright-year "2022" --copyright-software "IfcOpenShell" --copyright-software-description "IFC toolkit and geometry engine" -a ./ -o ./
.PHONY: coverage
coverage:
coverage run --source ifcopenshell -m pytest -p no:pytest-blender test
coverage html
xdg-open htmlcov/index.html
.PHONY: clean
clean:
rm -rf htmlcov
.PHONY: zip-ifcconvert
zip-ifcconvert:
ifndef PLATFORM
$(error PLATFORM is not set)
endif
mkdir -p dist
cd dist && wget $(IFCCONVERT_URL)
cd dist && mv *.zip ifcconvert-$(VERSION)-$(PLATFORM).zip
.PHONY: zip
zip:
ifndef PLATFORM
$(error PLATFORM is not set)
endif
rm -rf dist
mkdir -p dist/working
mkdir -p dist/ifcopenshell
cp -r ifcopenshell/* dist/ifcopenshell/
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
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' dist/ifcopenshell/__init__.py
cd dist && zip -r ifcopenshell-python-$(VERSION)-$(PYVERSION)-$(PLATFORM).zip ifcopenshell
rm -rf dist/ifcopenshell
.PHONY: dist
dist:
ifndef PLATFORM
$(error PLATFORM is not set)
endif
rm -rf build
mkdir -p build
mkdir -p dist
cp -r ifcopenshell 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/
ifeq ($(IS_STABLE), TRUE)
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/pyproject.toml
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/ifcopenshell/__init__.py
else
$(SED) 's/version = "0.0.0"/version = "$(VERSION)a$(VERSION_DATE)"/' build/pyproject.toml
$(SED) 's/version = "0.0.0"/version = "$(VERSION)-alpha$(VERSION_DATE)"/' build/ifcopenshell/__init__.py
endif
cd build && $(PYTHON) -m venv env && . env/$(VENV_ACTIVATE) && $(PIP) install build
cd build && . env/$(VENV_ACTIVATE) && $(PYTHON) -m build
ifeq ($(IS_STABLE), TRUE)
mv build/dist/ifcopenshell-*.whl dist/ifcopenshell-$(VERSION)-$(PYVERSION)-none-$(PLATFORMTAG).whl
else
cp build/dist/ifcopenshell-*.whl dist/ifcopenshell-$(VERSION)a$(VERSION_DATE)-$(PYVERSION)-none-$(PLATFORMTAG).whl
endif
rm -rf build