How to use the conan.LAYER_VERSION_FILE function in conan

To help you get started, we’ve selected a few conan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nexB / conan / src / conan / image_v11.py View on Github external
layer_id = layer_id.replace('.tar', '')
            layer_digest = sha256_digest(layer_dir)
            layer_size = filetype.get_size(layer_dir)
            return Layer(layer_id=layer_id, layer_digest=layer_digest, layer_size=layer_size)

        if not isdir(layer_dir):
            return Layer(layer_id=layer_id)

        files = listdir(layer_dir)

        assert files
        logger_debug('load_layer: Layer files: ', files, 'layer_dir: ', layer_dir)

        # check that all the files we expect to be in the layer dir are present note:
        # we ignore any other files (such as extracted tars, etc)
        if LAYER_VERSION_FILE in files:
            layer_format_version_file = join(layer_dir, LAYER_VERSION_FILE)
            supported_format_version = cls.format_version
            with open(layer_format_version_file) as lv:
                layer_format_version = lv.read().strip()
                assert supported_format_version == layer_format_version, (
                    'Unknown layer format version: %(layer_format_version)r '
                    'in: %(layer_format_version_file)r. '
                    'Supported version: %(supported_format_version)r') % locals()
        else:
            print('Missing layer VERSION for:', layer_dir)

        if not LAYER_JSON_FILE in files:
            print('Missing layer json for:', layer_dir)
            return Layer(layer_id=layer_id)

        # load data
github nexB / conan / src / conan / image_v11.py View on Github external
layer_digest = sha256_digest(layer_dir)
            layer_size = filetype.get_size(layer_dir)
            return Layer(layer_id=layer_id, layer_digest=layer_digest, layer_size=layer_size)

        if not isdir(layer_dir):
            return Layer(layer_id=layer_id)

        files = listdir(layer_dir)

        assert files
        logger_debug('load_layer: Layer files: ', files, 'layer_dir: ', layer_dir)

        # check that all the files we expect to be in the layer dir are present note:
        # we ignore any other files (such as extracted tars, etc)
        if LAYER_VERSION_FILE in files:
            layer_format_version_file = join(layer_dir, LAYER_VERSION_FILE)
            supported_format_version = cls.format_version
            with open(layer_format_version_file) as lv:
                layer_format_version = lv.read().strip()
                assert supported_format_version == layer_format_version, (
                    'Unknown layer format version: %(layer_format_version)r '
                    'in: %(layer_format_version_file)r. '
                    'Supported version: %(supported_format_version)r') % locals()
        else:
            print('Missing layer VERSION for:', layer_dir)

        if not LAYER_JSON_FILE in files:
            print('Missing layer json for:', layer_dir)
            return Layer(layer_id=layer_id)

        # load data
        with open(join(layer_dir, LAYER_JSON_FILE)) as layer_json: