Repository: conan-io/conan
Pull request #13297 (2023-03-02 11:48:48)

Do not copy conan_server to conan folder when generating binaries with pyinstaller
Changelog: omit
Docs: omit

When generating binaries with pyinstaller do not copy conan_server to conan folder.



Patch:
diff --git a/conan/tools/build/cppstd.py b/conan/tools/build/cppstd.py
index bdf08ca39..423c0a279 100644
--- a/conan/tools/build/cppstd.py
+++ b/conan/tools/build/cppstd.py
@@ -203,11 +203,17 @@ def _gcc_supported_cppstd(version):
 
 def _msvc_supported_cppstd(version):
     """
+    https://learn.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=msvc-170
+    - /std:c++14 starting in Visual Studio 2015 Update 3 (190)
+    - /std:c++17 starting in Visual Studio 2017 version 15.3. (191)
+    - /std:c++20 starting in Visual Studio 2019 version 16.11 (192)
     [14, 17, 20, 23]
     """
-    if version < "190":
+    if version < "190":  # pre VS 2015
         return []
-    if version < "191":
+    if version < "191":  # VS 2015
+        return ["14"]
+    if version < "192":  # VS 2017
         return ["14", "17"]
     if version < "193":
         return ["14", "17", "20"]
diff --git a/conans/client/conf/detect_vs.py b/conans/client/conf/detect_vs.py
index 5b2b91917..5db2f3850 100644
--- a/conans/client/conf/detect_vs.py
+++ b/conans/client/conf/detect_vs.py
@@ -114,6 +114,7 @@ def vswhere(all_=False, prerelease=False, products=None, requires=None, version=
     arguments.append(vswhere_path)
 
     # Output json format
+    arguments.append("-utf8")
     arguments.append("-format")
     arguments.append("json")
 
diff --git a/conans/client/profile_loader.py b/conans/client/profile_loader.py
index 6c51598f3..b94f9beaa 100644
--- a/conans/client/profile_loader.py
+++ b/conans/client/profile_loader.py
@@ -68,7 +68,8 @@ def _check_correct_cppstd(settings):
                     "14": "5.1",
                     "11": "4.5"}.get(cppstd)
         elif compiler == "msvc":
-            mver = {"20": "193",
+            mver = {"23": "193",
+                    "20": "192",
                     "17": "191",
                     "14": "190"}.get(cppstd)
         if mver and version < mver:
diff --git a/pyinstaller.py b/pyinstaller.py
index acdc0898c..2fd314550 100644
--- a/pyinstaller.py
+++ b/pyinstaller.py
@@ -102,7 +102,6 @@ def pyinstall(source_folder):
         print("Unable to remove old folder", e)
 
     conan_path = os.path.join(source_folder, 'conans', 'conan.py')
-    conan_server_path = os.path.join(source_folder, 'conans', 'conan_server.py')
     hidden = ("--hidden-import=glob "  # core stdlib
               "--hidden-import=pathlib "
               "--hidden-import=distutils.dir_util "
@@ -135,16 +134,6 @@ def pyinstall(source_folder):
 
     _run_bin(pyinstaller_path)
 
-    subprocess.call('%s -y -p "%s" --console "%s" %s'
-                    % (command, source_folder, conan_server_path, win_ver),
-                    cwd=pyinstaller_path, shell=True)
-
-    conan_bin = os.path.join(pyinstaller_path, 'dist', 'conan')
-    conan_server_folder = os.path.join(pyinstaller_path, 'dist', 'conan_server')
-
-    dir_util.copy_tree(conan_server_folder, conan_bin)
-    _run_bin(pyinstaller_path)
-
     return os.path.abspath(os.path.join(pyinstaller_path, 'dist', 'conan'))
 
 


Test patch:
diff --git a/conans/test/unittests/tools/build/test_cppstd.py b/conans/test/unittests/tools/build/test_cppstd.py
index 2be74004e..b3d24c10a 100644
--- a/conans/test/unittests/tools/build/test_cppstd.py
+++ b/conans/test/unittests/tools/build/test_cppstd.py
@@ -79,8 +79,9 @@ def test_supported_cppstd_apple_clang(compiler, compiler_version, values):
 
 @pytest.mark.parametrize("compiler,compiler_version,values", [
     ("msvc", "180", []),
-    ("msvc", "190", ['14', '17']),
-    ("msvc", "191", ['14', '17', '20']),
+    ("msvc", "190", ['14']),
+    ("msvc", "191", ['14', '17']),
+    ("msvc", "192", ['14', '17', '20']),
     ("msvc", "193", ['14', '17', '20', '23']),
 ])
 def test_supported_cppstd_msvc(compiler, compiler_version, values):