internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: conan-io/conan

Issue:
[suggestion] [workspaces] Support yaml list as workspace root
Using yaml list for setting the workspace root variable makes it easier to manage the yaml file, when the workspace has multiple roots.

I would like to contribute to this feature.


Discussion:

Resolving patch:
diff --git a/conans/model/workspace.py b/conans/model/workspace.py
--- a/conans/model/workspace.py
+++ b/conans/model/workspace.py
@@ -127,8 +127,13 @@ def _loads(self, text):
         generators = yml.pop("generators", None)
         if isinstance(generators, str):
             generators = [generators]
+
+        root_list = yml.pop("root", [])
+        if isinstance(root_list, str):
+            root_list = root_list.split(",")
+
         self._root = [ConanFileReference.loads(s.strip())
-                      for s in yml.pop("root", "").split(",") if s.strip()]
+                      for s in root_list if s.strip()]
         if not self._root:
             raise ConanException("Conan workspace needs at least 1 root conanfile")
 


Test patch:
diff --git a/conans/test/functional/workspace/workspace_test.py b/conans/test/functional/workspace/workspace_test.py
--- a/conans/test/functional/workspace/workspace_test.py
+++ b/conans/test/functional/workspace/workspace_test.py
@@ -6,6 +6,8 @@
 import six
 import time
 
+from parameterized.parameterized import parameterized
+
 from conans.client import tools
 from conans.errors import ConanException
 from conans.model.workspace import Workspace
@@ -188,7 +190,8 @@ def files(name, depend=None):
             for f in ("conanbuildinfo.cmake", "conaninfo.txt", "conanbuildinfo.txt"):
                 self.assertTrue(os.path.exists(os.path.join(client.current_folder, sub, f)))
 
-    def multiple_roots_test(self):
+    @parameterized.expand([("csv",), ("list",), (("abbreviated_list"))])
+    def multiple_roots_test(self, root_attribute_format):
         # https://github.com/conan-io/conan/issues/4720
         client = TestClient()
 
@@ -201,6 +204,14 @@ def files(name, depend=None):
         client.save(files("A", "C"), path=os.path.join(client.current_folder, "A"))
         client.save(files("B", "D"), path=os.path.join(client.current_folder, "B"))
 
+        # https://github.com/conan-io/conan/issues/5155
+        roots = ["HelloA/0.1@lasote/stable", "HelloB/0.1@lasote/stable"]
+        root_attribute = {
+            "csv": ", ".join(roots),
+            "list": "".join(["\n    - %s" % r for r in roots]),
+            "abbreviated_list": str(roots),
+        }[root_attribute_format]
+
         project = dedent("""
             editables:
                 HelloD/0.1@lasote/stable:
@@ -212,11 +223,11 @@ def files(name, depend=None):
                 HelloA/0.1@lasote/stable:
                     path: A
             layout: layout
-            root: HelloA/0.1@lasote/stable, HelloB/0.1@lasote/stable
-            """)
+            root: {root_attribute}
+            """).format(root_attribute=root_attribute)
+
         layout = dedent("""
             [build_folder]
-
             """)
         client.save({"conanws.yml": project,
                      "layout": layout})
Repository: conan-io/conan

Issue:
Cmake build helper + Intel Fortran
This is similar to #2747, but there isn't as elegant a workaround, so I thought it was worth opening an issue. 

Intel fortran doesn't understand the verbosity command, and it causes the build to fail. 
The workaround I came up with is this:



        cmake = CMake(self, parallel=False)
        command_line = cmake.command_line
        command_line.replace("/verbosity:%s" % cmake.msbuild_verbosity, "", 1)
        self.run('cmake "%s" %s' % (self.source_folder, command_line))
        self.run('cmake --build . %s' % cmake.build_config)`

Unlike #2747, no value that I pass to the msbuild_verbosity argument in the CMake constructor will prevent the command from being issued. It would be nice if there was some way to just remove the "/verbosity: ... " command from being issued at all. 


Discussion:
Let's try to fix it for the next release.

Resolving patch:
diff --git a/conans/client/build/cmake.py b/conans/client/build/cmake.py
--- a/conans/client/build/cmake.py
+++ b/conans/client/build/cmake.py
@@ -23,7 +23,7 @@ class CMake(object):
 
     def __init__(self, conanfile, generator=None, cmake_system_name=True,
                  parallel=True, build_type=None, toolset=None, make_program=None,
-                 set_cmake_flags=False, msbuild_verbosity=None, cmake_program=None,
+                 set_cmake_flags=False, msbuild_verbosity="minimal", cmake_program=None,
                  generator_platform=None):
         """
         :param conanfile: Conanfile instance
