Changeset 267023 in webkit


Ignore:
Timestamp:
Sep 14, 2020 10:58:51 AM (4 years ago)
Author:
Jonathan Bedard
Message:

[webkitcorepy] Log autoinstall details even without a logger configured
https://bugs.webkit.org/show_bug.cgi?id=216480

Reviewed by Dewei Zhu.

  • Scripts/libraries/webkitcorepy/webkitcorepy/init.py: Bump version.
  • Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:

(Package.install): Use AutoInstall.log instead of logging.
(AutoInstall):
(AutoInstall.log): Check log to see if a logger is configured, if one is not,
output the message to stderr instead.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r267022 r267023  
     12020-09-14  Jonathan Bedard  <jbedard@apple.com>
     2
     3        [webkitcorepy] Log autoinstall details even without a logger configured
     4        https://bugs.webkit.org/show_bug.cgi?id=216480
     5
     6        Reviewed by Dewei Zhu.
     7
     8        * Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py: Bump version.
     9        * Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:
     10        (Package.install): Use AutoInstall.log instead of logging.
     11        (AutoInstall):
     12        (AutoInstall.log): Check log to see if a logger is configured, if one is not,
     13        output the message to stderr instead.
     14
    1152020-09-14  Aakash Jain  <aakash_jain@apple.com>
    216
  • trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py

    r267019 r267023  
    3636from webkitcorepy.output_capture import LoggerCapture, OutputCapture, OutputDuplicate
    3737
    38 version = Version(0, 4, 8)
     38version = Version(0, 4, 9)
    3939
    4040from webkitcorepy.autoinstall import Package, AutoInstall
  • trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py

    r267019 r267023  
    2222
    2323import json
     24import logging
    2425import math
    2526import os
     
    3334import zipfile
    3435
     36from logging import NullHandler
    3537from webkitcorepy import log
    3638from webkitcorepy.version import Version
     
    216218            shutil.rmtree(self.location, ignore_errors=True)
    217219
    218             log.warning('Downloading {}...'.format(archive))
     220            AutoInstall.log('Downloading {}...'.format(archive))
    219221            archive.download()
    220222
     
    231233                    continue
    232234
    233                 log.warning('Installing {}...'.format(archive))
     235                AutoInstall.log('Installing {}...'.format(archive))
    234236
    235237                if self.slow_install:
    236                     log.warning('{} is known to be slow to install'.format(archive))
     238                    AutoInstall.log('{} is known to be slow to install'.format(archive))
    237239
    238240                with open(os.devnull, 'w') as devnull:
     
    291293            AutoInstall.userspace_should_own(manifest)
    292294
    293             log.warning('Installed {}!'.format(archive))
     295            AutoInstall.log('Installed {}!'.format(archive))
    294296        except Exception:
    295             log.critical('Failed to install {}!'.format(archive))
     297            AutoInstall.log('Failed to install {}!'.format(archive), level=logging.CRITICAL)
    296298            raise
    297299
     
    492494                    yield tags.Tag(tag.interpreter, tag.abi, override)
    493495
     496    @classmethod
     497    def log(cls, message, level=logging.WARNING):
     498        if not log.handlers or all([isinstance(handle, NullHandler) for handle in log.handlers]):
     499            sys.stderr.write(message + '\n')
     500        else:
     501            log.log(level, message)
     502
    494503
    495504sys.meta_path.insert(0, AutoInstall)
Note: See TracChangeset for help on using the changeset viewer.