Commit 8e2f565b authored by David Kalnischkies's avatar David Kalnischkies

New upstream version 0+20181101+gitfaa019a

parent 2f672642
version: 2
aliases:
common: &common
macos:
xcode: 9.0
update-submodules: &update-submodules
run:
name: Update submodules
command: git submodule update --init --recursive
install-dependencies: &install-dependencies
run:
name: Install dependencies
command: .circleci/install_dependencies.sh
run-tests: &run-tests
run:
name: Run tests
command: ./run_tests.py --coverage
upload-coverage: &upload-coverage
run:
name: Upload coverage
command: bash <(curl -s https://codecov.io/bash)
# Increase the version key to clear the cache.
save-cache: &save-cache
save_cache:
key: v2-ycm-{{ .Environment.CIRCLE_JOB }}
paths:
- ~/Library/Caches/Homebrew
- ~/Library/Caches/pip
- ~/.pyenv
restore-cache: &restore-cache
restore_cache:
key: v2-ycm-{{ .Environment.CIRCLE_JOB }}
jobs:
python2:
<<: *common
steps:
- checkout
- *update-submodules
- *restore-cache
- *install-dependencies
- *save-cache
- *run-tests
- *upload-coverage
environment:
YCMD_PYTHON_VERSION: 2.7
python3:
<<: *common
steps:
- checkout
- *update-submodules
- *restore-cache
- *install-dependencies
- *save-cache
- *run-tests
- *upload-coverage
environment:
YCMD_PYTHON_VERSION: 3.4
workflows:
version: 2
build:
jobs:
- python2
- python3
#!/bin/bash
# Exit immediately if a command returns a non-zero status.
set -e
################
# Homebrew setup
################
# There's a homebrew bug which causes brew update to fail the first time. Run
# it twice to workaround. https://github.com/Homebrew/homebrew/issues/42553
brew update || brew update
# List of homebrew formulae to install in the order they appear.
# We require CMake for our build and tests, and all the others are dependencies
# of pyenv.
REQUIREMENTS="cmake
readline
autoconf
pkg-config
openssl"
# Install CMake and pyenv 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
done
##############
# Python setup
##############
PYENV_ROOT="${HOME}/.pyenv"
if [ ! -d "${PYENV_ROOT}/.git" ]; then
rm -rf ${PYENV_ROOT}
git clone https://github.com/yyuu/pyenv.git ${PYENV_ROOT}
fi
pushd ${PYENV_ROOT}
git fetch --tags
git checkout v1.2.1
popd
PATH="${PYENV_ROOT}/bin:${PATH}"
eval "$(pyenv init -)"
if [ "${YCMD_PYTHON_VERSION}" == "2.7" ]; then
# Prior versions fail to compile with error "ld: library not found for
# -lSystemStubs"
PYENV_VERSION="2.7.2"
else
PYENV_VERSION="3.4.0"
fi
# In order to work with ycmd, python *must* be built as a shared library. The
# most compatible way to do this on macOS is with --enable-framework. This is
# set via the PYTHON_CONFIGURE_OPTS option.
export PYTHON_CONFIGURE_OPTS="--enable-framework"
pyenv install --skip-existing ${PYENV_VERSION}
pyenv rehash
pyenv global ${PYENV_VERSION}
# Initialize pyenv in other steps. See
# https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables
# and https://github.com/pyenv/pyenv/issues/264
echo "export PATH=${PYENV_ROOT}/bin:\$PATH
if [ -z \"\${PYENV_LOADING}\" ]; then
export PYENV_LOADING=true
eval \"\$(pyenv init -)\"
unset PYENV_LOADING
fi" >> $BASH_ENV
pip install -r python/test_requirements.txt
set +e
......@@ -17,7 +17,9 @@ the brackets) _before_ filing your issue:**
- [ ] If filing a bug report, I have included which OS (including specific OS
version) I am using.
- [ ] If filing a bug report, I have included a minimal test case that reproduces
my issue.
my issue, including what I expected to happen and what actually happened.
- [ ] If filing a installation failure report, I have included the entire output
of `install.py` (or `cmake`/`make`/`ninja`) including its invocation
- [ ] **I understand this is an open-source project staffed by volunteers and
that any help I receive is a selfless, heartfelt _gift_ of their free time. I
know I am not entitled to anything and will be polite and courteous.**
......@@ -29,11 +31,53 @@ quickly and that neither your nor our time is needlessly wasted.
# Issue Details
[If filing a bug report, please include **a list of steps** that describe how to
reproduce the bug you are experiencing. Also include test code if relevant.]
> Provide a clear description of the problem, including the following key
> questions:
* What did you do?
> Include steps to reproduce here.
> Include description of a minimal test case, including any actual code required
> to reproduce the issue.
* What did you expect to happen?
> Include description of the expected behaviour.
* What actually happened?
> Include description of the observed behaviour, including actual output,
> screenshots, etc.
# Diagnostic data
## Output of `vim --version`
> Place the output here, or a link to a [gist][].
## Output of `YcmDebugInfo`
> Place the output here, or a link to a [gist][].
## Contents of YCM, ycmd and completion engine logfiles
> Add `let g:ycm_log_level = 'debug'` to vimrc, restart Vim, reproduce the
> issue, and include link here to a [gist][] containing the entire logfiles for
> ycm, ycmd and any completer logfiles listed by `:YcmToggleLogs`.
## OS version, distribution, etc.
> Include system information here.
## Output of build/install commands
> Include link to a [gist][] containing the invocation and entire output of
> `install.py` if reporting an installation issue.
[cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md
[code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md
[readme]: https://github.com/Valloric/YouCompleteMe/blob/master/README.md
[faq]: https://github.com/Valloric/YouCompleteMe/blob/master/README.md#faq
[search]: https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fgithub.com%2FValloric%2FYouCompleteMe%2Fissues%20python%20mac
[gist]: https://gist.github.com/
# Compiled Object files
*.slo
*.lo
*.o
# Compiled Dynamic libraries
*.dll
*.so
*.dylib
# Compiled Static libraries
*.lai
*.la
*.a
# CMake
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt
# Python
*.py[cod]
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
cover/
.tox
nosetests.xml
.noseids
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
# custom
ycm_core_tests
# When we use the bcp tool to copy over the parts of boost we care about, it
# also copies some cruft files we don't need; this ignores them
cpp/BoostParts/libs/*/build
cpp/BoostParts/libs/*/test
# These folders in cpp/llvm contain lots of upstream cruft we don't care
# about and would rather not have in our tree...
cpp/llvm/docs/*
cpp/llvm/tools/clang/www/*
# ... but excluding these LLVMBuild.txt files breaks the build so we need to
# explicitely include them
!LLVMBuild.txt
# Exclude auto generated vim doc tags.
doc/tags
[submodule "third_party/requests-futures"]
path = third_party/requests-futures
url = https://github.com/ross/requests-futures
[submodule "third_party/ycmd"]
path = third_party/ycmd
url = https://github.com/Valloric/ycmd
language: generic
sudo: false
before_install:
- git submodule update --init --recursive
install:
# source because it sets up env vars on some platforms
- source ci/travis/travis_install.sh
script: ./run_tests.py
after_success:
- codecov
env:
global:
# Travis can run out of RAM, so we need to be careful here.
- YCM_CORES=3
- COVERAGE=true
matrix:
- YCM_PYTHON_VERSION=2.7
- YCM_PYTHON_VERSION=3.4
addons:
apt:
sources:
# The Travis apt source whitelist can be found here:
# https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
- ubuntu-toolchain-r-test # for new libstdc++
- george-edison55-precise-backports # for a more recent version of cmake (3.2.3)
packages:
- cmake-data
- cmake
# 4.8 is the first version of GCC with good enough C++11 support to build
# ycmd.
- g++-4.8
# Everything below is a Python build dep (though it depends on Python
# version). We need them because pyenv builds Python.
- libssl-dev
- zlib1g-dev
- libbz2-dev
- libreadline-dev
- libsqlite3-dev
- wget
- curl
- llvm
- libncurses5-dev
- libncursesw5-dev
cache:
directories:
- $HOME/.cache/pip # Python packages from pip
- $HOME/.pyenv # pyenv
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <http://unlicense.org/>
import os
import subprocess
DIR_OF_THIS_SCRIPT = os.path.abspath( os.path.dirname( __file__ ) )
DIR_OF_THIRD_PARTY = os.path.join( DIR_OF_THIS_SCRIPT, 'third_party' )
DIR_OF_YCMD_THIRD_PARTY = os.path.join( DIR_OF_THIRD_PARTY,
'ycmd', 'third_party' )
def GetStandardLibraryIndexInSysPath( sys_path ):
for index, path in enumerate( sys_path ):
if os.path.isfile( os.path.join( path, 'os.py' ) ):
return index
raise RuntimeError( 'Could not find standard library path in Python path.' )
def PythonSysPath( **kwargs ):
sys_path = kwargs[ 'sys_path' ]
dependencies = [ os.path.join( DIR_OF_THIS_SCRIPT, 'python' ),
os.path.join( DIR_OF_THIRD_PARTY, 'requests-futures' ),
os.path.join( DIR_OF_THIRD_PARTY, 'ycmd' ),
os.path.join( DIR_OF_YCMD_THIRD_PARTY, 'frozendict' ),
os.path.join( DIR_OF_YCMD_THIRD_PARTY, 'requests' ) ]
# The concurrent.futures module is part of the standard library on Python 3.
interpreter_path = kwargs[ 'interpreter_path' ]
major_version = int( subprocess.check_output( [
interpreter_path, '-c', 'import sys; print( sys.version_info[ 0 ] )' ]
).rstrip().decode( 'utf8' ) )
if major_version == 2:
dependencies.append( os.path.join( DIR_OF_THIRD_PARTY, 'pythonfutures' ) )
sys_path[ 0:0 ] = dependencies
sys_path.insert( GetStandardLibraryIndexInSysPath( sys_path ) + 1,
os.path.join( DIR_OF_YCMD_THIRD_PARTY, 'python-future',
'src' ) )
return sys_path
This source diff could not be displayed because it is too large. You can view the blob instead.
version: '{build}'
image: Visual Studio 2017
environment:
COVERAGE: true
matrix:
- arch: 32
python: 35
python: 37
# We only test Python 2.7 on 64 bits.
- arch: 64
python: 27
- arch: 64
python: 35
python: 37
install:
- ci\appveyor\appveyor_install.bat
build_script:
......
This diff is collapsed.
# Linux-specific installation
# We can't use sudo, so we have to approximate the behaviour of setting the
# default system compiler.
mkdir ${HOME}/bin
ln -s /usr/bin/g++-4.8 ${HOME}/bin/c++
ln -s /usr/bin/gcc-4.8 ${HOME}/bin/cc
export PATH=${HOME}/bin:${PATH}
# In order to work with ycmd, python *must* be built as a shared library. This
# is set via the PYTHON_CONFIGURE_OPTS option.
export PYTHON_CONFIGURE_OPTS="--enable-shared"
# OS X-specific installation
# There's a homebrew bug which causes brew update to fail the first time. Run
# it twice to workaround. https://github.com/Homebrew/homebrew/issues/42553
brew update || brew update
# List of homebrew formulae to install in the order they appear.
# These are dependencies of pyenv.
REQUIREMENTS="ninja
readline
autoconf
pkg-config
openssl"
# 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
done
# In order to work with ycmd, python *must* be built as a shared library. The
# most compatible way to do this on OS X is with --enable-framework. This is
# set via the PYTHON_CONFIGURE_OPTS option
export PYTHON_CONFIGURE_OPTS="--enable-framework"
......@@ -2,41 +2,56 @@
set -ev
####################
# OS-specific setup
####################
# RVM overrides the cd, popd, and pushd shell commands, causing the
# "shell_session_update: command not found" error on macOS when executing those
# commands.
unset -f cd popd pushd
# Requirements of OS-specific install:
# - install any software which is not installed by Travis configuration
# - set up everything necessary so that pyenv can build python
source ci/travis/travis_install.${TRAVIS_OS_NAME}.sh
################
# Compiler setup
################
#############
# pyenv setup
#############
# We can't use sudo, so we have to approximate the behaviour of setting the
# default system compiler.
export PYENV_ROOT="${HOME}/.pyenv"
mkdir -p ${HOME}/bin
ln -s /usr/bin/g++-4.8 ${HOME}/bin/c++
ln -s /usr/bin/gcc-4.8 ${HOME}/bin/cc
export PATH=${HOME}/bin:${PATH}
##############
# Python setup
##############
PYENV_ROOT="${HOME}/.pyenv"
if [ ! -d "${PYENV_ROOT}/.git" ]; then
rm -rf ${PYENV_ROOT}
git clone https://github.com/yyuu/pyenv.git ${PYENV_ROOT}
fi
pushd ${PYENV_ROOT}
git fetch --tags
git checkout v20160202
git checkout v1.2.1
popd
export PATH="${PYENV_ROOT}/bin:${PATH}"
eval "$(pyenv init -)"
if [ "${YCM_PYTHON_VERSION}" == "2.6" ]; then
PYENV_VERSION="2.6.6"
elif [ "${YCM_PYTHON_VERSION}" == "2.7" ]; then
PYENV_VERSION="2.7.6"
if [ "${YCM_PYTHON_VERSION}" == "2.7" ]; then
# Tests are failing on Python 2.7.0 with the exception
# "TypeError: argument can't be <type 'unicode'>"
PYENV_VERSION="2.7.1"
else
PYENV_VERSION="3.3.6"
PYENV_VERSION="3.4.0"
fi
# In order to work with ycmd, python *must* be built as a shared library. This
# is set via the PYTHON_CONFIGURE_OPTS option.
export PYTHON_CONFIGURE_OPTS="--enable-shared"
pyenv install --skip-existing ${PYENV_VERSION}
pyenv rehash
pyenv global ${PYENV_VERSION}
......@@ -48,11 +63,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
############
pip install -U pip wheel setuptools
pip install -r python/test_requirements.txt
# The build infrastructure prints a lot of spam after this script runs, so make
......
......@@ -13,6 +13,10 @@ coverage:
patch: true
changes: true
# We don't want statistics for the tests themselves.
ignore:
- .*/tests/.*
comment:
layout: "header, diff, changes, uncovered"
behavior: default # update if exists else create new
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11,11 +11,11 @@ import sys
import os.path as p
import glob
PY_MAJOR, PY_MINOR = sys.version_info[ 0 : 2 ]
if not ( ( PY_MAJOR == 2 and PY_MINOR >= 6 ) or
( PY_MAJOR == 3 and PY_MINOR >= 3 ) or
PY_MAJOR, PY_MINOR, PY_PATCH = sys.version_info[ 0 : 3 ]
if not ( ( PY_MAJOR == 2 and PY_MINOR == 7 and PY_PATCH >= 1 ) or
( PY_MAJOR == 3 and PY_MINOR >= 4 ) or
PY_MAJOR > 3 ):
sys.exit( 'YouCompleteMe requires Python >= 2.6 or >= 3.3; '
sys.exit( 'YouCompleteMe requires Python >= 2.7.1 or >= 3.4; '
'your version of Python is ' + sys.version )
DIR_OF_THIS_SCRIPT = p.dirname( p.abspath( __file__ ) )
......
......@@ -27,16 +27,44 @@ endfunction
if exists( "g:loaded_youcompleteme" )
call s:restore_cpo()
finish
elseif v:version < 704 || (v:version == 704 && !has('patch143'))
elseif v:version < 704 || (v:version == 704 && !has( 'patch1578' ))
echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: requires Vim 7.4.143+" |
\ echomsg "YouCompleteMe unavailable: requires Vim 7.4.1578+." |
\ echohl None
if v:version == 704 && has( 'patch8056' )
" Very very special case for users of the default Vim on macOS. For some
" reason, that version of Vim contains a completely arbitrary (presumably
" custom) patch '8056', which fools users (but not our has( 'patch1578' )
" check) into thinking they have a sufficiently new Vim. In fact they do
" not and YCM fails to initialise. So we give them a more specific warning.
echohl WarningMsg
\ | echomsg
\ "Info: You appear to be running the default system Vim on macOS. "
\ . "It reports as patch 8056, but it is really older than 1578. "
\ . "Please consider MacVim, homebrew Vim or a self-built Vim that "
\ . "satisfies the minimum requirement."
\ | echohl None
endif
call s:restore_cpo()
finish
elseif !has( 'timers' )
echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: requires Vim compiled with " .
\ "the timers feature." |
\ echohl None
call s:restore_cpo()
finish
elseif !has( 'python' ) && !has( 'python3' )
echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: requires Vim compiled with " .
\ "Python (2.6+ or 3.3+) support" |
\ "Python (2.7.1+ or 3.4+) support." |
\ echohl None
call s:restore_cpo()
finish
elseif &encoding !~? 'utf-\?8'
echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: requires UTF-8 encoding. " .
\ "Put the line 'set encoding=utf-8' in your vimrc." |
\ echohl None
call s:restore_cpo()
finish
......@@ -50,9 +78,6 @@ let g:loaded_youcompleteme = 1
" The only defaults that are here are the ones that are only relevant to the YCM
" Vim client and not the ycmd server.
let g:ycm_allow_changing_updatetime =
\ get( g:, 'ycm_allow_changing_updatetime', 1 )
let g:ycm_open_loclist_on_ycm_diags =
\ get( g:, 'ycm_open_loclist_on_ycm_diags', 1 )
......@@ -71,6 +96,9 @@ let g:ycm_key_list_select_completion =
let g:ycm_key_list_previous_completion =
\ get( g:, 'ycm_key_list_previous_completion', ['<S-TAB>', '<Up>'] )
let g:ycm_key_list_stop_completion =
\ get( g:, 'ycm_key_list_stop_completion', ['<C-y>'] )
let g:ycm_key_invoke_completion =
\ get( g:, 'ycm_key_invoke_completion', '<C-Space>' )
......@@ -128,14 +156,15 @@ let g:ycm_goto_buffer_command =
let g:ycm_disable_for_files_larger_than_kb =
\ get( g:, 'ycm_disable_for_files_larger_than_kb', 1000 )
" On-demand loading. Let's use the autoload folder and not slow down vim's
" startup procedure.
if has( 'vim_starting' ) " loading at startup
if has( 'vim_starting' ) " Loading at startup.
" We defer loading until after VimEnter to allow the gui to fork (see
" `:h gui-fork`) and avoid a deadlock situation, as explained here:
" https://github.com/Valloric/YouCompleteMe/pull/2473#issuecomment-267716136
augroup youcompletemeStart
autocmd!
autocmd VimEnter * call youcompleteme#Enable()
augroup END
else " manual loading with :packadd
else " Manual loading with :packadd.
call youcompleteme#Enable()
endif
......
# Flake8 3.x dropped support of Python 2.6 and 3.3
flake8 < 3.0.0; python_version == '2.6' or python_version == '3.3'
flake8 >= 3.0.0; python_version == '2.7' or python_version > '3.3'
mock >= 1.0.1
nose >= 1.3.7
PyHamcrest >= 1.8.0
flake8 >= 3.0.0
flake8-comprehensions >= 1.4.1
flake8-ycm >= 0.1.0
mock >= 1.0.1
nose >= 1.3.7
PyHamcrest >= 1.8.0
# This needs to be kept in sync with submodule checkout in
# third_party/ycmd/third_party
future == 0.15.2
codecov >= 2.0.5
future == 0.15.2
# coverage.py 4.4 removed the path from the filename attribute in its reports.
# This leads to incorrect coverage from codecov as it relies on this attribute
# to find the source file.
coverage < 4.4
codecov >= 2.0.5
......@@ -19,14 +19,12 @@ 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()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from future.utils import iteritems
from ycm import vimsupport
from ycmd import user_options_store
from ycmd import request_wrap
from ycmd import identifier_utils
YCM_VAR_PREFIX = 'ycm_'
......@@ -58,19 +56,11 @@ def LoadJsonDefaultsIntoVim():
vimsupport.SetVariableValue( new_key, value )
def CompletionStartColumn():
return ( request_wrap.CompletionStartColumn(
vimsupport.CurrentLineContents(),
vimsupport.CurrentColumn() + 1,
vimsupport.CurrentFiletypes()[ 0 ] ) - 1 )
def CurrentIdentifierFinished():
current_column = vimsupport.CurrentColumn()
line, current_column = vimsupport.CurrentLineContentsAndCodepointColumn()
previous_char_index = current_column - 1
if previous_char_index < 0:
return True
line = vimsupport.CurrentLineContents()
filetype = vimsupport.CurrentFiletypes()[ 0 ]
regex = identifier_utils.IdentifierRegexForFiletype( filetype )
......@@ -83,10 +73,9 @@ def CurrentIdentifierFinished():
def LastEnteredCharIsIdentifierChar():
current_column = vimsupport.CurrentColumn()
line, current_column = vimsupport.CurrentLineContentsAndCodepointColumn()
if current_column - 1 < 0:
return False
line = vimsupport.CurrentLineContents()
filetype = vimsupport.CurrentFiletypes()[ 0 ]
return (
identifier_utils.StartOfLongestIdentifierEndingAtIndex(
......@@ -122,22 +111,16 @@ def AdjustCandidateInsertionText( candidates ):
new_candidates = []
for candidate in candidates: