7
7
8
8
import argparse
9
9
import difflib
10
+ from packaging .version import Version
10
11
from pathlib import Path
11
12
import platform
12
13
import subprocess # nosec B404
@@ -25,6 +26,7 @@ class UmfInstaller:
25
26
build_type (str): Debug or Release build type passed to the script
26
27
shared_library (bool): Determines if the UMF was built as a shared library
27
28
pools (List[str]): A list of enabled pools during the UMF compilation
29
+ umf_version (Version): UMF version currently being built and installed
28
30
match_list (List[str]): A list of relative paths of files that should be installed
29
31
"""
30
32
@@ -36,13 +38,15 @@ def __init__(
36
38
build_type : str ,
37
39
shared_library : bool ,
38
40
pools : List [str ],
41
+ umf_version : Version ,
39
42
):
40
43
self .workspace_dir = workspace_dir
41
44
self .build_dir = build_dir
42
45
self .install_dir = install_dir
43
46
self .build_type = build_type
44
47
self .shared_library = shared_library
45
48
self .pools = pools
49
+ self .umf_version = umf_version
46
50
self .match_list = self ._create_match_list ()
47
51
48
52
def _create_match_list (self ) -> List [str ]:
@@ -95,11 +99,34 @@ def _create_match_list(self) -> List[str]:
95
99
]
96
100
for pool in self .pools :
97
101
lib .append (f"lib/{ lib_prefix } { pool } .{ lib_ext_static } " )
98
- lib_ext = lib_ext_shared if self .shared_library else lib_ext_static
99
- lib .append (f"lib/{ lib_prefix } umf.{ lib_ext } " )
102
+ if self .shared_library :
103
+ lib .append (f"lib/{ lib_prefix } umf.{ lib_ext_shared } " )
104
+
105
+ if platform .system () == "Linux" :
106
+ lib .append (
107
+ f"lib/{ lib_prefix } umf.{ lib_ext_shared } .{ self .umf_version .major } "
108
+ )
109
+ lib .append (f"lib/{ lib_prefix } umf.{ lib_ext_shared } .{ self .umf_version } " )
110
+ elif platform .system () == "Darwin" : # MacOS
111
+ lib .append (
112
+ f"lib/{ lib_prefix } umf.{ self .umf_version .major } .{ lib_ext_shared } "
113
+ )
114
+ lib .append (f"lib/{ lib_prefix } umf.{ self .umf_version } .{ lib_ext_shared } " )
115
+ else :
116
+ lib .append (f"lib/{ lib_prefix } umf.{ lib_ext_static } " )
117
+
100
118
if is_umf_proxy :
101
119
lib .append (f"lib/{ lib_prefix } umf_proxy.{ lib_ext_shared } " )
102
120
121
+ if platform .system () == "Linux" :
122
+ lib .append (
123
+ f"lib/{ lib_prefix } umf_proxy.{ lib_ext_shared } .{ self .umf_version .major } "
124
+ )
125
+ elif platform .system () == "Darwin" : # MacOS
126
+ lib .append (
127
+ f"lib/{ lib_prefix } umf_proxy.{ self .umf_version .major } .{ lib_ext_shared } "
128
+ )
129
+
103
130
share = []
104
131
share = [
105
132
"share" ,
@@ -155,9 +182,14 @@ def validate_installed_files(self) -> None:
155
182
)
156
183
]
157
184
185
+ expected_files = [
186
+ str (entry )
187
+ for entry in sorted (self .match_list , key = lambda x : str (x ).casefold ())
188
+ ]
189
+
158
190
diff = list (
159
191
difflib .unified_diff (
160
- self . match_list ,
192
+ expected_files ,
161
193
installed_files ,
162
194
fromfile = "Expected files" ,
163
195
tofile = "Installed files" ,
@@ -252,6 +284,11 @@ def parse_arguments(self) -> argparse.Namespace:
252
284
action = "store_true" ,
253
285
help = "Add this argument if the UMF was built with Scalable Pool enabled" ,
254
286
)
287
+ self .parser .add_argument (
288
+ "--umf-version" ,
289
+ action = "store" ,
290
+ help = "Current version of the UMF, e.g. 1.0.0" ,
291
+ )
255
292
return self .parser .parse_args ()
256
293
257
294
def run (self ) -> None :
@@ -269,6 +306,7 @@ def run(self) -> None:
269
306
pools .append ("jemalloc_pool" )
270
307
if self .args .scalable_pool :
271
308
pools .append ("scalable_pool" )
309
+ umf_version = Version (self .args .umf_version )
272
310
273
311
umf_installer = UmfInstaller (
274
312
workspace_dir ,
@@ -277,6 +315,7 @@ def run(self) -> None:
277
315
self .args .build_type ,
278
316
self .args .shared_library ,
279
317
pools ,
318
+ umf_version ,
280
319
)
281
320
282
321
print ("Installation test - BEGIN" , flush = True )
0 commit comments