|
1 | 1 | # setup.py is getting deprecated, but we still use it, |
2 | 2 | # because `tool.setuptools.ext-modules` is still experimental in pyproject.toml |
3 | 3 | # and we need it to get the wheel suffix right. |
4 | | -from setuptools import setup, Extension, find_packages |
| 4 | +import os |
| 5 | +from pathlib import Path |
| 6 | + |
| 7 | +import tomllib |
| 8 | +from setuptools import Extension, setup |
| 9 | + |
| 10 | + |
| 11 | +REPO_FOLDER = Path(__file__).parent |
| 12 | + |
| 13 | + |
| 14 | +def get_version() -> str: |
| 15 | + if "PKG_VERSION" in os.environ: |
| 16 | + # Inside pyodide build environment. |
| 17 | + return os.environ["PKG_VERSION"] |
| 18 | + return (REPO_FOLDER / "VERSION").read_text().strip() |
| 19 | + |
| 20 | + |
| 21 | +# Read dependencies from pyproject.toml |
| 22 | +def get_dependencies() -> list[str]: |
| 23 | + pyproject_toml = REPO_FOLDER / "src" / "ifcopenshell-python" / "pyproject.toml" |
| 24 | + pyproject_data = tomllib.loads(pyproject_toml.read_text()) |
| 25 | + dependencies = pyproject_data["project"]["dependencies"] |
| 26 | + return dependencies |
| 27 | + |
5 | 28 |
|
6 | 29 | setup( |
7 | 30 | name="ifcopenshell", |
8 | | - version="0.8.0", |
| 31 | + version=get_version(), |
9 | 32 | description=( |
10 | 33 | "IfcOpenShell is an open source (LGPL) software library " |
11 | 34 | "for working with the Industry Foundation Classes (IFC) file format." |
12 | 35 | ), |
13 | 36 | author="Thomas Krijnen", |
14 | 37 | author_email="thomas@aecgeeks.com", |
15 | 38 | url="https://ifcopenshell.org", |
| 39 | + install_requires=get_dependencies(), |
16 | 40 | packages=["ifcopenshell"], |
17 | 41 | package_data={ |
18 | 42 | # "*.so" is needed to include prebuilt binary extension. Otherwise it would try to build it and fail. |
|
0 commit comments