From 081b422d86a5a3b434ec8136f35ef410cca3d0f3 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Morin Date: Sun, 4 Feb 2024 19:03:26 -0500 Subject: [PATCH] Add debug_old_commands back since it's actively use. Signed-off-by: Jean-Christophe Morin --- CHANGELOG.md | 1 - src/rez/config.py | 3 +++ src/rez/rezconfig.py | 9 +++++++++ src/rez/tests/test_commands.py | 14 +++++++++++++- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee3800a8d8..516f6822b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,7 +58,6 @@ As communicated in the 2.114.0 release notes, we've followed through on the remo - Configuration settings - `rtx_as_yaml`: No replacement. This functionality will be completely removed in the future. - - `debug_old_commands`: No replacement. This was a no-op. - `warn_commands2`: No replacement. This was a no-op. - `error_commands2`: No replacement. This was a no-op. - `rez_1_cmake_variables`: You can use the `REZ_BUILD_TYPE` CMake variable instead of `CENTRAL`. diff --git a/src/rez/config.py b/src/rez/config.py index 6e870e6a3f..6f872f9b38 100644 --- a/src/rez/config.py +++ b/src/rez/config.py @@ -488,8 +488,11 @@ def _parse_env_var(self, value): "default_relocatable": Bool, "set_prompt": Bool, "prefix_prompt": Bool, + # Note that if you want to remove a warn_* or debug_* config, you will + # need to search for "config.warn(" or "config.debug(" to see if it's used. "warn_old_commands": Bool, "error_old_commands": Bool, + "debug_old_commands": Bool, "rez_1_environment_variables": Bool, "disable_rez_1_compatibility": Bool, "make_package_temporarily_writable": Bool, diff --git a/src/rez/rezconfig.py b/src/rez/rezconfig.py index 9e3769dab3..8b8222f843 100644 --- a/src/rez/rezconfig.py +++ b/src/rez/rezconfig.py @@ -1038,6 +1038,15 @@ # Will be removed in a future release. error_old_commands = False +# Print old commands and their converted rex equivalent. Note that this can +# cause very verbose output. +# +# This currently has no effect. +# +# .. deprecated:: 2.114.0 +# Will be removed in a future version. +debug_old_commands = False + # If True, Rez will continue to generate the given environment variables in # resolved environments, even though their use has been deprecated in Rez-2. # The variables in question, and their Rez-2 equivalent (if any) are: diff --git a/src/rez/tests/test_commands.py b/src/rez/tests/test_commands.py index df545bc9a0..e0309a9527 100644 --- a/src/rez/tests/test_commands.py +++ b/src/rez/tests/test_commands.py @@ -11,7 +11,9 @@ from rez.utils.filesystem import canonical_path import unittest from rez.tests.util import TestBase +from rez.vendor.schema.schema import SchemaError import os +import logging class TestCommands(TestBase): @@ -100,8 +102,18 @@ def _test_rextest_package(self, version): # first prepend should still override self._test_package(pkg, {"REXTEST_DIRS": "TEST"}, cmds) - def test_old_yaml(self): + def test_old_yaml_raises(self): """Resolve a yaml-based package with old-style bash commands.""" + with self.assertRaises(SchemaError): + self._test_rextest_package("1.1") + + def test_old_yaml_compatibility_enabled(self): + """Resolve a yaml-based package with old-style bash commands.""" + self.update_settings({"disable_rez_1_compatibility": False, "warn_old_commands": True}) + with self.assertLogs(logger=logging.getLogger("rez.utils.logging_"), level=logging.WARNING): + self._test_rextest_package("1.1") + + self.update_settings({"disable_rez_1_compatibility": False, "warn_old_commands": False}) self._test_rextest_package("1.1") def test_new_yaml(self):