@@ -69,8 +69,7 @@ def __init__(self, conanfile, generator=None, cmake_system_name=True,
         self.definitions = builder.get_definitions()
         self.toolset = toolset or get_toolset(self._settings)
         self.build_dir = None
-        self.msbuild_verbosity = (os.getenv("CONAN_MSBUILD_VERBOSITY") or msbuild_verbosity or
-                                  "minimal")
+        self.msbuild_verbosity = os.getenv("CONAN_MSBUILD_VERBOSITY") or msbuild_verbosity
 
     @property
     def build_folder(self):


Test patch:
diff --git a/conans/test/unittests/client/build/cmake_test.py b/conans/test/unittests/client/build/cmake_test.py
--- a/conans/test/unittests/client/build/cmake_test.py
+++ b/conans/test/unittests/client/build/cmake_test.py
@@ -1333,6 +1333,10 @@ def test_msbuild_verbosity(self):
         cmake.build()
         self.assertIn("/verbosity:quiet", conan_file.command)
 
+        cmake = CMake(conan_file, msbuild_verbosity=None)
+        cmake.build()
+        self.assertNotIn("/verbosity", conan_file.command)
+
         with tools.environment_append({"CONAN_MSBUILD_VERBOSITY": "detailed"}):
             cmake = CMake(conan_file)
             cmake.build()
Repository: conan-io/conan

Issue:
Don't pass ConanFileReference object to conan_api, pass string
https://github.com/conan-io/conan/pull/5176/files introduces a ConanFileReference via the conan_api, please fix.




Discussion:

Resolving patch:
diff --git a/conans/client/command.py b/conans/client/command.py
--- a/conans/client/command.py
+++ b/conans/client/command.py
@@ -960,8 +960,7 @@ def remove(self, *args):
                 raise ConanException("Please specify a valid pattern or reference to be cleaned")
 
             if check_valid_ref(args.pattern_or_reference, allow_pattern=False):
-                ref = ConanFileReference.loads(args.pattern_or_reference)
-                return self._conan.remove_system_reqs(ref)
+                return self._conan.remove_system_reqs(args.pattern_or_reference)
 
             return self._conan.remove_system_reqs_by_pattern(args.pattern_or_reference)
         else:
diff --git a/conans/client/conan_api.py b/conans/client/conan_api.py
--- a/conans/client/conan_api.py
+++ b/conans/client/conan_api.py
@@ -966,8 +966,9 @@ def remote_clean(self):
         return self._cache.registry.clear()
 
     @api_method
-    def remove_system_reqs(self, ref):
+    def remove_system_reqs(self, reference):
         try:
+            ref = ConanFileReference.loads(reference)
             self._cache.package_layout(ref).remove_system_reqs()
             self._user_io.out.info(
                 "Cache system_reqs from %s has been removed" % repr(ref))
@@ -977,7 +978,7 @@ def remove_system_reqs(self, ref):
     @api_method
     def remove_system_reqs_by_pattern(self, pattern):
         for ref in search_recipes(self._cache, pattern=pattern):
-            self.remove_system_reqs(ref)
+            self.remove_system_reqs(ref.full_repr())
 
     @api_method
     def remove_locks(self):


Test patch:
diff --git a/conans/test/integration/system_reqs_test.py b/conans/test/integration/system_reqs_test.py
--- a/conans/test/integration/system_reqs_test.py
+++ b/conans/test/integration/system_reqs_test.py
@@ -196,7 +196,7 @@ def remove_system_reqs_test(self):
         self.assertIn("Cache system_reqs from Test/0.1@user/channel has been removed",
                       client.user_io.out)
         self.assertNotIn("Cache system_reqs from Test/0.1@user/channel_other has been removed",
-                      client.user_io.out)
+                         client.user_io.out)
         self.assertFalse(os.path.exists(system_reqs_path))
         self.assertTrue(os.path.exists(system_reqs_path_other))
 
@@ -204,7 +204,7 @@ def remove_system_reqs_test(self):
         client.run("create . user/channel")
         client.run("remove --system-reqs Test/0.1@user/channel_*")
         self.assertNotIn("Cache system_reqs from Test/0.1@user/channel has been removed",
-                      client.user_io.out)
+                         client.user_io.out)
         self.assertIn("Cache system_reqs from Test/0.1@user/channel_other has been removed",
                       client.user_io.out)
         self.assertTrue(os.path.exists(system_reqs_path))
Repository: conan-io/conan

