From eb8a24f23d073bc415c1fd82b5b0053762f5c909 Mon Sep 17 00:00:00 2001 From: Val Markovic Date: Mon, 29 Feb 2016 10:26:50 -0800 Subject: [PATCH] Addressing review comments --- .travis.yml | 5 ----- autoload/youcompleteme.vim | 3 +++ python/ycm/paths.py | 10 ++++++---- python/ycm/tests/youcompleteme_test.py | 8 ++++++++ travis/travis_install.osx.sh | 2 +- travis/travis_install.sh | 1 - 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index d5570c66..a5dd8824 100644 --- a/.travis.yml +++ b/.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 diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 76d6f58b..e799055e 100644 --- a/autoload/youcompleteme.vim +++ b/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 ) diff --git a/python/ycm/paths.py b/python/ycm/paths.py index 2b21e7c2..6fd98c9a 100644 --- a/python/ycm/paths.py +++ b/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' ] ) diff --git a/python/ycm/tests/youcompleteme_test.py b/python/ycm/tests/youcompleteme_test.py index 40dce0d4..a72dedf4 100644 --- a/python/ycm/tests/youcompleteme_test.py +++ b/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 . +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() diff --git a/travis/travis_install.osx.sh b/travis/travis_install.osx.sh index 85cdf2f9..3873f93e 100644 --- a/travis/travis_install.osx.sh +++ b/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 diff --git a/travis/travis_install.sh b/travis/travis_install.sh index 15d705bd..b9067c4c 100644 --- a/travis/travis_install.sh +++ b/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 ############