Skip to content

Commit 30cb9f8

Browse files
committed
Recompose windows wheels: adapt to 'wheel/0.46.1' version
1 parent 2572c91 commit 30cb9f8

File tree

1 file changed

+50
-9
lines changed

1 file changed

+50
-9
lines changed

build-helpers/wheels/recompose_wheel_windows.py

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,52 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
import os
5+
"""This script makes a final rearrangement to a Windows wheel.
6+
7+
2 actions to be done:
8+
- Rename and move oidnDenoise.exe
9+
- Rename and move OpenImageDenoise_device_cpu.dll
10+
"""
11+
612
from pathlib import Path
713
import argparse
814
import tempfile
915
import shutil
16+
import subprocess
1017

1118
from wheel.wheelfile import WheelFile
12-
from wheel.cli.unpack import unpack
13-
from wheel.cli.pack import pack
19+
20+
21+
def unpack(path, dest):
22+
"""Unpack a wheel."""
23+
args = [
24+
"python",
25+
"-m",
26+
"wheel",
27+
"unpack",
28+
"-d",
29+
str(dest),
30+
str(path),
31+
]
32+
print(subprocess.check_output(args, text=True))
33+
34+
35+
def pack(directory, dest_dir):
36+
"""(Re)pack a wheel."""
37+
args = [
38+
"python",
39+
"-m",
40+
"wheel",
41+
"pack",
42+
"-d",
43+
str(dest_dir),
44+
str(directory),
45+
]
46+
print(subprocess.check_output(args, text=True))
47+
1448

1549
def main():
50+
"""Main entry point."""
1651
# Parse arguments
1752
parser = argparse.ArgumentParser()
1853
parser.add_argument("wheelpath", type=Path)
@@ -26,8 +61,8 @@ def main():
2661
with tempfile.TemporaryDirectory() as tmpdir: # Working space
2762
# Unpack wheel
2863
unpack(path=args.wheelpath, dest=tmpdir)
29-
with WheelFile(args.wheelpath) as wf:
30-
namever = wf.parsed_filename.group("namever")
64+
with WheelFile(args.wheelpath) as wheelfile:
65+
namever = wheelfile.parsed_filename.group("namever")
3166
unpacked_wheel_path = Path(tmpdir) / namever
3267

3368
# Rename and move oidnDenoise
@@ -38,17 +73,23 @@ def main():
3873
)
3974

4075
# Rename and move OpenImageDenoise_device_cpu
41-
print("Rename OpenImageDenoise_device_cpu.pyd into OpenImageDenoise_device_cpu.dll")
76+
print(
77+
"Rename OpenImageDenoise_device_cpu.pyd "
78+
"into OpenImageDenoise_device_cpu.dll"
79+
)
4280
shutil.move(
43-
unpacked_wheel_path / "pyluxcore.libs" / "OpenImageDenoise_device_cpu.pyd",
44-
unpacked_wheel_path / "pyluxcore.libs" / "OpenImageDenoise_device_cpu.dll",
81+
unpacked_wheel_path
82+
/ "pyluxcore.libs"
83+
/ "OpenImageDenoise_device_cpu.pyd",
84+
unpacked_wheel_path
85+
/ "pyluxcore.libs"
86+
/ "OpenImageDenoise_device_cpu.dll",
4587
)
4688

4789
# Repack wheel
4890
pack(
4991
directory=unpacked_wheel_path,
5092
dest_dir=wheel_folder,
51-
build_number=None
5293
)
5394

5495

0 commit comments

Comments
 (0)