chrome/installer/mac/signing/signing.py
def _linker_signed_arm64_needs_force(path):
    """Detects linker-signed arm64 code that can only be signed with --force
    on this system.

    Args:
        path: A path to a code object to test.

    Returns:
        True if --force must be used with codesign --sign to successfully sign
        the code, False otherwise.
    """
    # On macOS 11.0 and later, codesign handles linker-signed code properly
    # without the --force hand-holding. Check OS >= 10.16 because that's what
    # Python will think the OS is if it wasn't built with the 11.0 SDK or later.
    if commands.macos_version() >= [10, 16]:
        return False

    # Look just for --arch=arm64 because that's the only architecture that has
    # linker-signed code by default. If this were used with universal code (if
    # there were any), --display without --arch would default to the native
    # architecture, which almost certainly wouldn't be arm64 and therefore would
    # be wrong.
    (returncode, stdout, stderr) = commands.lenient_run_command_output(
        ['codesign', '--display', '--verbose', '--arch=arm64', '--', path])

    if returncode != 0:
        # Problem running codesign? Don't make the error about this confusing
        # function. Just return False and let some less obscure codesign
        # invocation be the error. Not signed at all? No problem. No arm64 code?
        # No problem either. Not code at all? File not found? Well, those don't
        # count as linker-signed either.
        return False

    # Yes, codesign --display puts all of this on stderr.
    match = re.search(b'^CodeDirectory .* flags=(0x[0-9a-f]+)( |\().*$', stderr,
                      re.MULTILINE)
    if not match:
        return False

    flags = int(match.group(1), 16)

    # This constant is from MacOSX11.0.sdk <Security/CSCommon.h>
    # SecCodeSignatureFlags kSecCodeSignatureLinkerSigned.
    LINKER_SIGNED_FLAG = 0x20000

    return (flags & LINKER_SIGNED_FLAG) != 0
Detects linker-signed arm64 code that can only be signed with --force
    on this system.

    Args:
        path: A path to a code object to test.

    Returns:
        True if --force must be used with codesign --sign to successfully sign
        the code, False otherwise.
    
Detects linker-signed arm64 code that can only be signed with --force
on this system.
Detects linker - signed arm64 code that can only be signed with -- force on this system .
def _linker_signed_arm64_needs_force(path):
    if commands.macos_version() >= [10, 16]:
        return False
    (returncode, stdout, stderr) = commands.lenient_run_command_output(
        ['codesign', '--display', '--verbose', '--arch=arm64', '--', path])
    if returncode != 0:
        return False
    match = re.search(b'^CodeDirectory .* flags=(0x[0-9a-f]+)( |\().*$', stderr,
                      re.MULTILINE)
    if not match:
        return False
    flags = int(match.group(1), 16)
    LINKER_SIGNED_FLAG = 0x20000
    return (flags & LINKER_SIGNED_FLAG) != 0
def _linker_signed_arm64_needs_force ( path ) : if commands . macos_version ( ) >= [ 10 , 16 ] : return False ( returncode , stdout , stderr ) = commands . lenient_run_command_output ( [ 'codesign' , '--display' , '--verbose' , '--arch=arm64' , '--' , path ] ) if returncode != 0 : return False match = re . search ( b'^CodeDirectory .* flags=(0x[0-9a-f]+)( |\().*$' , stderr , re . MULTILINE ) if not match : return False flags = int ( match . group ( 1 ) , 16 ) LINKER_SIGNED_FLAG = 0x20000 return ( flags & LINKER_SIGNED_FLAG ) != 0
Detects linker-signed arm64 code that can only be signed with --force
on this system.
Detects linker - signed arm64 code that can only be signed with -- force on this system .
"""Detects linker-signed arm64 code that can only be signed with --force
    on this system.

    Args:
        path: A path to a code object to test.

    Returns:
        True if --force must be used with codesign --sign to successfully sign
        the code, False otherwise.
    """ # On macOS 11.0 and later, codesign handles linker-signed code properly # without the --force hand-holding. Check OS >= 10.16 because that's what # Python will think the OS is if it wasn't built with the 11.0 SDK or later. # Look just for --arch=arm64 because that's the only architecture that has # linker-signed code by default. If this were used with universal code (if # there were any), --display without --arch would default to the native # architecture, which almost certainly wouldn't be arm64 and therefore would # be wrong. # Problem running codesign? Don't make the error about this confusing # function. Just return False and let some less obscure codesign # invocation be the error. Not signed at all? No problem. No arm64 code? # No problem either. Not code at all? File not found? Well, those don't # count as linker-signed either. # Yes, codesign --display puts all of this on stderr. # This constant is from MacOSX11.0.sdk <Security/CSCommon.h> # SecCodeSignatureFlags kSecCodeSignatureLinkerSigned.
True if --force must be used with codesign --sign to successfully sign
the code, False otherwise.
True if -- force must be used with codesign -- sign to successfully sign the code False otherwise .
path
A path to a code object to test.
A path to a code object to test .