(check, version)
Compose a text line to be used in a requirements.txt file to install a check
    pinned to a specific version.
Compose a text line to be used in a requirements.txt file to install a check
    pinned to a specific version.
Compose a text line to be used in a requirements . txt file to install a check pinned to a specific version .
def get_agent_requirement_line(check, version):
    """
    Compose a text line to be used in a requirements.txt file to install a check
    pinned to a specific version.
    """
    package_name = get_package_name(check)

    # no manifest
    if check in ('datadog_checks_base', 'datadog_checks_downloader', 'datadog_checks_dependency_provider'):
        return f'{package_name}=={version}'

    m = load_manifest(check)
    platforms = sorted(m.get('supported_os', []))

    # all platforms
    if platforms == ALL_PLATFORMS:
        return f'{package_name}=={version}'
    # one specific platform
    elif len(platforms) == 1:
        return f"{package_name}=={version}; sys_platform == '{PLATFORMS_TO_PY.get(platforms[0])}'"
    elif platforms:
        if 'windows' not in platforms:
            return f"{package_name}=={version}; sys_platform != 'win32'"
        elif 'mac_os' not in platforms:
            return f"{package_name}=={version}; sys_platform != 'darwin'"
        elif 'linux' not in platforms:
            return f"{package_name}=={version}; sys_platform != 'linux2'"

    raise ManifestError(f"Can't parse the `supported_os` list for the check {check}: {platforms}")
def get_agent_requirement_line ( check , version ) : package_name = get_package_name ( check ) # no manifest if check in ( 'datadog_checks_base' , 'datadog_checks_downloader' , 'datadog_checks_dependency_provider' ) : return f'{package_name}=={version}' m = load_manifest ( check ) platforms = sorted ( m . get ( 'supported_os' , [ ] ) ) # all platforms if platforms == ALL_PLATFORMS : return f'{package_name}=={version}' # one specific platform elif len ( platforms ) == 1 : return f"{package_name}=={version}; sys_platform == '{PLATFORMS_TO_PY.get(platforms[0])}'" elif platforms : if 'windows' not in platforms : return f"{package_name}=={version}; sys_platform != 'win32'" elif 'mac_os' not in platforms : return f"{package_name}=={version}; sys_platform != 'darwin'" elif 'linux' not in platforms : return f"{package_name}=={version}; sys_platform != 'linux2'" raise ManifestError ( f"Can't parse the `supported_os` list for the check {check}: {platforms}" )