Closed
Description
Environment details
- Operating System+version: Windows 10
- Compiler+version: gcc 13.2.0
- Conan version: 2.0.10
- Python version: python 3.11.4
Steps to reproduce
- Try to build a recipe that has a git.clone() command in the recipe's source() method when building from inside a MSYS2 MINGW64 shell window.
- Observe the "conans.errors.ConanException: 'self.settings' access in 'source()' method is forbidden" error message.
This worked fine in 2.0.9. I believe the issue is caused by this change causing this line to trigger the exception.
Unfortunately I'm not familiar enough with the code to know what the proper fix for this should be.
Logs
Here is a stack trace from the conan command when I run it with -vvv
Traceback (most recent call last):
File "C:/tools/msys64/home/aaron/src/conan2-env/lib/python3.11/site-packages/conans/errors.py", line 52, in conanfile_exception_formatter
yield
File "C:/tools/msys64/home/aaron/src/conan2-env/lib/python3.11/site-packages/conans/client/source.py", line 82, in run_source_method
conanfile.source()
File "C:/Users/aaron/.conan2/p/openfa3473a8ec710d/e/conanfile.py", line 31, in source
git.clone(url="https://github.com/NatronGitHub/openfx-misc.git", target=".")
File "C:/tools/msys64/home/aaron/src/conan2-env/lib/python3.11/site-packages/conan/tools/scm/git.py", line 168, in clone
self.run('clone "{}" {} {}'.format(url, " ".join(args), target_path))
File "C:/tools/msys64/home/aaron/src/conan2-env/lib/python3.11/site-packages/conan/tools/scm/git.py", line 29, in run
self._conanfile.run(f"git {cmd}", stdout=output, quiet=True)
File "C:/tools/msys64/home/aaron/src/conan2-env/lib/python3.11/site-packages/conans/model/conan_file.py", line 331, in run
wrapped_cmd = command_env_wrapper(self, command, env, envfiles_folder=envfiles_folder)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:/tools/msys64/home/aaron/src/conan2-env/lib/python3.11/site-packages/conans/client/subsystems.py", line 56, in command_env_wrapper
wrapped_cmd = _windows_bash_wrapper(conanfile, command, envfiles, envfiles_folder)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:/tools/msys64/home/aaron/src/conan2-env/lib/python3.11/site-packages/conans/client/subsystems.py", line 79, in _windows_bash_wrapper
_msystem = {"x86": "MINGW32"}.get(conanfile.settings.get_safe("arch"), "MINGW64")
^^^^^^^^^^^^^^^^^^
File "C:/tools/msys64/home/aaron/src/conan2-env/lib/python3.11/site-packages/conans/errors.py", line 23, in _m
raise ConanException(f"'self.{attr_name}' access in '{method}()' method is forbidden")
conans.errors.ConanException: 'self.settings' access in 'source()' method is forbidden