22# Copyright (c) nexB Inc. and others. All rights reserved.
33# SPDX-License-Identifier: Apache-2.0
44# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
5- # See https://github.com/nexB /container-inspector for support or download.
5+ # See https://github.com/aboutcode-org /container-inspector for support or download.
66# See https://aboutcode.org for more information about nexB OSS projects.
77#
88
@@ -296,7 +296,9 @@ def from_os_release_file(cls, location):
296296 parsed
297297 """
298298 if not location or not os .path .exists (location ):
299- if TRACE : logger .debug (f'from_os_release_file: { location !r} does not exists' )
299+ if TRACE :
300+ logger .debug (
301+ f'from_os_release_file: { location !r} does not exists' )
300302 return
301303
302304 data = parse_os_release (location ) or {}
@@ -333,7 +335,8 @@ def from_os_release_file(cls, location):
333335 if data :
334336 new_data ['extra_data' ] = data
335337
336- if TRACE : logger .debug (f'from_os_release_file: new_data: { new_data !r} ' )
338+ if TRACE :
339+ logger .debug (f'from_os_release_file: new_data: { new_data !r} ' )
337340
338341 return cls (** new_data )
339342
@@ -356,10 +359,13 @@ def from_rootfs(cls, location, base_distro=None):
356359 manifest) and may be missing from the rootfs proper (for instance of an
357360 /etc/os-release is missing in the rootfs for a Linux-based image).
358361 """
359- if TRACE : logger .debug (f'from_rootfs: { location !r} base_distro: { base_distro !r} ' )
362+ if TRACE :
363+ logger .debug (
364+ f'from_rootfs: { location !r} base_distro: { base_distro !r} ' )
360365
361366 if not location or not os .path .exists (location ):
362- if TRACE : logger .debug (f'from_rootfs: { location !r} does not exists' )
367+ if TRACE :
368+ logger .debug (f'from_rootfs: { location !r} does not exists' )
363369 return
364370
365371 finders = {
@@ -369,10 +375,12 @@ def from_rootfs(cls, location, base_distro=None):
369375 }
370376
371377 for finder_os , finder in finders .items ():
372- if TRACE : logger .debug (f'from_rootfs: trying finder_os: { finder_os !r} ' )
378+ if TRACE :
379+ logger .debug (f'from_rootfs: trying finder_os: { finder_os !r} ' )
373380
374381 found = finder (location )
375- if TRACE : logger .debug (f'from_rootfs: trying found: { found !r} ' )
382+ if TRACE :
383+ logger .debug (f'from_rootfs: trying found: { found !r} ' )
376384 if found :
377385 if base_distro :
378386 if base_distro .os != finder_os :
@@ -382,11 +390,15 @@ def from_rootfs(cls, location, base_distro=None):
382390 )
383391
384392 merged = base_distro .merge (found )
385- if TRACE : logger .debug (f'from_rootfs: returning merged: { merged !r} ' )
393+ if TRACE :
394+ logger .debug (
395+ f'from_rootfs: returning merged: { merged !r} ' )
386396 return merged
387397
388398 else :
389- if TRACE : logger .debug (f'from_rootfs: returning found: { found !r} ' )
399+ if TRACE :
400+ logger .debug (
401+ f'from_rootfs: returning found: { found !r} ' )
390402 return found
391403
392404 @classmethod
@@ -431,8 +443,10 @@ def categories(self):
431443 """
432444 return dict (
433445 rpm = dict (
434- redhat = ('fedora' , 'centos' , 'rhel' , 'amazon' , 'scientific' , 'oraclelinux' ,),
435- suse = ('opensuse' , 'suse' , 'sles' , 'sled' , 'sles_sap' , 'opensuse-leap' , 'opensuse-tumbleweed' ,),
446+ redhat = ('fedora' , 'centos' , 'rhel' , 'amazon' ,
447+ 'scientific' , 'oraclelinux' ,),
448+ suse = ('opensuse' , 'suse' , 'sles' , 'sled' , 'sles_sap' ,
449+ 'opensuse-leap' , 'opensuse-tumbleweed' ,),
436450 altlinux = ('altlinux' ,),
437451 photon = ('photon' ,),
438452 mandriva = ('mandriva' , 'mageia' , 'mandrake' , 'open-mandriva' ),
@@ -456,7 +470,8 @@ def merge(self, other_distro):
456470 Return a new distro based on this Distro data updated with non-empty
457471 values from the ``other_distro`` Distro object.
458472 """
459- if TRACE : logger .debug (f'merge: { self !r} with: { other_distro !r} ' )
473+ if TRACE :
474+ logger .debug (f'merge: { self !r} with: { other_distro !r} ' )
460475
461476 existing = self .to_dict ()
462477 if other_distro :
@@ -465,9 +480,11 @@ def merge(self, other_distro):
465480 if v
466481 }
467482 existing .update (other_non_empty )
468- if TRACE : logger .debug (f'merge: updated data: { existing !r} ' )
483+ if TRACE :
484+ logger .debug (f'merge: updated data: { existing !r} ' )
469485
470- if TRACE : logger .debug (f'merge: merged data: { existing !r} ' )
486+ if TRACE :
487+ logger .debug (f'merge: merged data: { existing !r} ' )
471488
472489 return type (self )(** existing )
473490
0 commit comments