浏览代码

Accept capitalized name for Python executable

Python executable name may be capitalized on macOS.
micbou 8 年之前
父节点
当前提交
fb000ca9e7
共有 2 个文件被更改,包括 7 次插入4 次删除
  1. 1 1
      python/ycm/paths.py
  2. 6 3
      python/ycm/tests/paths_test.py

+ 1 - 1
python/ycm/paths.py

@@ -34,7 +34,7 @@ DIR_OF_YCMD = os.path.join( DIR_OF_CURRENT_SCRIPT, '..', '..', 'third_party',
                             'ycmd' )
 WIN_PYTHON_PATH = os.path.join( sys.exec_prefix, 'python.exe' )
 PYTHON_BINARY_REGEX = re.compile(
-  r'python((2(\.[67])?)|(3(\.[3-9])?))?(.exe)?$' )
+  r'python((2(\.[67])?)|(3(\.[3-9])?))?(.exe)?$', re.IGNORECASE )
 
 
 def Memoize( obj ):

+ 6 - 3
python/ycm/tests/paths_test.py

@@ -30,11 +30,13 @@ from ycm.paths import _EndsWithPython
 
 
 def EndsWithPython_Good( path ):
-  ok_( _EndsWithPython( path ) )
+  ok_( _EndsWithPython( path ),
+       'Path {0} does not end with a Python name.'.format( path ) )
 
 
 def EndsWithPython_Bad( path ):
-  ok_( not _EndsWithPython( path ) )
+  ok_( not _EndsWithPython( path ),
+       'Path {0} does end with a Python name.'.format( path ) )
 
 
 def EndsWithPython_Python2Paths_test():
@@ -43,7 +45,8 @@ def EndsWithPython_Python2Paths_test():
     'python2',
     '/usr/bin/python2.6',
     '/home/user/.pyenv/shims/python2.7',
-    r'C:\Python26\python.exe'
+    r'C:\Python26\python.exe',
+    '/Contents/MacOS/Python'
   ]
 
   for path in python_paths: