How to use the conan.LAYER_JSON_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
# 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:
            layer_data = json.load(layer_json, object_pairs_hook=OrderedDict)

        # Note: it is possible to have an EMPTY layer.tar that is a link to another
        # non-empty layer.tar
        if LAYER_TAR_FILE in files:
            layer_tar = join(layer_dir, LAYER_TAR_FILE)
            layer_digest = sha256_digest(layer_tar)
            layer_size = filetype.get_size(layer_tar)
        else:
            layer_digest = None
            layer_size = 0
github nexB / conan / src / conan / image_v11.py View on Github external
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:
            layer_data = json.load(layer_json, object_pairs_hook=OrderedDict)

        # Note: it is possible to have an EMPTY layer.tar that is a link to another
        # non-empty layer.tar
        if LAYER_TAR_FILE in files:
            layer_tar = join(layer_dir, LAYER_TAR_FILE)
            layer_digest = sha256_digest(layer_tar)
            layer_size = filetype.get_size(layer_tar)
        else:
            layer_digest = None
            layer_size = 0

        # do not rely on this
        if 'Size' in layer_data:
            del layer_data['Size']