From 3f54d45ad832984b0601efe6ff62f6d16a4de2a5 Mon Sep 17 00:00:00 2001 From: "J. Goutin" Date: Tue, 2 Aug 2016 18:26:02 +0200 Subject: Patch distutils._msvccompiler.library_dir_option Try to fix #694. --- setuptools/msvc.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'setuptools') diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 6fb3300b..419b2292 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -85,6 +85,11 @@ def patch_for_specialized_compiler(): except Exception: pass + try: + # Patch distutils._msvccompiler.library_dir_option + unpatched['msvc14_library_dir_option'] = msvc14compiler.library_dir_option + msvc14compiler.library_dir_option = msvc14_library_dir_option + def msvc9_find_vcvarsall(version): """ @@ -212,6 +217,12 @@ def msvc14_get_vc_env(plat_spec): raise +def msvc14_library_dir_option(dir): + if ' ' in dir: + dir = '"%s"' % dir + return unpatched['msvc14_library_dir_option'](dir) + + def _augment_exception(exc, version, arch=''): """ Add details to the exception message to help guide the user -- cgit v1.2.3 From 2214dbbd6fb407cf2313dba44558557072cf0974 Mon Sep 17 00:00:00 2001 From: "J. Goutin" Date: Tue, 2 Aug 2016 18:29:53 +0200 Subject: Update msvc.py --- setuptools/msvc.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'setuptools') diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 419b2292..2a746332 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -89,6 +89,8 @@ def patch_for_specialized_compiler(): # Patch distutils._msvccompiler.library_dir_option unpatched['msvc14_library_dir_option'] = msvc14compiler.library_dir_option msvc14compiler.library_dir_option = msvc14_library_dir_option + except Exception: + pass def msvc9_find_vcvarsall(version): -- cgit v1.2.3 From 2c4346bcc47ec1fd6fc77bd5bb4f760ed7c6667c Mon Sep 17 00:00:00 2001 From: "J. Goutin" Date: Tue, 2 Aug 2016 18:42:24 +0200 Subject: Update msvc.py --- setuptools/msvc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools') diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 2a746332..785d879b 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -220,7 +220,7 @@ def msvc14_get_vc_env(plat_spec): def msvc14_library_dir_option(dir): - if ' ' in dir: + if ' ' in dir and '"' not in dir: dir = '"%s"' % dir return unpatched['msvc14_library_dir_option'](dir) -- cgit v1.2.3 From 651e3ffacb4208469e97a4eeaba623f5413daa7d Mon Sep 17 00:00:00 2001 From: "J. Goutin" Date: Wed, 3 Aug 2016 20:15:55 +0200 Subject: Fix from @vallsv Fix from @vallsv --- setuptools/msvc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'setuptools') diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 785d879b..3e2472a2 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -87,8 +87,8 @@ def patch_for_specialized_compiler(): try: # Patch distutils._msvccompiler.library_dir_option - unpatched['msvc14_library_dir_option'] = msvc14compiler.library_dir_option - msvc14compiler.library_dir_option = msvc14_library_dir_option + unpatched['msvc14_library_dir_option'] = msvc14compiler.MSVCCompiler.library_dir_option + msvc14compiler.MSVCCompiler.library_dir_option = msvc14_library_dir_option except Exception: pass @@ -219,10 +219,10 @@ def msvc14_get_vc_env(plat_spec): raise -def msvc14_library_dir_option(dir): +def msvc14_library_dir_option(self, dir): if ' ' in dir and '"' not in dir: dir = '"%s"' % dir - return unpatched['msvc14_library_dir_option'](dir) + return unpatched['msvc14_library_dir_option'](self, dir) def _augment_exception(exc, version, arch=''): -- cgit v1.2.3 From 7b1fa7643e2599f24956323a2066a6e26dc57b82 Mon Sep 17 00:00:00 2001 From: "J. Goutin" Date: Thu, 4 Aug 2016 12:22:54 +0200 Subject: doc for msvc14_library_dir_option --- setuptools/msvc.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'setuptools') diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 3e2472a2..da26371c 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -86,7 +86,7 @@ def patch_for_specialized_compiler(): pass try: - # Patch distutils._msvccompiler.library_dir_option + # Patch distutils._msvccompiler.MSVCCompiler.library_dir_option unpatched['msvc14_library_dir_option'] = msvc14compiler.MSVCCompiler.library_dir_option msvc14compiler.MSVCCompiler.library_dir_option = msvc14_library_dir_option except Exception: @@ -220,7 +220,21 @@ def msvc14_get_vc_env(plat_spec): def msvc14_library_dir_option(self, dir): + """ + Patched "distutils._msvccompiler.MSVCCompiler.library_dir_option" + to fix unquoted path in "\LIBPATH" argument when a space is on path. + + Parameters + ---------- + dir: str + Path to convert in "\LIBPATH" argument. + + Return + ------ + "\LIBPATH" argument: str + """ if ' ' in dir and '"' not in dir: + # Quote if space and not already quoted dir = '"%s"' % dir return unpatched['msvc14_library_dir_option'](self, dir) -- cgit v1.2.3