Repository: conan-io/conan

Issue:
[feature] conan command to report current python and system for troubleshooting
### What is your suggestion?

Some runtime issues can be caused by the Python interpreter that is invoking Conan, or the environment it is on  (see https://github.com/conan-io/conan/issues/15892)

Oftentimes in issues I find myself asking users to report the shebang of the Conan command script - for further troubleshooting.

I could be useful if conan had a command, e.g `conan system report` that could give us some basics that help us troubleshooting, for example:
* The version of Conan
* The location of the Conan script that is currently running
* The python interpreter that is running command, if one is being used
* Alternatively, whether the executable is self-contained ("frozen")
* The CPU architecture that python is reporting (useful on systems that can run multiple architectures like arm64 macOS and Windows)
* The OS and version
* The actual/physical CPU type - to highlight cases where the process is running emulating the CPU architecture (Rosetta on macOS Apple Silicon, emulation on Windows ARM64, etc).

Over time we may consider expanding and perhaps reporting the default compiler or build environment, etc (e.g. is the SDKROOT variable defined on macOS, etc)



### Have you read the CONTRIBUTING guide?

- [ ] I've read the CONTRIBUTING guide


Discussion:
``conan version`` already displays the Python interpreter:
```
version: 2.3.0-dev
python
  version: 3.10.2
  sys_version: 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)]
```

We can add there more information if needed, as it also has ``json`` output for machine parsing.



Patch:
diff --git a/conan/cli/commands/version.py b/conan/cli/commands/version.py
index 507f0f7d16e..b2509afefdf 100644
--- a/conan/cli/commands/version.py
+++ b/conan/cli/commands/version.py
@@ -12,10 +12,22 @@ def version(conan_api, parser, *args):
     Give information about the Conan client version.
     """
 
-    return {'version': str(conan_version),
+    return {
+            'version': str(conan_version),
+            'conan_path': sys.argv[0],
             'python': {
                 'version': platform.python_version().replace('\n', ''),
                 'sys_version': sys.version.replace('\n', ''),
+                'sys_executable': sys.executable,
+                'is_frozen': getattr(sys, 'frozen', False),
+                'architecture': platform.machine(),
+                },
+            'system': {
+                'version': platform.version(),
+                'platform': platform.platform(),
+                'system': platform.system(),
+                'release': platform.release(),
+                'cpu': platform.processor(),
                 }
             }
 


Test patch:
diff --git a/conans/test/integration/command_v2/test_version.py b/conans/test/integration/command_v2/test_version.py
index 6ddc7aff12d..3f397d1059c 100644
--- a/conans/test/integration/command_v2/test_version.py
+++ b/conans/test/integration/command_v2/test_version.py
@@ -21,8 +21,17 @@ def test_version_json():
     t.run("version --format=json")
     js = json.loads(t.stdout)
     assert js["version"] == __version__
+    assert js["conan_path"] == sys.argv[0]
     assert js["python"]["version"] == _python_version()
     assert js["python"]["sys_version"] == _sys_version()
+    assert js["python"]["sys_executable"] == sys.executable
+    assert js["python"]["is_frozen"] == getattr(sys, 'frozen', False)
+    assert js["python"]["architecture"] == platform.machine()
+    assert js["system"]["version"] == platform.version()
+    assert js["system"]["platform"] == platform.platform()
+    assert js["system"]["system"] == platform.system()
+    assert js["system"]["release"] == platform.release()
+    assert js["system"]["cpu"] == platform.processor()
 
 
 def test_version_text():
@@ -47,6 +56,16 @@ def test_version_raw():
 def _validate_text_output(output):
     lines = output.splitlines()
     assert f'version: {__version__}' in lines
+    assert f'conan_path: {sys.argv[0]}' in lines
     assert 'python' in lines
     assert f'  version: {_python_version()}' in lines
     assert f'  sys_version: {_sys_version()}' in lines
+    assert f'  sys_executable: {sys.executable}' in lines
+    assert f'  is_frozen: {getattr(sys, "frozen", False)}' in lines
+    assert f'  architecture: {platform.machine()}' in lines
+    assert 'system' in lines
+    assert f'  version: {platform.version()}' in lines
+    assert f'  platform: {platform.platform()}' in lines
+    assert f'  system: {platform.system()}' in lines
+    assert f'  release: {platform.release()}' in lines
+    assert f'  cpu: {platform.processor()}' in lines