Repository: conan-io/conan
Pull request #2851 (2018-05-04 11:33:54)

Release 1.3.2


Patch:
diff --git a/conans/__init__.py b/conans/__init__.py
index 78c06a160..219cd42ec 100644
--- a/conans/__init__.py
+++ b/conans/__init__.py
@@ -16,4 +16,4 @@ COMPLEX_SEARCH_CAPABILITY = "complex_search"
 SERVER_CAPABILITIES = [COMPLEX_SEARCH_CAPABILITY, ]
 
 
-__version__ = '1.3.1'
+__version__ = '1.3.2'
diff --git a/conans/client/build/compiler_flags.py b/conans/client/build/compiler_flags.py
index fd05f1845..9ec94021f 100644
--- a/conans/client/build/compiler_flags.py
+++ b/conans/client/build/compiler_flags.py
@@ -96,7 +96,7 @@ def build_type_flags(compiler, build_type, vs_toolset=None):
                      "RelWithDebInfo": ["-gline-tables-only", "-O2", "-fno-inline"],
                      "MinSizeRel": []
                      }.get(build_type, ["-O2", "-Ob2"])
-        elif not vs_toolset:
+        else:
             flags = {"Debug": ["-Zi", "-Ob0", "-Od"],
                      "Release": ["-O2", "-Ob2"],
                      "RelWithDebInfo": ["-Zi", "-O2", "-Ob1"],
diff --git a/conans/client/cmd/new_ci.py b/conans/client/cmd/new_ci.py
index 902f77ec4..f9a8b1378 100644
--- a/conans/client/cmd/new_ci.py
+++ b/conans/client/cmd/new_ci.py
@@ -265,9 +265,10 @@ def get_travis(name, version, user, channel, linux_gcc_versions, linux_clang_ver
         for clang in linux_clang_versions:
             config.append(linux_config_clang.format(version=clang, name=clang.replace(".", "")))
 
-    xcode_map = {"8.1": "8.3",
-                 "7.3": "7.3",
-                 "9.0": "9.2"}
+    xcode_map = {"7.3": "7.3",
+                 "8.1": "8.3",
+                 "9.0": "9.2",
+                 "9.1": "9.3"}
     for apple_clang in osx_clang_versions:
         xcode = xcode_map[apple_clang]
         config.append(osx_config.format(xcode=xcode, version=apple_clang))
@@ -331,8 +332,9 @@ def get_circleci(name, version, user, channel, linux_gcc_versions, linux_clang_v
             config.append(circleci_config_clang.format(version=clang, name=clang_name))
             jobs.append(circleci_job.format(job='clang-{}'.format(clang_name)))
 
-    xcode_map = {"8.1": "8.3.3",
-                 "9.0": "9.0"}
+    xcode_map = {"7.3": "7.3",
+                 "8.1": "8.3.3",
+                 "9.0": "9.2"}
     for apple_clang in osx_clang_versions:
         osx_name = xcode_map[apple_clang]
         config.append(circleci_config_osx.format(name=osx_name, version=apple_clang))
@@ -376,9 +378,9 @@ def ci_get_files(name, version, user, channel, visual_versions, linux_gcc_versio
     if circleci_clang_versions is True:
         circleci_clang_versions = clang_versions
     if osx_clang_versions is True:
-        osx_clang_versions = ["7.3", "8.1", "9.0"]
+        osx_clang_versions = ["7.3", "8.1", "9.0", "9.1"]
     if circleci_osx_versions is True:
-        circleci_osx_versions = ["8.1", "9.0"]
+        circleci_osx_versions = ["7.3", "8.1", "9.0"]
     if not visual_versions:
         visual_versions = []
     if not linux_gcc_versions:
diff --git a/conans/client/package_installer.py b/conans/client/package_installer.py
index 1c4e298fe..c2240e6be 100644
--- a/conans/client/package_installer.py
+++ b/conans/client/package_installer.py
@@ -43,7 +43,7 @@ def get_package(conanfile, package_ref, package_folder, output, recorder, proxy,
         else:
             remote = registry.get_ref(package_ref.conan)
             # remote will be defined, as package availability has been checked from installer
-            remote_manager.get_package(conanfile, package_ref, package_folder, remote, output)
+            remote_manager.get_package(conanfile, package_ref, package_folder, remote, output, recorder)
             if get_env("CONAN_READ_ONLY_CACHE", False):
                 make_read_only(package_folder)
             recorder.package_downloaded(package_ref, remote.url)
diff --git a/conans/client/proxy.py b/conans/client/proxy.py
index f55fe3b7e..848cc025f 100644
--- a/conans/client/proxy.py
+++ b/conans/client/proxy.py
@@ -11,6 +11,7 @@ from conans.model.ref import PackageReference
 from conans.util.log import logger
 from conans.util.tracer import log_recipe_got_from_local_cache
 from conans.client.source import complete_recipe_sources
+from conans.model.info import ConanInfo
 
 
 class ConanProxy(object):
@@ -248,6 +249,8 @@ class ConanProxy(object):
         if not os.path.exists(conanfile_path):
             raise Exception("Download recipe first")
         conanfile = load_conanfile_class(conanfile_path)
+        # FIXME: This is a hack to provide a info object in case it fails and raise_package_not_found_error doesnt fail
+        conanfile.info = ConanInfo.loads("")
         short_paths = conanfile.short_paths
         self._registry.set_ref(reference, remote)
         output = ScopedOutput(str(reference), self._out)
@@ -255,4 +258,4 @@ class ConanProxy(object):
             package_ref = PackageReference(reference, package_id)
             package_folder = self._client_cache.package(package_ref, short_paths=short_paths)
             self._out.info("Downloading %s" % str(package_ref))
-            self._remote_manager.get_package(conanfile, package_ref, package_folder, remote, output)
+            self._remote_manager.get_package(conanfile, package_ref, package_folder, remote, output, self._recorder)
diff --git a/conans/client/remote_manager.py b/conans/client/remote_manager.py
index f8e6913aa..0a0e08dc5 100644
--- a/conans/client/remote_manager.py
+++ b/conans/client/remote_manager.py
@@ -21,6 +21,7 @@ from conans.util.tracer import (log_package_upload, log_recipe_upload,
                                 log_package_download)
 from conans.client.source import merge_directories
 from conans.client.package_installer import raise_package_not_found_error
+import stat
 
 
 class RemoteManager(object):
@@ -214,7 +215,7 @@ class RemoteManager(object):
             rmdir(c_src_path)
         touch_folder(export_sources_folder)
 
-    def get_package(self, conanfile, package_reference, dest_folder, remote, output):
+    def get_package(self, conanfile, package_reference, dest_folder, remote, output, recorder):
         package_id = package_reference.package_id
         output.info("Retrieving package %s from remote '%s' " % (package_id, remote.name))
         rm_conandir(dest_folder)  # Remove first the destination folder
@@ -225,7 +226,7 @@ class RemoteManager(object):
         except NotFoundException as e:
             output.warn('Binary for %s not in remote: %s' % (package_id, str(e)))
             raise_package_not_found_error(conanfile, package_reference.conan,
-                                          package_id, output, remote.url)
+                                          package_id, output, recorder, remote.url)
         else:
             duration = time.time() - t1
             log_package_download(package_reference, duration, remote, zipped_files)
@@ -321,16 +322,17 @@ def compress_files(files, symlinks, name, dest_dir):
         # tgz_contents = BytesIO()
         tgz = gzopen_without_timestamps(name, mode="w", fileobj=tgz_handle)
 
-        for filename, dest in symlinks.items():
+        for filename, dest in sorted(symlinks.items()):
             info = tarfile.TarInfo(name=filename)
             info.type = tarfile.SYMTYPE
             info.linkname = dest
             tgz.addfile(tarinfo=info)
 
-        for filename, abs_path in files.items():
+        mask = ~(stat.S_IWOTH | stat.S_IWGRP)
+        for filename, abs_path in sorted(files.items()):
             info = tarfile.TarInfo(name=filename)
             info.size = os.stat(abs_path).st_size
-            info.mode = os.stat(abs_path).st_mode
+            info.mode = os.stat(abs_path).st_mode & mask
             if os.path.islink(abs_path):
                 info.type = tarfile.SYMTYPE
                 info.linkname = os.readlink(abs_path)  # @UndefinedVariable
diff --git a/conans/client/tools/win.py b/conans/client/tools/win.py
index 6fe75fb5b..d025ec4dd 100644
--- a/conans/client/tools/win.py
+++ b/conans/client/tools/win.py
@@ -444,4 +444,4 @@ def run_in_windows_bash(conanfile, bashcmd, cwd=None, subsystem=None, msys_mingw
         wincmd = '%s --login -c %s' % (bash_path, escape_windows_cmd(to_run))
         conanfile.output.info('run_in_windows_bash: %s' % wincmd)
         # https://github.com/conan-io/conan/issues/2839 (subprocess=True)
-        return conanfile._runner(wincmd, win_bash=False, subprocess=True)
+        return conanfile._runner(wincmd, output=conanfile.output, subprocess=True)


Test patch:
diff --git a/conans/test/build_helpers/visual_environment_test.py b/conans/test/build_helpers/visual_environment_test.py
index 04bca58d9..a5c7caa14 100644
--- a/conans/test/build_helpers/visual_environment_test.py
+++ b/conans/test/build_helpers/visual_environment_test.py
@@ -3,6 +3,7 @@ import unittest
 from conans import tools
 from conans.test.utils.conanfile import MockConanfile, MockSettings
 from conans.client.build.visual_environment import VisualStudioBuildEnvironment
+from conans.test.utils.tools import TestClient
 
 
 class VisualStudioBuildEnvironmentTest(unittest.TestCase):
@@ -87,3 +88,63 @@ class VisualStudioBuildEnvironmentTest(unittest.TestCase):
                       '-I/four/include/path -I/five/include/path',
                 "LIB": "/one/lib/path;/two/lib/path;/three/lib/path;/four/lib/path;/five/lib/path",
             })
+
+    def build_type_toolset_test(self):
+        profile = """
+[settings]
+os=Windows
+compiler=Visual Studio
+compiler.version=15
+build_type=Release
+"""
+        profile_toolset = """
+[settings]
+os=Windows
+compiler=Visual Studio
+compiler.version=15
+compiler.toolset=v141
+build_type=Release
+"""
+        profile_toolset_clang = """
+[settings]
+os=Windows
+compiler=Visual Studio
+compiler.version=15
+build_type=Release
+compiler.toolset=v141_clang_c2
+"""
+        conanfile = """
+from conans import ConanFile, VisualStudioBuildEnvironment
+
+class TestConan(ConanFile):
+    name = "testlib"
+    version = "1.0"
+    settings = "compiler", "build_type", "os"
+
+    def build(self):
+        env_build = VisualStudioBuildEnvironment(self)
+        self.output.info(env_build.flags)
+        """
+        client = TestClient()
+        client.save({"profile": profile,
+                     "profile_toolset": profile_toolset,
+                     "profile_toolset_clang": profile_toolset_clang,
+                     "conanfile.py": conanfile})
+
+        result = {"Debug": "['-Zi', '-Ob0', '-Od']",
+                  "Release": "['-DNDEBUG', '-O2', '-Ob2']",
+                  "RelWithDebInfo": "['-Zi', '-O2', '-Ob1']",
+                  "MinSizeRel": "['-O1', '-Ob1']"}
+        result_toolset_clang = {"Debug": "['-gline-tables-only', '-fno-inline', '-O0']",
+                                "Release": "['-DNDEBUG', '-O2']",
+                                "RelWithDebInfo": "['-gline-tables-only', '-O2', '-fno-inline']",
+                                "MinSizeRel": "[]"}
+
+        for build_type in ["Debug", "Release", "RelWithDebInfo", "MinSizeRel"]:
+            client.run("create . danimtb/testing -pr=profile -s build_type=%s" % build_type)
+            self.assertIn(result[build_type], client.out)
+            client.run("create . danimtb/testing -pr=profile_toolset -s build_type=%s" % build_type)
+            self.assertIn(result[build_type], client.out)
+            client.run("create . danimtb/testing -pr=profile_toolset_clang -s build_type=%s" %
+                       build_type)
+            self.assertIn(result_toolset_clang[build_type], client.out)
diff --git a/conans/test/command/download_test.py b/conans/test/command/download_test.py
index 06c5f3023..3d5aa0371 100644
--- a/conans/test/command/download_test.py
+++ b/conans/test/command/download_test.py
@@ -137,3 +137,20 @@ class Pkg(ConanFile):
         self.assertTrue(os.path.exists(client.paths.conanfile(ref)))
         # Check package folder created
         self.assertTrue(os.path.exists(package_folder))
+
+    def test_download_wrong_id(self):
+        client = TestClient(servers={"default": TestServer()},
+                            users={"default": [("lasote", "mypass")]})
+        conanfile = """from conans import ConanFile
+class Pkg(ConanFile):
+    pass
+"""
+        client.save({"conanfile.py": conanfile})
+        client.run("export . pkg/0.1@lasote/stable")
+        client.run("upload pkg/0.1@lasote/stable")
+        client.run("remove pkg/0.1@lasote/stable -f")
+
+        error = client.run("download pkg/0.1@lasote/stable -p=wrong", ignore_error=True)
+        self.assertTrue(error)
+        self.assertIn("ERROR: Missing prebuilt package for 'pkg/0.1@lasote/stable'", client.out)
+        self.assertIn("Package ID: wrong", client.out)
diff --git a/conans/test/functional/tgz_md5_test.py b/conans/test/functional/tgz_md5_test.py
index a624bb4a7..2bc31d372 100644
--- a/conans/test/functional/tgz_md5_test.py
+++ b/conans/test/functional/tgz_md5_test.py
@@ -1,9 +1,10 @@
+import os
+import time
 import unittest
+
 from conans.test.utils.test_files import temp_folder
 from conans.util.files import save, md5sum
 from conans.paths import PACKAGE_TGZ_NAME
-import os
-import time
 from conans.client.remote_manager import compress_files
 
 
@@ -24,6 +25,7 @@ class TgzMd5Test(unittest.TestCase):
         file_path = os.path.join(folder, PACKAGE_TGZ_NAME)
 
         md5_a = md5sum(file_path)
+        self.assertEqual(md5_a, "df220cfbc0652e8992a89a77666c03b5")
 
         time.sleep(1)  # Timestamps change
 
diff --git a/conans/test/util/tools_test.py b/conans/test/util/tools_test.py
index 4ac846092..52968652e 100644
--- a/conans/test/util/tools_test.py
+++ b/conans/test/util/tools_test.py
@@ -622,7 +622,7 @@ class MyConan(ConanFile):
                 self.env = {"PATH": "/path/to/somewhere"}
 
                 class MyRun(object):
-                    def __call__(self, command, win_bash=False, subprocess=False):  # @UnusedVariable
+                    def __call__(self, command, output, log_filepath=None, cwd=None, subprocess=False):  # @UnusedVariable
                         self.command = command
                 self._runner = MyRun()
 
diff --git a/conans/test/utils/runner.py b/conans/test/utils/runner.py
index 62538d0da..356a3a7ec 100644
--- a/conans/test/utils/runner.py
+++ b/conans/test/utils/runner.py
@@ -11,5 +11,6 @@ class TestRunner(object):
                                             generate_run_log_file=True,
                                             log_run_to_output=True)
 
-    def __call__(self, command, output=None, log_filepath=None, cwd=None):
-        return self.runner(command, output=self._output, log_filepath=log_filepath, cwd=cwd)
+    def __call__(self, command, output=None, log_filepath=None, cwd=None, subprocess=False):
+        return self.runner(command, output=self._output, log_filepath=log_filepath, cwd=cwd,
+                           subprocess=subprocess)