Skip to content

Commit 4fee9ec

Browse files
committed
Wheel-test: automatically retrieve nvrtc version
1 parent d96e0a7 commit 4fee9ec

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

build-system/luxmake/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import pathlib
1414
import re
1515
from dataclasses import dataclass
16+
from packaging.version import Version
1617

1718
# Logger
1819
logger = logging.getLogger("LuxCore")
@@ -128,7 +129,7 @@ def get_dep_version(dep):
128129
raise ValueError(f"No dependency '{dep}' found")
129130
version, *_ = versions
130131

131-
return version
132+
return Version(version)
132133

133134

134135
def unpack(path, dest):

build-system/luxmake/wheel.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@
1212
import platform
1313
import os
1414
import shlex
15+
from packaging.version import Version
1516
from pathlib import Path
1617

17-
from .constants import SOURCE_DIR, INSTALL_DIR, BINARY_DIR, WHEELHOUSE_DIR, WHEEL_HOOK
18-
from .utils import logger, pack, fail, Colors
18+
from .constants import (
19+
SOURCE_DIR,
20+
INSTALL_DIR,
21+
BINARY_DIR,
22+
WHEELHOUSE_DIR,
23+
WHEEL_HOOK,
24+
)
25+
from .utils import logger, pack, fail, Colors, get_dep_version
1926
from .build import build_and_install
2027
from .windows import win_recompose
2128

29+
# Following snippets are intended to wheel reconstruction
2230
_WHEEL_SNIPPET = """\
2331
Wheel-Version: 1.0
2432
Generator: fake 0.0.0
@@ -34,7 +42,7 @@
3442
Keywords: raytracing,ray tracing,rendering,pbr,physical based rendering,path tracing
3543
Author: LuxCoreRender
3644
Requires-Python: >=3.10
37-
Requires-Dist: nvidia-cuda-nvrtc (==12.8.61); sys_platform != "darwin"
45+
Requires-Dist: {}; sys_platform != "darwin"
3846
"""
3947

4048
_ENTRYPOINTS_SNIPPET = """\
@@ -53,7 +61,6 @@
5361
"""
5462

5563

56-
5764
def _compute_platform_tag():
5865
"""Compute tag.
5966
@@ -134,7 +141,15 @@ def make_wheel(args):
134141

135142
# Export METADATA file
136143
with open(dist_info / "METADATA", "w", encoding="utf-8") as f:
137-
f.write(_METADATA_SNIPPET.format(version))
144+
nvrtc_version = get_dep_version("nvrtc")
145+
major = nvrtc_version.major
146+
requirement = (
147+
f"nvidia-cuda-nvrtc-cu{major}=={nvrtc_version}"
148+
if nvrtc_version.major <= 12
149+
else f"nvidia-cuda-nvrtc=={nvrtc_version}"
150+
)
151+
152+
f.write(_METADATA_SNIPPET.format(version, requirement))
138153

139154
# Export entry_points.txt file
140155
with open(dist_info / "entry_points.txt", "w", encoding="utf-8") as f:

0 commit comments

Comments
 (0)