diff options
author | Patrick McLean <chutzpah@gentoo.org> | 2016-11-08 11:06:22 -0800 |
---|---|---|
committer | Patrick McLean <chutzpah@gentoo.org> | 2016-11-08 11:06:22 -0800 |
commit | 0203c9584c1a1f8295f8525672928287f6f23b93 (patch) | |
tree | d909c0c5da3cde342faf2831e606f7c1d5ac6ed9 /app-vim | |
parent | app-shells/fish: Removed old. (diff) | |
download | gentoo-0203c9584c1a1f8295f8525672928287f6f23b93.tar.gz gentoo-0203c9584c1a1f8295f8525672928287f6f23b93.tar.bz2 gentoo-0203c9584c1a1f8295f8525672928287f6f23b93.zip |
app-vim/editorconfig-vim: Revision bump, pull in some fixes from upstream git
Package-Manager: portage-2.3.2
Diffstat (limited to 'app-vim')
-rw-r--r-- | app-vim/editorconfig-vim/editorconfig-vim-0.3.3-r2.ebuild (renamed from app-vim/editorconfig-vim/editorconfig-vim-0.3.3-r1.ebuild) | 6 | ||||
-rw-r--r-- | app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-fixes.patch | 92 | ||||
-rw-r--r-- | app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-max-line-length-off.patch | 20 | ||||
-rw-r--r-- | app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-python3.patch | 213 |
4 files changed, 331 insertions, 0 deletions
diff --git a/app-vim/editorconfig-vim/editorconfig-vim-0.3.3-r1.ebuild b/app-vim/editorconfig-vim/editorconfig-vim-0.3.3-r2.ebuild index 8fffa6e241f5..f2fd4fe05fe7 100644 --- a/app-vim/editorconfig-vim/editorconfig-vim-0.3.3-r1.ebuild +++ b/app-vim/editorconfig-vim/editorconfig-vim-0.3.3-r2.ebuild @@ -19,6 +19,12 @@ DEPEND="dev-python/editorconfig-core-py[${PYTHON_USEDEP}] app-editors/gvim[python,${PYTHON_USEDEP}] )" +PATCHES=( + "${FILESDIR}/${P}-python3.patch" + "${FILESDIR}/${P}-max-line-length-off.patch" + "${FILESDIR}/${P}-fixes.patch" +) + VIM_PLUGIN_HELPFILES="${PN%-vim}.txt" src_prepare() { diff --git a/app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-fixes.patch b/app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-fixes.patch new file mode 100644 index 000000000000..955560088735 --- /dev/null +++ b/app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-fixes.patch @@ -0,0 +1,92 @@ +diff --git a/doc/editorconfig.txt b/doc/editorconfig.txt +index bd6173b..3b32012 100644 +--- a/doc/editorconfig.txt ++++ b/doc/editorconfig.txt +@@ -79,7 +79,8 @@ empty. There are 3 modes currently: "external_command", "python_builtin", + "python_external". + + python_builtin: Use the vim built-in python to run the python version +- EditorConfig Core. ++ EditorConfig Core. In this mode, Python 2.5 or higher ++ is required. + python_external: Use an external python interpreter to run the python + version EditorConfig Core. + external_command: Run external EditorConfig Core. +diff --git a/plugin/editorconfig.vim b/plugin/editorconfig.vim +index af4f630..9abd008 100644 +--- a/plugin/editorconfig.vim ++++ b/plugin/editorconfig.vim +@@ -121,15 +121,15 @@ function! s:FindPythonFiles() " {{{1 + + let l:python_core_files_dir = fnamemodify( + \ findfile(g:EditorConfig_python_files_dir . '/main.py', +- \ ','.&runtimepath), ':p:h') ++ \ fnameescape(','.&runtimepath)), ':p:h') + + if empty(l:python_core_files_dir) + let l:python_core_files_dir = '' + else + +- " expand python core file path to full path, and remove the appending '/' +- let l:python_core_files_dir = substitute( +- \ fnamemodify(l:python_core_files_dir, ':p'), '/$', '', '') ++ " expand python core file path to full path, and remove the appending '/' ++ let l:python_core_files_dir = substitute( ++ \ fnamemodify(l:python_core_files_dir, ':p'), '/$', '', '') + endif + + let &shellslash = l:old_shellslash +@@ -247,7 +247,7 @@ function! s:InitializePythonBuiltin(editorconfig_core_py_dir) " {{{2 + " The following line modifies l:ret. This is a bit confusing but + " unfortunately to be compatible with Vim 7.3, we cannot use pyeval. This + " should be changed in the future. +- execute s:pyfile_cmd s:pyscript_path ++ execute s:pyfile_cmd fnameescape(s:pyscript_path) + + return l:ret + endfunction +@@ -327,14 +327,19 @@ endif + + function! s:UseConfigFiles() + ++ let l:buffer_name = expand('%:p') + " ignore buffers without a name +- if empty(expand('%:p')) ++ if empty(l:buffer_name) + return + endif + ++ if g:EditorConfig_verbose ++ echo 'Applying EditorConfig on file "' . l:buffer_name . '"' ++ endif ++ + " Ignore specific patterns + for pattern in g:EditorConfig_exclude_patterns +- if expand('%:p') =~ pattern ++ if l:buffer_name =~ pattern + return + endif + endfor +@@ -386,8 +391,8 @@ endfunction + function! s:UseConfigFiles_Python_External() " {{{2 + " Use external python interp to run the python EditorConfig Core + +- let l:cmd = s:editorconfig_python_interp . ' ' . +- \ s:editorconfig_core_py_dir . '/main.py' ++ let l:cmd = shellescape(s:editorconfig_python_interp) . ' ' . ++ \ shellescape(s:editorconfig_core_py_dir . '/main.py') + + call s:SpawnExternalParser(l:cmd) + +@@ -445,6 +450,11 @@ function! s:SpawnExternalParser(cmd) " {{{2 + return + endif + ++ if g:EditorConfig_verbose ++ echo 'Output from EditorConfig core executable:' ++ echo l:parsing_result ++ endif ++ + for one_line in l:parsing_result + let l:eq_pos = stridx(one_line, '=') + diff --git a/app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-max-line-length-off.patch b/app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-max-line-length-off.patch new file mode 100644 index 000000000000..be5d736a385c --- /dev/null +++ b/app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-max-line-length-off.patch @@ -0,0 +1,20 @@ +commit 6e7011712398e53671e5a44edefeb68914562a3a +Author: Hong Xu <hong@topbug.net> +Date: Wed Apr 6 00:34:26 2016 -0700 + + Support max_line_length=off to leave the decision to the editor settings. + +diff --git a/plugin/editorconfig.vim b/plugin/editorconfig.vim +index 9abd008..0e9d647 100644 +--- a/plugin/editorconfig.vim ++++ b/plugin/editorconfig.vim +@@ -563,7 +563,8 @@ function! s:ApplyConfig(config) " {{{1 + endif + + " highlight the columns following max_line_length +- if has_key(a:config, 'max_line_length') ++ if has_key(a:config, 'max_line_length') && ++ \ a:config['max_line_length'] != 'off' + let l:max_line_length = str2nr(a:config['max_line_length']) + + if l:max_line_length >= 0 diff --git a/app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-python3.patch b/app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-python3.patch new file mode 100644 index 000000000000..848582ab02e2 --- /dev/null +++ b/app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-python3.patch @@ -0,0 +1,213 @@ +commit c2b7a104b826b7ff9283d32cb95a039ddccde79b +Author: Shunsuke Shimizu <grafi@grafi.jp> +Date: Sun Jan 10 00:12:10 2016 -0800 + + Make the plugin to be compatible with Python 3. + + Squashed commit of the following: + + commit 0973c5179e504ffbd74a38d6557bb49fe3bf8b5d + Author: Hong Xu <hong@topbug.net> + Date: Sun Jan 10 00:11:11 2016 -0800 + + Some minor corrections + + commit ca17e97e86bd6379bcf3782adfa200c1589cab69 + Author: Shunsuke Shimizu <grafi@grafi.jp> + Date: Sun Jan 10 15:24:13 2016 +0900 + + vim 7.3 support by using `py[3]` command instead of `py[3]eval()` function + + commit c51ae80ce0ca8fe24c014a7c2d54a85d604d3c88 + Author: grafi <grafi@grafi.jp> + Date: Sun Jan 10 14:42:38 2016 +0900 + + use print_function on python2 + + commit 401a9486bba7528aa4d54b06b8ef3ace582829c9 + Author: grafi <grafi@grafi.jp> + Date: Sun Jan 10 14:33:25 2016 +0900 + + assure that sys.path is cleaned + + commit f3bf442429d9579a336a1bb8f98fee82710fbd1e + Author: grafi <grafi@grafi.jp> + Date: Sun Jan 10 14:22:45 2016 +0900 + + python3 style print + + commit 8e059379328b23e4253f76cbd72d3ef484501d42 + Author: Shunsuke Shimizu <grafi@grafi.jp> + Date: Sat Dec 26 07:54:49 2015 +0900 + + Support python3 + +diff --git a/plugin/editorconfig.py b/plugin/editorconfig.py +new file mode 100644 +index 0000000..21ea9c7 +--- /dev/null ++++ b/plugin/editorconfig.py +@@ -0,0 +1,42 @@ ++from __future__ import print_function ++ ++try: ++ try: ++ import vim ++ import sys ++ except: ++ vim.command('let l:ret = 2') ++ raise ++ ++ try: ++ sys.path.insert(0, vim.eval('a:editorconfig_core_py_dir')) ++ ++ import editorconfig ++ import editorconfig.exceptions as editorconfig_except ++ except: ++ vim.command('let l:ret = 3') ++ raise ++ finally: ++ del sys.path[0] ++ ++ # `ec_` prefix is used in order to keep clean Python namespace ++ ec_data = {} ++ ++ def ec_UseConfigFiles(): ++ ec_data['filename'] = vim.eval("expand('%:p')") ++ ec_data['conf_file'] = ".editorconfig" ++ ++ try: ++ ec_data['options'] = editorconfig.get_properties(ec_data['filename']) ++ except editorconfig_except.EditorConfigError as e: ++ if int(vim.eval('g:EditorConfig_verbose')) != 0: ++ print(str(e), file=sys.stderr) ++ vim.command('let l:ret = 1') ++ return ++ ++ for key, value in ec_data['options'].items(): ++ vim.command("let l:config['" + key.replace("'", "''") + "'] = " + ++ "'" + value.replace("'", "''") + "'") ++ ++except: ++ pass +diff --git a/plugin/editorconfig.vim b/plugin/editorconfig.vim +index a21b103..af4f630 100644 +--- a/plugin/editorconfig.vim ++++ b/plugin/editorconfig.vim +@@ -36,6 +36,8 @@ let g:loaded_EditorConfig = 1 + let s:saved_cpo = &cpo + set cpo&vim + ++let s:pyscript_path = expand('<sfile>:p:r') . '.py' ++ + " variables {{{1 + if !exists('g:EditorConfig_exec_path') + let g:EditorConfig_exec_path = '' +@@ -231,48 +233,23 @@ function! s:InitializePythonBuiltin(editorconfig_core_py_dir) " {{{2 + + let s:builtin_python_initialized = 1 + +- let l:ret = 0 +- +- if !has('python') ++ if has('python') ++ let s:pyfile_cmd = 'pyfile' ++ let s:py_cmd = 'py' ++ elseif has('python3') ++ let s:pyfile_cmd = 'py3file' ++ let s:py_cmd = 'py3' ++ else + return 1 + endif + +- python << EEOOFF +- +-try: +- import vim +- import sys +-except: +- vim.command('let l:ret = 2') +- +-EEOOFF +- +- if l:ret != 0 +- return l:ret +- endif +- +- python << EEOOFF +- +-try: +- sys.path.insert(0, vim.eval('a:editorconfig_core_py_dir')) +- +- import editorconfig +- import editorconfig.exceptions as editorconfig_except +- +-except: +- vim.command('let l:ret = 3') +- +-del sys.path[0] +- +-ec_data = {} # used in order to keep clean Python namespace +- +-EEOOFF +- +- if l:ret != 0 +- return l:ret +- endif ++ let l:ret = 0 ++ " The following line modifies l:ret. This is a bit confusing but ++ " unfortunately to be compatible with Vim 7.3, we cannot use pyeval. This ++ " should be changed in the future. ++ execute s:pyfile_cmd s:pyscript_path + +- return 0 ++ return l:ret + endfunction + + " Do some initalization for the case that the user has specified core mode {{{1 +@@ -388,41 +365,22 @@ augroup END + function! s:UseConfigFiles_Python_Builtin() " {{{2 + " Use built-in python to run the python EditorConfig core + +- let l:config = {} +- let l:ret = 0 +- + " ignore buffers that do not have a file path associated + if empty(expand('%:p')) + return 0 + endif + +- python << EEOOFF +- +-ec_data['filename'] = vim.eval("expand('%:p')") +-ec_data['conf_file'] = ".editorconfig" +- +-try: +- ec_data['options'] = editorconfig.get_properties(ec_data['filename']) +-except editorconfig_except.EditorConfigError as e: +- if int(vim.eval('g:EditorConfig_verbose')) != 0: +- print >> sys.stderr, str(e) +- vim.command('let l:ret = 1') ++ let l:config = {} + +-EEOOFF ++ let l:ret = 0 ++ execute s:py_cmd 'ec_UseConfigFiles()' + if l:ret != 0 + return l:ret + endif + +- python << EEOOFF +-for key, value in ec_data['options'].items(): +- vim.command("let l:config['" + key.replace("'", "''") + "'] = " + +- "'" + value.replace("'", "''") + "'") +- +-EEOOFF +- + call s:ApplyConfig(l:config) + +- return 0 ++ return l:ret + endfunction + + function! s:UseConfigFiles_Python_External() " {{{2 |