2
2
#
3
3
# SPDX-License-Identifier: Apache-2.0
4
4
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
+
6
12
from pathlib import Path
7
13
import argparse
8
14
import tempfile
9
15
import shutil
16
+ import subprocess
10
17
11
18
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
+
14
48
15
49
def main ():
50
+ """Main entry point."""
16
51
# Parse arguments
17
52
parser = argparse .ArgumentParser ()
18
53
parser .add_argument ("wheelpath" , type = Path )
@@ -26,8 +61,8 @@ def main():
26
61
with tempfile .TemporaryDirectory () as tmpdir : # Working space
27
62
# Unpack wheel
28
63
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" )
31
66
unpacked_wheel_path = Path (tmpdir ) / namever
32
67
33
68
# Rename and move oidnDenoise
@@ -38,17 +73,23 @@ def main():
38
73
)
39
74
40
75
# 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
+ )
42
80
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" ,
45
87
)
46
88
47
89
# Repack wheel
48
90
pack (
49
91
directory = unpacked_wheel_path ,
50
92
dest_dir = wheel_folder ,
51
- build_number = None
52
93
)
53
94
54
95
0 commit comments