Issue:
VS 2017 in combination with v140 toolset does not work any longer
Hi @lasote, @memsharded and @jgsogo ,

at least since Conan 1.15 the combination Visual Studio 2017 and toolset v140 does not work any longer. But it worked in older versions (like 1.11.2) and sadly we need exactly this combination due to many, many, many ... existing v140 packages and VS2017 installations in our company.

It can be easily fixed by changing conans/client/generators/cmake_common.py at lines 356-357 to the following:
```
            # 1900-1919 = VS 15.0 (v140 and v141 toolsets)
            (CONAN_COMPILER_VERSION STREQUAL "15" AND NOT((MSVC_VERSION GREATER_EQUAL  1900) AND (MSVC_VERSION LESS 1920))) OR
```
Our used profile:
```
[build_requires]
[settings]
os=Windows
arch=x86_64
compiler=Visual Studio
compiler.version=15
compiler.toolset=v140
build_type=Release
arch_build=x86_64
os_build=Windows
[options]
[env]
```

Thanks in advance.
Best Aalmann

Edit: compiler.version fixed


Discussion:
Hi Aalman! In your profile you wrote `compiler.version=14` is that correct?
Ups. Copy&Paste issue with a test profile.
I will edit the original post. It is definitely Version 15

Resolving patch:
diff --git a/conans/client/generators/cmake_common.py b/conans/client/generators/cmake_common.py
--- a/conans/client/generators/cmake_common.py
+++ b/conans/client/generators/cmake_common.py
@@ -357,8 +357,8 @@ def generate_targets_section(dependencies):
         if(
             # 1920-1929 = VS 16.0 (v142 toolset)
             (CONAN_COMPILER_VERSION STREQUAL "16" AND NOT((MSVC_VERSION GREATER 1919) AND (MSVC_VERSION LESS 1930))) OR
-            # 1910-1919 = VS 15.0 (v141 toolset)
-            (CONAN_COMPILER_VERSION STREQUAL "15" AND NOT((MSVC_VERSION GREATER 1909) AND (MSVC_VERSION LESS 1920))) OR
+            # 1910-1919 = VS 15.0 (v140 and v141 toolsets)
+            (CONAN_COMPILER_VERSION STREQUAL "15" AND NOT((MSVC_VERSION GREATER_EQUAL  1900) AND (MSVC_VERSION LESS 1920))) OR
             # 1900      = VS 14.0 (v140 toolset)
             (CONAN_COMPILER_VERSION STREQUAL "14" AND NOT(MSVC_VERSION EQUAL 1900)) OR
             # 1800      = VS 12.0 (v120 toolset)


Test patch:
Repository: conan-io/conan

Issue:
Linter warning for conan_data
The linter complains when accesing `self.conan_data`.


Discussion:

Resolving patch:
diff --git a/conans/pylint_plugin.py b/conans/pylint_plugin.py
--- a/conans/pylint_plugin.py
+++ b/conans/pylint_plugin.py
@@ -30,6 +30,7 @@ def transform_conanfile(node):
         "build_folder": str_class,
         "package_folder": str_class,
         "install_folder": str_class,
+        "conan_data": str_class,
         "build_requires": build_requires_class,
         "info_build": info_class,
         "info": info_class,


Test patch:
diff --git a/conans/test/functional/command/export_linter_test.py b/conans/test/functional/command/export_linter_test.py
--- a/conans/test/functional/command/export_linter_test.py
+++ b/conans/test/functional/command/export_linter_test.py
@@ -5,7 +5,7 @@
 from mock import patch
 
 from conans.client import tools
-from conans.paths import CONANFILE
+from conans.paths import CONANFILE, DATA_YML
 from conans.test.utils.tools import TestClient
 
 conanfile = """
@@ -153,3 +153,24 @@ def deploy(self):
                          client.out)
         self.assertNotIn("WARN: Linter. Line 8: self.copy_deps is not callable",
                          client.out)
+
+    def test_conan_data(self):
+        client = TestClient()
+        conanfile = """
+from conans import ConanFile
+class ExampleConan(ConanFile):
+    name = "example"
+
+    def build(self):
+        print(self.conan_data["sources"][float(self.version)])
+"""
+        conandata = """sources:
+  2.3:
+    url: "https://github.com/google/cctz/archive/v2.3.tar.gz"
+    sha256: "8615b20d4e33e02a271c3b93a3b208e3d7d5d66880f5f6208b03426e448f32db"
+"""
+        client.save({DATA_YML: conandata})
+        client.save({CONANFILE: conanfile})
+        client.run("export . 2.3@conan/stable")
+        self.assertNotIn("Linter.", client.user_io.out)
+        self.assertNotIn("Instance of 'ExampleConan' has no 'conan_data' member", client.user_io.out)
Repository: conan-io/conan

Issue:
VirtualEnvGenerator doesn't call super __init__
A custom generator based on the `VirtualEnvGenerator` does not have the
`_deps_build_info`, `_deps_env_info`, `_env_info`, and `_deps_user_info` set since the base constructor is not called.

Proposed fix: Call the super constructor as all the other generators do, if they implement `__init__`.

Conan version 1.16.1
Operating system: Ubuntu 18.4




Discussion:

Resolving patch:
diff --git a/conans/client/generators/virtualenv.py b/conans/client/generators/virtualenv.py
--- a/conans/client/generators/virtualenv.py
+++ b/conans/client/generators/virtualenv.py
@@ -9,6 +9,7 @@ class VirtualEnvGenerator(Generator):
     append_with_spaces = ["CPPFLAGS", "CFLAGS", "CXXFLAGS", "LIBS", "LDFLAGS", "CL", "_LINK_"]
 
     def __init__(self, conanfile):
+        super(VirtualEnvGenerator, self).__init__(conanfile)
         self.conanfile = conanfile
         self.env = conanfile.env
         self.venv_name = "conanenv"


Test patch:
Repository: conan-io/conan

Issue:
config install with a git repository fails when the temporary directory is not empty
To help us debug your issue please explain:

- [x] I've read the [CONTRIBUTING guide](https://github.com/conan-io/conan/blob/develop/.github/CONTRIBUTING.md).
- [x] I've specified the Conan version, operating system version and any tool that can be relevant.
- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.

with conan 1.16.0, I sometimes get the following messages on our ci server:

```
conan config install git@repos.local:Conan/conan-config.git
Trying to clone repo: git@repos.local:Conan/conan-config.git
ERROR: Can't clone repo: The destination folder '/Users/Jenkins/Library/Caches/conan/1.16.0/.conan/tmp_config_install' is not empty, specify a branch to checkout (not a tag or commit) or specify a 'subfolder' attribute in the 'scm'
```

This happen when one of our devs cancelled (even if they have been told not to) a previous ci job while conan is running, leaving the directory.

I would suggest to use a random generated temporary directory, or to simply overwrite the directory content.



Discussion:
Seems like an easy fix. I don't know why it is not using a random temp folder to do the clone...

Thanks for reporting!

Resolving patch:
diff --git a/conans/client/conf/config_installer.py b/conans/client/conf/config_installer.py
--- a/conans/client/conf/config_installer.py
+++ b/conans/client/conf/config_installer.py
@@ -37,6 +37,7 @@ def tmp_config_install_folder(cache):
     tmp_folder = os.path.join(cache.cache_folder, "tmp_config_install")
     # necessary for Mac OSX, where the temp folders in /var/ are symlinks to /private/var/
     tmp_folder = os.path.realpath(tmp_folder)
+    rmdir(tmp_folder)
     mkdir(tmp_folder)
     try:
         yield tmp_folder


Test patch:
diff --git a/conans/test/unittests/client/conf/config_installer/test_install_folder.py b/conans/test/unittests/client/conf/config_installer/test_install_folder.py
new file mode 100644
--- /dev/null
+++ b/conans/test/unittests/client/conf/config_installer/test_install_folder.py
@@ -0,0 +1,25 @@
+# coding=utf-8
+
+import unittest
+import os
+
+from conans.client.conf.config_installer import tmp_config_install_folder
+from conans.test.utils.tools import TestClient
+
+
+class InstallFolderTests(unittest.TestCase):
+
+    def test_unique_install_folder(self):
+        """ Validate if tmp_config_install_folder is removing old folder before creating a new one
+
+        tmp_config_install_folder must create the same folder, but all items must be exclude when a
+        new folder is created.
+        """
+        client = TestClient()
+
+        with tmp_config_install_folder(client.cache) as tmp_folder_first:
+            temp_file = os.path.join(tmp_folder_first, "foobar.txt")
+            open(temp_file, "w+")
+            with tmp_config_install_folder(client.cache) as tmp_folder_second:
+                self.assertEqual(tmp_folder_first, tmp_folder_second)
+                self.assertFalse(os.path.exists(temp_file))
Repository: conan-io/conan

Issue:
`conan info` --build-order and --graph don't mix
You can't use both options --build-order and --graph on the same call. This should be allowed, and the command help doesnt't show them as incompatible.

```
$ conan info 'boost/1.68.0@conan/stable' --build-order=ALL --graph boost.html
[bzip2/1.0.6@conan/stable, zlib/1.2.11@conan/stable], [boost/1.68.0@conan/stable]
$ ls boost.html
ls: cannot access boost.html: No such file or directory
$ conan info 'boost/1.68.0@conan/stable' --graph boost.html
$ ls boost.html
boost.html

```

Conan 1.6.1 

- [X] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).
- [X] I've specified the Conan version, operating system version and any tool that can be relevant.
- [X] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.




Discussion:

Resolving patch:
diff --git a/conans/client/command.py b/conans/client/command.py
--- a/conans/client/command.py
+++ b/conans/client/command.py
@@ -592,6 +592,9 @@ def info(self, *args):
         if args.install_folder and (args.profile or args.settings or args.options or args.env):
             raise ArgumentError(None,
                                 "--install-folder cannot be used together with -s, -o, -e or -pr")
+        if args.build_order and args.graph:
+            raise ArgumentError(None,
+                                "--build-order cannot be used together with --graph")
 
         # BUILD ORDER ONLY
         if args.build_order:


Test patch:
diff --git a/conans/test/functional/command/info_test.py b/conans/test/functional/command/info_test.py
--- a/conans/test/functional/command/info_test.py
+++ b/conans/test/functional/command/info_test.py
@@ -434,6 +434,10 @@ def build_order_test(self):
         self.assertIn('{"groups": [["Hello0/0.1@lasote/stable"], ["Hello1/0.1@lasote/stable"]]}',
                       self.client.out)
 
+        self.client.run("info Hello1/0.1@lasote/stable --build-order=Hello0/0.1@lasote/stable "
+                        "--graph=index.html", assert_error=True)
+        self.assertIn("--build-order cannot be used together with --graph", self.client.out)
+
     def build_order_build_requires_test(self):
         # https://github.com/conan-io/conan/issues/3267
         client = TestClient()
Repository: conan-io/conan

Issue:
conan inspect should not fail on missing attribute
Conan 1.9.1

I'm trying to get list of direct dependencies for the recipe and when I run `conan inspect -a build_requires` on a recipe without `build_requires` it just fails because `AttributeError` is fatal.

I think this behavior is inconvenient as I don't know in advance which attributes are present and if I specify multiple custom attributes, whole command fails.

I suggest that missing attributes should be translated to missing keys in the resulting dictionary (effectively ignoring `AttributeError` in `ConanAPIV1.inspect()` instead of converting it to `ConanException`).


Discussion:
Yes, I agree. Returning a missing key should be enough information to know that the attribute is not there. About #3913, the `porcelain` option I suggested, it could return a blank line if the key is not there,  but it would be the same as a "blank" string result. Anyway, you have always the `json` option to get better info.
I use json, but exception comes from API, before any serialization takes place.
However I didn't think about ordinary stdout...

Resolving patch:
diff --git a/conans/client/conan_api.py b/conans/client/conan_api.py
--- a/conans/client/conan_api.py
+++ b/conans/client/conan_api.py
@@ -278,8 +278,8 @@ def inspect(self, path, attributes, remote_name=None):
             try:
                 attr = getattr(conanfile, attribute)
                 result[attribute] = attr
-            except AttributeError as e:
-                raise ConanException(str(e))
+            except AttributeError:
+                result[attribute] = ''
         return result
 
     @api_method


Test patch:
diff --git a/conans/test/functional/command/inspect_test.py b/conans/test/functional/command/inspect_test.py
--- a/conans/test/functional/command/inspect_test.py
+++ b/conans/test/functional/command/inspect_test.py
@@ -106,8 +106,8 @@ class Pkg(ConanFile):
         client.run("inspect . -a=revision_mode")
         self.assertIn("revision_mode: hash", client.out)
 
-        client.run("inspect . -a=unexisting_attr", assert_error=True)
-        self.assertIn("ERROR: 'Pkg' object has no attribute 'unexisting_attr'", client.out)
+        client.run("inspect . -a=unexisting_attr")
+        self.assertIn("unexisting_attr:", client.out)
 
     def options_test(self):
         client = TestClient()
@@ -378,8 +378,8 @@ def test_incompatible_commands(self):
     def test_invalid_field(self):
         client = TestClient()
         client.save({"conanfile.py": self.conanfile})
-        client.run("inspect . --raw=not_exists", assert_error=True)
-        self.assertIn("ERROR: 'Pkg' object has no attribute 'not_exists'", client.out)
+        client.run("inspect . --raw=not_exists")
+        self.assertEqual("", client.out)
 
     def test_private_field(self):
         client = TestClient()