~jelmer/brz/fix-c-extensions

« back to all changes in this revision

Viewing changes to breezy/osutils.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1076
1076
def report_extension_load_failures():
1077
1077
    if not _extension_load_failures:
1078
1078
        return
1079
 
    if config.GlobalStack().get('ignore_missing_extensions'):
 
1079
    if config.GlobalConfig().suppress_warning('missing_extensions'):
1080
1080
        return
1081
1081
    # the warnings framework should by default show this only once
1082
1082
    from .trace import warning
1083
1083
    warning(
1084
1084
        "brz: warning: some compiled extensions could not be loaded; "
1085
 
        "see <https://answers.launchpad.net/bzr/+faq/703>")
 
1085
        "see ``brz help missing-extensions``")
1086
1086
    # we no longer show the specific missing extensions here, because it makes
1087
1087
    # the message too long and scary - see
1088
1088
    # https://bugs.launchpad.net/bzr/+bug/430529
1391
1391
    :return: None or a utf8 revision id.
1392
1392
    """
1393
1393
    if (unicode_or_utf8_string is None
1394
 
        or unicode_or_utf8_string.__class__ == str):
 
1394
        or unicode_or_utf8_string.__class__ == bytes):
1395
1395
        return unicode_or_utf8_string
1396
1396
    raise TypeError('Unicode revision ids are no longer supported. '
1397
1397
                    'Revision id generators should be creating utf8 revision '
1409
1409
    :return: None or a utf8 file id.
1410
1410
    """
1411
1411
    if (unicode_or_utf8_string is None
1412
 
        or unicode_or_utf8_string.__class__ == str):
 
1412
        or unicode_or_utf8_string.__class__ == bytes):
1413
1413
        return unicode_or_utf8_string
1414
1414
    raise TypeError('Unicode file ids are no longer supported. '
1415
1415
                    'File id generators should be creating utf8 file ids.')
2327
2327
 
2328
2328
    concurrency = os.environ.get('BRZ_CONCURRENCY', None)
2329
2329
    if concurrency is None:
 
2330
        import multiprocessing
2330
2331
        try:
2331
 
            import multiprocessing
2332
2332
            concurrency = multiprocessing.cpu_count()
2333
 
        except (ImportError, NotImplementedError):
2334
 
            # multiprocessing is only available on Python >= 2.6
2335
 
            # and multiprocessing.cpu_count() isn't implemented on all
2336
 
            # platforms
 
2333
        except NotImplementedError:
 
2334
            # multiprocessing.cpu_count() isn't implemented on all platforms
2337
2335
            try:
2338
2336
                concurrency = _local_concurrency()
2339
2337
            except (OSError, IOError):