@@ -144,6 +144,8 @@ def search_pattern(self, string_list):
144
144
def search_version_string (self , matched_list ):
145
145
"""finds version strings from matched list"""
146
146
147
+ # pattern = rf"{self.product}(.*){self.version}"
148
+ # ^ this does not work for debian packages
147
149
pattern = rf"{ self .product } (.*)([0-9]+[.-][0-9]+([.-][0-9]+)?)"
148
150
# this matches patterns like:
149
151
# product1.2.3
@@ -153,15 +155,15 @@ def search_version_string(self, matched_list):
153
155
# product version 1.2.3
154
156
# product v1.2.3(1)
155
157
156
- version_string = [
158
+ version_strings = [
157
159
i
158
160
for i in matched_list
159
161
if re .search (pattern , i , re .IGNORECASE )
160
162
if not i .endswith (
161
163
".debug"
162
164
) # removes .debug, so, this does not gets printed
163
165
]
164
- return version_string
166
+ return version_strings
165
167
166
168
def parse_filename (self , filename ):
167
169
"""
@@ -224,7 +226,7 @@ def find_vendor_product(self):
224
226
textwrap .dedent (
225
227
f"""
226
228
============================================
227
- Multiple (vendor, product) pairs found.
229
+ Multiple (" vendor", " product" ) pairs found.
228
230
Please manually select the appropriate pair.
229
231
============================================
230
232
"""
@@ -266,15 +268,15 @@ def output(self):
266
268
for common_strings in sorted (self .contain_patterns ):
267
269
if ".debug" in common_strings :
268
270
rprint (
269
- f" \t [medium_orchid1] { common_strings } [/] <--- not recommended to use these form of strings"
271
+ f' \t [red]r" { common_strings } " [/] <--- not recommended to use these form of strings'
270
272
)
271
273
continue # without this, the else statement was getting printed ;-;
272
274
if ".so" in common_strings :
273
275
rprint (
274
- f" \t [medium_orchid1] { common_strings } [/] <--- not recommended to use these form of strings"
276
+ f' \t [red]r" { common_strings } " [/] <--- not recommended to use these form of strings'
275
277
)
276
278
else :
277
- rprint (f" \t [green]{ common_strings } [/]," )
279
+ rprint (f' \t [green]r" { common_strings } " [/],' )
278
280
print ("]" )
279
281
280
282
"""
@@ -288,23 +290,23 @@ def output(self):
288
290
for filename in self .filename_pattern :
289
291
if self .product == filename :
290
292
rprint (
291
- f" \t [medium_orchid1] { filename } [/] <--- this is a really common filename pattern"
293
+ f' \t [cyan]r" { filename } " [/], <--- this is a really common filename pattern'
292
294
)
293
295
elif self .product in filename :
294
296
if ".so" in filename :
295
- rprint (f" \t [green]{ filename } [/]" )
297
+ rprint (f' \t [green]r" { filename } " [/],' )
296
298
else :
297
299
rprint (
298
- f'\t [red] { filename } [/] <--- you could just use "{ self .product } " to match this file'
300
+ f'\t [bright_green]r" { filename } " [/], <--- you could just use "{ self .product } " to match this file'
299
301
) # to single-handedly match filenames of type varnishd, varnishlog, varnishtop, etc.
300
302
else :
301
- rprint (f" \t [green]{ filename } [/]" )
303
+ rprint (f' \t [green]r" { filename } " [/],' )
302
304
print ("]" )
303
305
304
306
# output: version-strings
305
307
print ("VERSION_PATTERNS = [" )
306
308
for version_string in self .version_pattern :
307
- rprint (f" \t [green]{ version_string } [/]," )
309
+ rprint (f' \t [green]r" { version_string } " [/],' )
308
310
print ("]" )
309
311
310
312
# output: vendor-product pair
0 commit comments