-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When export with conan export it will include all data in it, including that of all other package versions. That dirties all packages when a new version is added. This change resolves that issue by injecting a hook at export time that cleans the conandata to only include the relevant version fields. fixes bfgroup/barbarian#16
- Loading branch information
1 parent
ad4322f
commit 9b2917f
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2021 René Ferdinand Rivera Morell | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE.txt or http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
''' | ||
Hook to clean the conandata.yml information for Barbarian style packages. | ||
''' | ||
|
||
import os.path | ||
import yaml | ||
import conans.tools | ||
|
||
|
||
def post_export(output, conanfile, conanfile_path, reference, **args): | ||
conandata_yml_path = os.path.join( | ||
os.path.dirname(conanfile_path), "conandata.yml") | ||
if not os.path.exists(conandata_yml_path): | ||
return | ||
conandata_yml_in = yaml.safe_load(conans.tools.load(conandata_yml_path)) | ||
conandata_yml_out = {} | ||
# Filter the data to only keep the sections and subkeys that match the | ||
# exported version. | ||
version = str(conanfile.version) | ||
for section in conandata_yml_in: | ||
if version in conandata_yml_in[section]: | ||
conandata_yml_out[section] = { | ||
version: conandata_yml_in[section][version] | ||
} | ||
# Overwrite out the conandata.yml with the updated info. | ||
conans.tools.save(conandata_yml_path, yaml.safe_dump(conandata_yml_out)) |