فهرست منبع

Addressing review comments

Val Markovic 9 سال پیش
والد
کامیت
eb8a24f23d
6فایلهای تغییر یافته به همراه18 افزوده شده و 11 حذف شده
  1. 0 5
      .travis.yml
  2. 3 0
      autoload/youcompleteme.vim
  3. 6 4
      python/ycm/paths.py
  4. 8 0
      python/ycm/tests/youcompleteme_test.py
  5. 1 1
      travis/travis_install.osx.sh
  6. 0 1
      travis/travis_install.sh

+ 0 - 5
.travis.yml

@@ -52,9 +52,4 @@ addons:
 cache:
   directories:
     - $HOME/.cache/pip  # Python packages from pip
-    - $HOME/.npm  # Node packages from npm
-    - $HOME/.multirust  # What multirust downloads
-    - $HOME/.cargo  # Cargo package deps
     - $HOME/.pyenv  # pyenv
-    - $TRAVIS_BUILD_DIR/clang_archives  # Clang downloads
-    - $TRAVIS_BUILD_DIR/third_party/racerd/target  # Racerd compilation

+ 3 - 0
autoload/youcompleteme.vim

@@ -29,6 +29,7 @@ let s:cursor_moved = 0
 let s:moved_vertically_in_insert_mode = 0
 let s:previous_num_chars_on_current_line = strlen( getline('.') )
 
+
 function! s:UsingPython2()
   " I'm willing to bet quite a bit that sooner or later, somebody will ask us to
   " make it configurable which version of Python we use.
@@ -38,10 +39,12 @@ function! s:UsingPython2()
   return 0
 endfunction
 
+
 let s:using_python2 = s:UsingPython2()
 let s:python_until_eof = s:using_python2 ? "python << EOF" : "python3 << EOF"
 let s:python_command = s:using_python2 ? "py " : "py3 "
 
+
 function! s:Pyeval( eval_string )
   if s:using_python2
     return pyeval( a:eval_string )

+ 6 - 4
python/ycm/paths.py

@@ -35,7 +35,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(\.[3456789])?))?(.exe)?$' )
+  r'python((2(\.[67])?)|(3(\.[3-9])?))?(.exe)?$' )
 
 
 def Memoize( obj ):
@@ -73,9 +73,11 @@ def PathToPythonInterpreter():
   if IsPythonVersionCorrect( python_interpreter ):
     return python_interpreter
 
-  # As a last resort, we search python in the PATH. We check 'python2' before
-  # 'python' because on some distributions (Arch Linux for example), python
-  # refers to python3.
+  # As a last resort, we search python in the PATH. We prefer Python 2 over 3
+  # for the sake of backwards compatibility with ycm_extra_conf.py files out
+  # there; few people wrote theirs to work on py3.
+  # So we check 'python2' before 'python' because on some distributions (Arch
+  # Linux for example), python refers to python3.
   python_interpreter = utils.PathToFirstExistingExecutable( [ 'python2',
                                                               'python',
                                                               'python3' ] )

+ 8 - 0
python/ycm/tests/youcompleteme_test.py

@@ -15,6 +15,14 @@
 # You should have received a copy of the GNU General Public License
 # along with YouCompleteMe.  If not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import unicode_literals
+from __future__ import print_function
+from __future__ import division
+from __future__ import absolute_import
+from future import standard_library
+standard_library.install_aliases()
+from builtins import *  # noqa
+
 from ycm.test_utils import MockVimModule
 MockVimModule()
 

+ 1 - 1
travis/travis_install.osx.sh

@@ -12,7 +12,7 @@ REQUIREMENTS="ninja
               pkg-config
               openssl"
 
-# Install node, go, ninja, pyenv and dependencies
+# Install pyenv and dependencies
 for pkg in $REQUIREMENTS; do
   # Install package, or upgrade it if it is already installed
   brew install $pkg || brew outdated $pkg || brew upgrade $pkg

+ 0 - 1
travis/travis_install.sh

@@ -47,7 +47,6 @@ python_version=$(python -c 'import sys; print( "{0}.{1}".format( sys.version_inf
 echo "Checking python version (actual ${python_version} vs expected ${YCM_PYTHON_VERSION})"
 test ${python_version} == ${YCM_PYTHON_VERSION}
 
-
 ############
 # pip setup
 ############