Skip to content

Commit c3c94b9

Browse files
committed
pyodide setup.py - add dependencies
so micropip would be able to gather them automatically
1 parent 576ef33 commit c3c94b9

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

pyodide/setup.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,42 @@
11
# setup.py is getting deprecated, but we still use it,
22
# because `tool.setuptools.ext-modules` is still experimental in pyproject.toml
33
# 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+
528

629
setup(
730
name="ifcopenshell",
8-
version="0.8.0",
31+
version=get_version(),
932
description=(
1033
"IfcOpenShell is an open source (LGPL) software library "
1134
"for working with the Industry Foundation Classes (IFC) file format."
1235
),
1336
author="Thomas Krijnen",
1437
author_email="thomas@aecgeeks.com",
1538
url="https://ifcopenshell.org",
39+
install_requires=get_dependencies(),
1640
packages=["ifcopenshell"],
1741
package_data={
1842
# "*.so" is needed to include prebuilt binary extension. Otherwise it would try to build it and fail.

0 commit comments

Comments
 (0)