conan icon indicating copy to clipboard operation
conan copied to clipboard

[feature] Add a function `conan.tools.files.export_conandata_patches`

Open SpaceIm opened this issue 3 years ago • 0 comments
trafficstars

In conan-center-index, several versions share the same conanfile.py but may have different patches depending on the version. If we export patches with exports_sources = "patches/**", each version ends up with patches of unrelated versions, and adding or modifying a patch of a version can change RREV of other versions.

So in conan-center-index, we have introduced this kind of pattern:

    def export_sources(self):
        for p in self.conan_data.get("patches", {}).get(self.version, []):
            copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder)

It would be nice to provide a function conan.tools.files.export_conandata_patches similar to conan.tools.files.apply_conandata_patches, to avoid this boilerplate.

SpaceIm avatar Aug 03 '22 15:08 SpaceIm