|
1 | 1 | """Integration with codemetapy (to re-generate codemeta as part of somesy sync).""" |
2 | 2 | import contextlib |
3 | | -import json |
4 | 3 | import logging |
5 | 4 | from pathlib import Path |
6 | 5 |
|
7 | 6 | from ..core.models import SomesyConfig |
8 | 7 | from .exec import gen_codemeta |
9 | | -from .utils import cff_codemeta_tempfile |
| 8 | +from .utils import cff_codemeta_tempfile, update_codemeta_file |
10 | 9 |
|
11 | 10 | log = logging.getLogger("somesy") |
12 | 11 |
|
@@ -51,16 +50,17 @@ def update_codemeta(conf: SomesyConfig): |
51 | 50 | with temp_cff_cm: |
52 | 51 | cm_harvest = gen_codemeta(cm_sources) |
53 | 52 |
|
54 | | - # check output and write file if needed |
55 | | - # return update_codemeta_file(conf.codemeta_file, cm_harvest) |
56 | | - # NOTE: since codemetapy 2.5.1 we should not need |
| 53 | + # NOTE: once codemetapy is fixed (still broken with 2.5.1), we should not need |
57 | 54 | # update_codemeta_file + codemeta context dump + most of utils.py + their tests anymore |
58 | 55 | # we'll first disable the workaround and see for a while if everything works |
59 | 56 | # as expected, and if it does, the cleanup can be completed. |
60 | | - |
| 57 | + # |
61 | 58 | # save to file with same settings as used by codemetapy |
62 | | - with open(conf.codemeta_file, "w") as f: |
63 | | - f.write(json.dumps(cm_harvest, indent=4, ensure_ascii=False, sort_keys=True)) |
| 59 | + # with open(conf.codemeta_file, "w") as f: |
| 60 | + # f.write(json.dumps(cm_harvest, indent=4, ensure_ascii=False, sort_keys=True)) |
| 61 | + |
| 62 | + # check output and write file if needed (with workaround checking graph equivalence) |
| 63 | + return update_codemeta_file(conf.codemeta_file, cm_harvest) |
64 | 64 |
|
65 | 65 |
|
66 | 66 | __all__ = ["update_codemeta"] |
0 commit comments