diff options
Diffstat (limited to 'app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-python3.patch')
-rw-r--r-- | app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-python3.patch | 213 |
1 files changed, 0 insertions, 213 deletions
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 deleted file mode 100644 index 848582ab02e2..000000000000 --- a/app-vim/editorconfig-vim/files/editorconfig-vim-0.3.3-python3.patch +++ /dev/null @@ -1,213 +0,0 @@ -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 |