Share common makefile instructions, use venv for running build, and separate dist/build dirs

This commit is contained in:
Dion Moult
2024-07-18 23:43:12 +10:00
parent 237cd99e3b
commit 0ecc3d3e2a
17 changed files with 70 additions and 206 deletions
+2 -16
View File
@@ -16,11 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with BCF. If not, see <http://www.gnu.org/licenses/>.
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
+3 -16
View File
@@ -16,23 +16,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with bSDD. If not, see <http://www.gnu.org/licenses/>.
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
+26
View File
@@ -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
+2 -16
View File
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Ifc4D. If not, see <http://www.gnu.org/licenses/>.
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
+2 -16
View File
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Ifc5D. If not, see <http://www.gnu.org/licenses/>.
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
+2 -16
View File
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcCityJSON. If not, see <http://www.gnu.org/licenses/>.
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
+2 -16
View File
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcClash. If not, see <http://www.gnu.org/licenses/>.
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
+3 -16
View File
@@ -16,23 +16,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcCSV. If not, see <http://www.gnu.org/licenses/>.
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
+3 -16
View File
@@ -16,23 +16,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcDiff. If not, see <http://www.gnu.org/licenses/>.
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
+2 -16
View File
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcFM. If not, see <http://www.gnu.org/licenses/>.
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
+17 -23
View File
@@ -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
-1
View File
@@ -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]
+2 -16
View File
@@ -16,11 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
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
+2 -16
View File
@@ -16,23 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcTester. If not, see <http://www.gnu.org/licenses/>.
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
-2
View File
@@ -1,2 +0,0 @@
*
!.gitignore
-2
View File
@@ -1,2 +0,0 @@
*
!.gitignore
+2 -2
View File
@@ -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"]
"*" = ["*.*"]