|
25 | 25 |
|
26 | 26 | from cylc.flow.hostuserutil import get_host
|
27 | 27 | from cylc.flow import LOG
|
28 |
| -import cylc.flow.flags as flags |
| 28 | +from cylc.flow.flags import cylc7_back_compat |
29 | 29 | from cylc.rose.jinja2_parser import Parser, patch_jinja2_leading_zeros
|
30 | 30 | from metomi.rose import __version__ as ROSE_VERSION
|
31 | 31 | from metomi.isodatetime.datetimeoper import DateTimeOperator
|
|
42 | 42 | ROSE_ORIG_HOST_INSTALLED_OVERRIDE_STRING = (
|
43 | 43 | ' ROSE_ORIG_HOST set by cylc install.'
|
44 | 44 | )
|
| 45 | +MESSAGE = 'message' |
| 46 | +ALL_MODES = 'all modes' |
45 | 47 |
|
46 | 48 |
|
47 | 49 | class MultipleTemplatingEnginesError(Exception):
|
@@ -656,30 +658,50 @@ def deprecation_warnings(config_tree):
|
656 | 658 | - "root-dir"
|
657 | 659 | - "jinja2:suite.rc"
|
658 | 660 | - "empy:suite.rc"
|
| 661 | + - root-dir |
659 | 662 |
|
| 663 | + If ALL_MODES is True this deprecation will ignore whether there is a |
| 664 | + flow.cylc or suite.rc in the workflow directory. |
660 | 665 | """
|
661 | 666 |
|
662 | 667 | deprecations = {
|
663 |
| - 'empy:suite.rc': ( |
664 |
| - "'rose-suite.conf[empy:suite.rc]' is deprecated." |
665 |
| - " Use [template variables] instead."), |
666 |
| - 'jinja2:suite.rc': ( |
667 |
| - "'rose-suite.conf[jinja2:suite.rc]' is deprecated." |
668 |
| - " Use [template variables] instead."), |
669 |
| - 'empy:flow.cylc': ( |
670 |
| - "'rose-suite.conf[empy:flow.cylc]' is not used by Cylc." |
671 |
| - " Use [template variables] instead."), |
672 |
| - 'jinja2:flow.cylc': ( |
673 |
| - "'rose-suite.conf[jinja2:flow.cylc]' is not used by Cylc." |
674 |
| - " Use [template variables] instead."), |
675 |
| - 'root-dir': ( |
676 |
| - 'You have set "rose-suite.conf[root-dir]", ' |
677 |
| - 'which is not supported at ' |
678 |
| - 'Cylc 8. Use `[install] symlink dirs` in global.cylc ' |
679 |
| - 'instead.') |
| 668 | + 'empy:suite.rc': { |
| 669 | + MESSAGE: ( |
| 670 | + "'rose-suite.conf[empy:suite.rc]' is deprecated." |
| 671 | + " Use [template variables] instead."), |
| 672 | + ALL_MODES: False, |
| 673 | + }, |
| 674 | + 'jinja2:suite.rc': { |
| 675 | + MESSAGE: ( |
| 676 | + "'rose-suite.conf[jinja2:suite.rc]' is deprecated." |
| 677 | + " Use [template variables] instead."), |
| 678 | + ALL_MODES: False, |
| 679 | + }, |
| 680 | + 'empy:flow.cylc': { |
| 681 | + MESSAGE: ( |
| 682 | + "'rose-suite.conf[empy:flow.cylc]' is not used by Cylc." |
| 683 | + " Use [template variables] instead."), |
| 684 | + ALL_MODES: False, |
| 685 | + }, |
| 686 | + 'jinja2:flow.cylc': { |
| 687 | + MESSAGE: ( |
| 688 | + "'rose-suite.conf[jinja2:flow.cylc]' is not used by Cylc." |
| 689 | + " Use [template variables] instead."), |
| 690 | + ALL_MODES: False, |
| 691 | + }, |
| 692 | + 'root-dir': { |
| 693 | + MESSAGE: ( |
| 694 | + 'You have set "rose-suite.conf[root-dir]", ' |
| 695 | + 'which is not supported at ' |
| 696 | + 'Cylc 8. Use `[install] symlink dirs` in global.cylc ' |
| 697 | + 'instead.'), |
| 698 | + ALL_MODES: True, |
| 699 | + }, |
680 | 700 | }
|
681 |
| - if not flags.cylc7_back_compat: |
682 |
| - for string in list(config_tree.node): |
683 |
| - for deprecation in deprecations.keys(): |
684 |
| - if deprecation in string.lower(): |
685 |
| - LOG.warning(deprecations[deprecation]) |
| 701 | + for string in list(config_tree.node): |
| 702 | + for name, info in deprecations.items(): |
| 703 | + if ( |
| 704 | + (info[ALL_MODES] or not cylc7_back_compat) |
| 705 | + and name in string.lower() |
| 706 | + ): |
| 707 | + LOG.warning(info[MESSAGE]) |
0 commit comments