[arch-commits] Commit in vim/repos (6 files)

Evangelos Foutras foutrelis at archlinux.org
Wed Aug 1 12:35:47 UTC 2018


    Date: Wednesday, August 1, 2018 @ 12:35:46
  Author: foutrelis
Revision: 330249

archrelease: copy trunk to staging-x86_64

Added:
  vim/repos/staging-x86_64/
  vim/repos/staging-x86_64/PKGBUILD
    (from rev 330248, vim/trunk/PKGBUILD)
  vim/repos/staging-x86_64/archlinux.vim
    (from rev 330248, vim/trunk/archlinux.vim)
  vim/repos/staging-x86_64/python37.patch
    (from rev 330248, vim/trunk/python37.patch)
  vim/repos/staging-x86_64/vimdoc.hook
    (from rev 330248, vim/trunk/vimdoc.hook)
  vim/repos/staging-x86_64/vimrc
    (from rev 330248, vim/trunk/vimrc)

----------------+
 PKGBUILD       |  226 ++++++++++++++++++++
 archlinux.vim  |   35 +++
 python37.patch |  613 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 vimdoc.hook    |   11 
 vimrc          |   18 +
 5 files changed, 903 insertions(+)

Copied: vim/repos/staging-x86_64/PKGBUILD (from rev 330248, vim/trunk/PKGBUILD)
===================================================================
--- staging-x86_64/PKGBUILD	                        (rev 0)
+++ staging-x86_64/PKGBUILD	2018-08-01 12:35:46 UTC (rev 330249)
@@ -0,0 +1,226 @@
+# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
+# Contributor: Anatol Pomozov <anatol.pomozov at gmail.com>
+# Contributor: Thomas Dziedzic <gostrc at gmail.com>
+# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
+# Contributor: tobias [ tobias at archlinux org ]
+# Contributor: Daniel J Griffiths <ghost1227 at archlinux.us>
+# Contributor: Christian Hesse <mail at eworm.de>
+# Contributor: Eli Schwartz <eschwartz at archlinux.org>
+
+pkgbase=vim
+pkgname=('vim' 'gvim' 'vim-runtime')
+pkgver=8.1.0194
+_versiondir=81
+pkgrel=2
+pkgdesc='Vi Improved, a highly configurable, improved version of the vi text editor'
+url='https://www.vim.org'
+arch=('x86_64')
+license=('custom:vim')
+makedepends=('glibc' 'libgcrypt' 'gpm' 'python2' 'python' 'ruby' 'libxt' 'gtk3' 'lua'
+             'gawk' 'tcl' 'pcre' 'zlib' 'libffi')
+source=(vim-${pkgver}.tar.gz::https://github.com/vim/vim/archive/v${pkgver}.tar.gz
+        python37.patch
+        vimrc
+        archlinux.vim
+        vimdoc.hook)
+sha256sums=('1a627133ac82fdec8396b90870ff9694a18176bdc30da7ed2e67251e11e82db1'
+            '0f450c13c29d86ae5dbefb24ce46286f173c611ff0d7180e81284121eac5f7ed'
+            'b16e85e457397ab2043a7ee0a3c84307c6b4eac157fd0b721694761f25b3ed5b'
+            '2a6689ce603486f87df9d7e9697032015a8688d663984f5380c1f16cfeed31d4'
+            '7095cafac21df7aa42749d6864d1c0549fe65771d8edda3102c931c60782b6b9')
+sha512sums=('10708f988057cd63b9d253cc8066fb3f67876e2ff147635626fca962d8ba74e9cbb24feb53975affa5b2a91377599398f050ba3ec18b07a44ca087e1eacfdb2a'
+            '513b9b2dd197c77ade2afc28a992790f0382cb77bb5f2be7695c06f0568ae2dce07131d5e6b978cb39eb14e251b94849b84f9ae7b78dc152398fa8647d7d9ac2'
+            '4b5bed0813f22af9e158ea9aa56a4a9862dd786ba2d201f20159ccf652da6190164aaed0b6b7217d578f7b25c33a8adcc307bfcf3caa8d173a7ff29e2a00fee7'
+            '6d0130bb35fc1abb5d657393290d838742725a9d5e4e592b5fd71c8c5852374de010fb58347974096192c8dd8cf42c67185bc2cc38c70609afbcce2c91489781'
+            '1e06e981691b17662fd0fddac5c00c87c920d1b4a1cbb6191c42d57cc40b00af12710e26b22fcfc0901bb8142b15f6a04aa65cec2d9b3bb9d5a06cb650d3ab9c')
+
+prepare() {
+  # combines both https://github.com/vim/vim/pull/3162 and
+  # https://github.com/vim/vim/pull/3163 fixing a merge conflict
+  # The second PR on its own is sufficient to fix python 3.7 tests but causes
+  # breakage when building for python 3.6 instead...
+  patch -p1 -d vim-$pkgver < python37.patch
+  (cd vim-${pkgver}/src
+    # define the place for the global (g)vimrc file (set to /etc/vimrc)
+    sed -i 's|^.*\(#define SYS_.*VIMRC_FILE.*"\) .*$|\1|' feature.h
+    sed -i 's|^.*\(#define VIMRC_FILE.*"\) .*$|\1|' feature.h
+    autoconf
+  )
+  cp -a vim-${pkgver} gvim-${pkgver}
+}
+
+build() {
+  msg2 "Building vim..."
+  (cd vim-${pkgver}
+    ./configure \
+      --prefix=/usr \
+      --localstatedir=/var/lib/vim \
+      --with-features=huge \
+      --with-compiledby='Arch Linux' \
+      --enable-gpm \
+      --enable-acl \
+      --with-x=no \
+      --disable-gui \
+      --enable-multibyte \
+      --enable-cscope \
+      --enable-netbeans \
+      --enable-perlinterp=dynamic \
+      --enable-pythoninterp=dynamic \
+      --enable-python3interp=dynamic \
+      --enable-rubyinterp=dynamic \
+      --enable-luainterp=dynamic \
+      --enable-tclinterp=dynamic
+    make
+  )
+
+  msg2 "Building gvim..."
+  (cd gvim-${pkgver}
+    ./configure \
+      --prefix=/usr \
+      --localstatedir=/var/lib/vim \
+      --with-features=huge \
+      --with-compiledby='Arch Linux' \
+      --enable-gpm \
+      --enable-acl \
+      --with-x=yes \
+      --enable-gui=gtk3 \
+      --enable-multibyte \
+      --enable-cscope \
+      --enable-netbeans \
+      --enable-perlinterp=dynamic \
+      --enable-pythoninterp=dynamic \
+      --enable-python3interp=dynamic \
+      --enable-rubyinterp=dynamic \
+      --enable-luainterp=dynamic \
+      --enable-tclinterp=dynamic
+    make
+  )
+}
+
+check() {
+  cd vim-${pkgver}
+  TERM=xterm make -j1 test
+}
+
+package_vim-runtime() {
+  pkgdesc+=' (shared runtime)'
+  optdepends=('sh: support for some tools and macros'
+              'python: demoserver example tool'
+              'gawk: mve tools upport')
+  backup=('etc/vimrc')
+
+  cd vim-${pkgver}
+
+  make -j1 VIMRCLOC=/etc DESTDIR="${pkgdir}" install
+  # man and bin files belong to 'vim'
+  rm -r "${pkgdir}"/usr/share/man/ "${pkgdir}"/usr/bin/
+
+  # Don't forget logtalk.dict
+  install -Dm 644 runtime/ftplugin/logtalk.dict \
+    "${pkgdir}"/usr/share/vim/vim${_versiondir}/ftplugin/logtalk.dict
+
+  # fix FS#17216
+  sed -i 's|messages,/var|messages,/var/log/messages.log,/var|' \
+    "${pkgdir}"/usr/share/vim/vim${_versiondir}/filetype.vim
+
+  # patch filetype.vim for better handling of pacman related files
+  sed -i "s/rpmsave/pacsave/;s/rpmnew/pacnew/;s/,\*\.ebuild/\0,PKGBUILD*,*.install/" \
+    "${pkgdir}"/usr/share/vim/vim${_versiondir}/filetype.vim
+  sed -i "/find the end/,+3{s/changelog_date_entry_search/changelog_date_end_entry_search/}" \
+    "${pkgdir}"/usr/share/vim/vim${_versiondir}/ftplugin/changelog.vim
+
+  # rc files
+  install -Dm 644 "${srcdir}"/vimrc "${pkgdir}"/etc/vimrc
+  install -Dm 644 "${srcdir}"/archlinux.vim \
+    "${pkgdir}"/usr/share/vim/vimfiles/archlinux.vim
+
+  # rgb.txt file
+  install -Dm 644 runtime/rgb.txt \
+    "${pkgdir}"/usr/share/vim/vim${_versiondir}/rgb.txt
+
+  # no desktop files and icons
+  rm -r "${pkgdir}"/usr/share/{applications,icons}
+
+  # license
+  install -dm 755 "${pkgdir}"/usr/share/licenses/vim-runtime
+  ln -s /usr/share/vim/vim${_versiondir}/doc/uganda.txt \
+    "${pkgdir}"/usr/share/licenses/vim-runtime/license.txt
+
+  # pacman hook for documentation helptags
+  install -Dm 644 "${srcdir}"/vimdoc.hook "${pkgdir}"/usr/share/libalpm/hooks/vimdoc.hook
+}
+
+package_vim() {
+  depends=("vim-runtime=${pkgver}-${pkgrel}" 'gpm' 'acl' 'glibc' 'libgcrypt' 'pcre'
+           'zlib' 'libffi')
+  optdepends=('python2: Python 2 language support'
+              'python: Python 3 language support'
+              'ruby: Ruby language support'
+              'lua: Lua language support'
+              'perl: Perl language support'
+              'tcl: Tcl language support')
+  conflicts=('gvim' 'vim-minimal' 'vim-python3')
+  provides=('xxd' 'vim-minimal' 'vim-python3')
+  replaces=('vim-python3' 'vim-minimal')
+
+  cd vim-${pkgver}
+  make -j1 VIMRCLOC=/etc DESTDIR="${pkgdir}" install
+
+  # provided by (n)vi in core
+  rm "${pkgdir}"/usr/bin/{ex,view}
+
+  # delete some manpages
+  find "${pkgdir}"/usr/share/man -type d -name 'man1' 2>/dev/null | \
+    while read _mandir; do
+    cd "${_mandir}"
+    rm -f ex.1 view.1 # provided by (n)vi
+    rm -f evim.1    # this does not make sense if we have no GUI
+  done
+
+  # Runtime provided by runtime package
+  rm -r "${pkgdir}"/usr/share/vim
+
+  # remove gvim.desktop as not included
+  rm "${pkgdir}"/usr/share/applications/gvim.desktop
+
+  # license
+  install -Dm 644 runtime/doc/uganda.txt \
+    "${pkgdir}"/usr/share/licenses/${pkgname}/license.txt
+}
+
+package_gvim() {
+  pkgdesc+=' (with advanced features, such as a GUI)'
+  depends=("vim-runtime=${pkgver}-${pkgrel}" 'gpm' 'libxt' 'gtk3' 'glibc' 'libgcrypt' 'pcre'
+           'zlib' 'libffi')
+  optdepends=('python2: Python 2 language support'
+              'python: Python 3 language support'
+              'ruby: Ruby language support'
+              'lua: Lua language support'
+              'perl: Perl language support'
+              'tcl: Tcl language support')
+  provides=("vim=${pkgver}-${pkgrel}" "xxd")
+  conflicts=('vim-minimal' 'vim')
+  replaces=('gvim-python3')
+
+  cd gvim-${pkgver}
+  make -j1 VIMRCLOC=/etc DESTDIR="${pkgdir}" install
+
+  # provided by (n)vi in core
+  rm "${pkgdir}"/usr/bin/{ex,view}
+
+  # delete some manpages
+  find "${pkgdir}"/usr/share/man -type d -name 'man1' 2>/dev/null | \
+    while read _mandir; do
+    cd "${_mandir}"
+    rm -f ex.1 view.1 # provided by (n)vi
+  done
+
+  # need to remove since this is provided by vim-runtime
+  rm -r "${pkgdir}"/usr/share/vim
+
+  # license
+   install -Dm 644 runtime/doc/uganda.txt \
+    "${pkgdir}"/usr/share/licenses/${pkgname}/license.txt
+}
+
+# vim: ts=2 sw=2 et:

Copied: vim/repos/staging-x86_64/archlinux.vim (from rev 330248, vim/trunk/archlinux.vim)
===================================================================
--- staging-x86_64/archlinux.vim	                        (rev 0)
+++ staging-x86_64/archlinux.vim	2018-08-01 12:35:46 UTC (rev 330249)
@@ -0,0 +1,35 @@
+" The ArchLinux global vimrc - setting only a few sane defaults
+"
+" NEVER EDIT THIS FILE, IT'S OVERWRITTEN UPON UPGRADES, GLOBAL CONFIGURATION
+" SHALL BE DONE IN /etc/vimrc, USER SPECIFIC CONFIGURATION IN ~/.vimrc
+
+" Normally we use vim-extensions. If you want true vi-compatibility
+" remove change the following statements
+set nocompatible                " Use Vim defaults instead of 100% vi compatibility
+set backspace=indent,eol,start  " more powerful backspacing
+
+" Now we set some defaults for the editor
+set history=50                  " keep 50 lines of command line history
+set ruler                       " show the cursor position all the time
+
+" Suffixes that get lower priority when doing tab completion for filenames.
+" These are files we are not likely to want to edit or read.
+set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc,.png,.jpg
+
+" Move the swap file location to protect against CVE-2017-1000382
+if exists('$XDG_CACHE_HOME')
+	let &g:directory=$XDG_CACHE_HOME
+else
+	let &g:directory=$HOME . '/.cache'
+endif
+let &g:directory.='/vim/swap//'
+" Create swap directory if it doesn't exist
+if ! isdirectory(expand(&g:directory))
+  silent! call mkdir(expand(&g:directory), 'p', 0700)
+endif
+
+if has('gui_running')
+  " Make shift-insert work like in Xterm
+  map <S-Insert> <MiddleMouse>
+  map! <S-Insert> <MiddleMouse>
+endif

Copied: vim/repos/staging-x86_64/python37.patch (from rev 330248, vim/trunk/python37.patch)
===================================================================
--- staging-x86_64/python37.patch	                        (rev 0)
+++ staging-x86_64/python37.patch	2018-08-01 12:35:46 UTC (rev 330249)
@@ -0,0 +1,613 @@
+From b4303babecee4047e67bd43960c751c35f261553 Mon Sep 17 00:00:00 2001
+From: ichizok <gclient.gaap at gmail.com>
+Date: Fri, 6 Jul 2018 15:22:16 +0900
+Subject: [PATCH 1/6] Fix importing-error handling
+
+---
+ src/if_py_both.h | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/src/if_py_both.h b/src/if_py_both.h
+index 417f86cbb..46383c423 100644
+--- a/src/if_py_both.h
++++ b/src/if_py_both.h
+@@ -1215,7 +1215,11 @@ find_module(char *fullname, char *tail, PyObject *new_path)
+ 
+ 	if (!(find_module_result = PyObject_CallFunction(py_find_module,
+ 			"s#O", tail, partlen, new_path)))
++	{
++	    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_ImportError))
++		PyErr_Clear();
+ 	    return NULL;
++	}
+ 
+ 	if (!(module = call_load_module(
+ 			fullname,
+@@ -1246,7 +1250,11 @@ find_module(char *fullname, char *tail, PyObject *new_path)
+     {
+ 	if (!(find_module_result = PyObject_CallFunction(py_find_module,
+ 			"sO", tail, new_path)))
++	{
++	    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_ImportError))
++		PyErr_Clear();
+ 	    return NULL;
++	}
+ 
+ 	if (!(module = call_load_module(
+ 			fullname,
+@@ -1284,12 +1292,7 @@ FinderFindModule(PyObject *self, PyObject *args)
+     if (!module)
+     {
+ 	if (PyErr_Occurred())
+-	{
+-	    if (PyErr_ExceptionMatches(PyExc_ImportError))
+-		PyErr_Clear();
+-	    else
+-		return NULL;
+-	}
++	    return NULL;
+ 
+ 	Py_INCREF(Py_None);
+ 	return Py_None;
+-- 
+2.18.0
+
+
+From 143363e949cec4c90ec43f2d33867afd569b64fa Mon Sep 17 00:00:00 2001
+From: ichizok <gclient.gaap at gmail.com>
+Date: Fri, 6 Jul 2018 15:44:34 +0900
+Subject: [PATCH 2/6] Fix test86,test87
+
+---
+ src/testdir/test86.ok | 2 +-
+ src/testdir/test87.ok | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok
+index f8d4ceb57..24d3fd4bd 100644
+--- a/src/testdir/test86.ok
++++ b/src/testdir/test86.ok
+@@ -701,7 +701,7 @@ vim.foreach_rtp(FailingCall()):NotImplementedError:('call',)
+ vim.foreach_rtp(int, 2):TypeError:('foreach_rtp() takes exactly one argument (2 given)',)
+ > import
+ import xxx_no_such_module_xxx:ImportError:('No module named xxx_no_such_module_xxx',)
+-import failing_import:ImportError:('No module named failing_import',)
++import failing_import:ImportError:()
+ import failing:NotImplementedError:()
+ > Options
+ >> OptionsItem
+diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok
+index 9ca4b624c..a7d4f6426 100644
+--- a/src/testdir/test87.ok
++++ b/src/testdir/test87.ok
+@@ -701,7 +701,7 @@ vim.foreach_rtp(FailingCall()):(<class 'NotImplementedError'>, NotImplementedErr
+ vim.foreach_rtp(int, 2):(<class 'TypeError'>, TypeError('foreach_rtp() takes exactly one argument (2 given)',))
+ > import
+ import xxx_no_such_module_xxx:(<class 'ImportError'>, ImportError('No module named xxx_no_such_module_xxx',))
+-import failing_import:(<class 'ImportError'>, ImportError('No module named failing_import',))
++import failing_import:(<class 'ImportError'>, ImportError())
+ import failing:(<class 'NotImplementedError'>, NotImplementedError())
+ > Options
+ >> OptionsItem
+-- 
+2.18.0
+
+
+From 95a0f7e94e1f9e0bd1513e165eba4f2ea0631e6b Mon Sep 17 00:00:00 2001
+From: ichizok <gclient.gaap at gmail.com>
+Date: Fri, 6 Jul 2018 23:20:43 +0900
+Subject: [PATCH 3/6] Change 'LoaderObject' constructure
+
+do 'load_module' in 'LoaderLoadModule'
+---
+ src/if_py_both.h | 42 ++++++++++++++++++------------------------
+ 1 file changed, 18 insertions(+), 24 deletions(-)
+
+diff --git a/src/if_py_both.h b/src/if_py_both.h
+index 46383c423..6020c788d 100644
+--- a/src/if_py_both.h
++++ b/src/if_py_both.h
+@@ -539,27 +539,31 @@ PythonIO_Init_io(void)
+     return 0;
+ }
+ 
++static PyObject *call_load_module(char *name, int len, PyObject *find_module_result);
++
+ typedef struct
+ {
+     PyObject_HEAD
+-    PyObject	*module;
++    char	*fullname;
++    PyObject	*target;
+ } LoaderObject;
+ static PyTypeObject LoaderType;
+ 
+     static void
+ LoaderDestructor(LoaderObject *self)
+ {
+-    Py_DECREF(self->module);
++    vim_free(self->fullname);
++    Py_DECREF(self->target);
+     DESTRUCTOR_FINISH(self);
+ }
+ 
+     static PyObject *
+ LoaderLoadModule(LoaderObject *self, PyObject *args UNUSED)
+ {
+-    PyObject	*ret = self->module;
++    char	*fullname = self->fullname;
++    PyObject	*target = self->target;
+ 
+-    Py_INCREF(ret);
+-    return ret;
++    return call_load_module(fullname, (int)STRLEN(fullname), target);
+ }
+ 
+ static struct PyMethodDef LoaderMethods[] = {
+@@ -1240,11 +1244,11 @@ find_module(char *fullname, char *tail, PyObject *new_path)
+ 
+ 	Py_DECREF(module);
+ 
+-	module = find_module(fullname, dot + 1, newest_path);
++	find_module_result = find_module(fullname, dot + 1, newest_path);
+ 
+ 	Py_DECREF(newest_path);
+ 
+-	return module;
++	return find_module_result;
+     }
+     else
+     {
+@@ -1256,18 +1260,7 @@ find_module(char *fullname, char *tail, PyObject *new_path)
+ 	    return NULL;
+ 	}
+ 
+-	if (!(module = call_load_module(
+-			fullname,
+-			(int)STRLEN(fullname),
+-			find_module_result)))
+-	{
+-	    Py_DECREF(find_module_result);
+-	    return NULL;
+-	}
+-
+-	Py_DECREF(find_module_result);
+-
+-	return module;
++	return find_module_result;
+     }
+ }
+ 
+@@ -1275,7 +1268,7 @@ find_module(char *fullname, char *tail, PyObject *new_path)
+ FinderFindModule(PyObject *self, PyObject *args)
+ {
+     char	*fullname;
+-    PyObject	*module;
++    PyObject	*target;
+     PyObject	*new_path;
+     LoaderObject	*loader;
+ 
+@@ -1285,11 +1278,11 @@ FinderFindModule(PyObject *self, PyObject *args)
+     if (!(new_path = Vim_GetPaths(self)))
+ 	return NULL;
+ 
+-    module = find_module(fullname, fullname, new_path);
++    target = find_module(fullname, fullname, new_path);
+ 
+     Py_DECREF(new_path);
+ 
+-    if (!module)
++    if (!target)
+     {
+ 	if (PyErr_Occurred())
+ 	    return NULL;
+@@ -1300,11 +1293,12 @@ FinderFindModule(PyObject *self, PyObject *args)
+ 
+     if (!(loader = PyObject_NEW(LoaderObject, &LoaderType)))
+     {
+-	Py_DECREF(module);
++	Py_DECREF(target);
+ 	return NULL;
+     }
+ 
+-    loader->module = module;
++    loader->fullname = (char *)vim_strsave((char_u *)fullname);
++    loader->target = target;
+ 
+     return (PyObject *) loader;
+ }
+-- 
+2.18.0
+
+
+From 92a204120b9f508aae966d03c447ad615e3128b5 Mon Sep 17 00:00:00 2001
+From: ichizok <gclient.gaap at gmail.com>
+Date: Sat, 7 Jul 2018 01:47:42 +0900
+Subject: [PATCH 4/6] Fix resource leak
+
+---
+ src/if_py_both.h | 54 +++++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 44 insertions(+), 10 deletions(-)
+
+diff --git a/src/if_py_both.h b/src/if_py_both.h
+index 6020c788d..98134cce2 100644
+--- a/src/if_py_both.h
++++ b/src/if_py_both.h
+@@ -545,7 +545,7 @@ typedef struct
+ {
+     PyObject_HEAD
+     char	*fullname;
+-    PyObject	*target;
++    PyObject	*result;
+ } LoaderObject;
+ static PyTypeObject LoaderType;
+ 
+@@ -553,7 +553,7 @@ static PyTypeObject LoaderType;
+ LoaderDestructor(LoaderObject *self)
+ {
+     vim_free(self->fullname);
+-    Py_DECREF(self->target);
++    Py_XDECREF(self->result);
+     DESTRUCTOR_FINISH(self);
+ }
+ 
+@@ -561,9 +561,35 @@ LoaderDestructor(LoaderObject *self)
+ LoaderLoadModule(LoaderObject *self, PyObject *args UNUSED)
+ {
+     char	*fullname = self->fullname;
+-    PyObject	*target = self->target;
++    PyObject	*result = self->result;
++    PyObject	*module;
++
++    if (!fullname)
++    {
++	module = result ? result : Py_None;
++	Py_INCREF(module);
++	return module;
++    }
++
++    module = call_load_module(fullname, (int)STRLEN(fullname), result);
++
++    self->fullname = NULL;
++    self->result = module;
++
++    vim_free(fullname);
++    Py_DECREF(result);
++
++    if (!module)
++    {
++	if (PyErr_Occurred())
++	    return NULL;
++
++	Py_INCREF(Py_None);
++	return Py_None;
++    }
+ 
+-    return call_load_module(fullname, (int)STRLEN(fullname), target);
++    Py_INCREF(module);
++    return module;
+ }
+ 
+ static struct PyMethodDef LoaderMethods[] = {
+@@ -1268,7 +1294,7 @@ find_module(char *fullname, char *tail, PyObject *new_path)
+ FinderFindModule(PyObject *self, PyObject *args)
+ {
+     char	*fullname;
+-    PyObject	*target;
++    PyObject	*result;
+     PyObject	*new_path;
+     LoaderObject	*loader;
+ 
+@@ -1278,11 +1304,11 @@ FinderFindModule(PyObject *self, PyObject *args)
+     if (!(new_path = Vim_GetPaths(self)))
+ 	return NULL;
+ 
+-    target = find_module(fullname, fullname, new_path);
++    result = find_module(fullname, fullname, new_path);
+ 
+     Py_DECREF(new_path);
+ 
+-    if (!target)
++    if (!result)
+     {
+ 	if (PyErr_Occurred())
+ 	    return NULL;
+@@ -1291,14 +1317,22 @@ FinderFindModule(PyObject *self, PyObject *args)
+ 	return Py_None;
+     }
+ 
++    if (!(fullname = (char *)vim_strsave((char_u *)fullname)))
++    {
++	Py_DECREF(result);
++	PyErr_NoMemory();
++	return NULL;
++    }
++
+     if (!(loader = PyObject_NEW(LoaderObject, &LoaderType)))
+     {
+-	Py_DECREF(target);
++	vim_free(fullname);
++	Py_DECREF(result);
+ 	return NULL;
+     }
+ 
+-    loader->fullname = (char *)vim_strsave((char_u *)fullname);
+-    loader->target = target;
++    loader->fullname = fullname;
++    loader->result = result;
+ 
+     return (PyObject *) loader;
+ }
+-- 
+2.18.0
+
+
+From 2025230f432e4ff07f2dd58b2e56afb58c2a7f7f Mon Sep 17 00:00:00 2001
+From: ichizok <gclient.gaap at gmail.com>
+Date: Fri, 6 Jul 2018 02:35:32 +0900
+Subject: [PATCH 5/6] Replace imp module by importlib for Python 3.7
+
+---
+ src/if_py_both.h | 76 +++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 75 insertions(+), 1 deletion(-)
+
+diff --git a/src/if_py_both.h b/src/if_py_both.h
+index 98134cce2..8478a3c2b 100644
+--- a/src/if_py_both.h
++++ b/src/if_py_both.h
+@@ -88,8 +88,12 @@ static PyObject *py_getcwd;
+ static PyObject *vim_module;
+ static PyObject *vim_special_path_object;
+ 
++#if PY_VERSION_HEX >= 0x030700f0
++static PyObject *py_find_spec;
++#else
+ static PyObject *py_find_module;
+ static PyObject *py_load_module;
++#endif
+ 
+ static PyObject *VimError;
+ 
+@@ -539,8 +543,8 @@ PythonIO_Init_io(void)
+     return 0;
+ }
+ 
++#if PY_VERSION_HEX < 0x030700f0
+ static PyObject *call_load_module(char *name, int len, PyObject *find_module_result);
+-
+ typedef struct
+ {
+     PyObject_HEAD
+@@ -597,6 +601,7 @@ static struct PyMethodDef LoaderMethods[] = {
+     {"load_module", (PyCFunction)LoaderLoadModule,	METH_VARARGS,	""},
+     { NULL,	    NULL,				0,		NULL}
+ };
++#endif
+ 
+ /* Check to see whether a Vim error has been reported, or a keyboard
+  * interrupt has been detected.
+@@ -1193,6 +1198,37 @@ Vim_GetPaths(PyObject *self UNUSED)
+     return ret;
+ }
+ 
++#if PY_VERSION_HEX >= 0x030700f0
++    static PyObject *
++FinderFindSpec(PyObject *self, PyObject *args)
++{
++    char	*fullname;
++    PyObject	*paths;
++    PyObject	*target = Py_None;
++    PyObject	*spec;
++
++    if (!PyArg_ParseTuple(args, "s|O", &fullname, &target))
++	return NULL;
++
++    if (!(paths = Vim_GetPaths(self)))
++	return NULL;
++
++    spec = PyObject_CallFunction(py_find_spec, "sNN", fullname, paths, target);
++
++    Py_DECREF(paths);
++
++    if (!spec)
++    {
++	if (PyErr_Occurred())
++	    return NULL;
++
++	Py_INCREF(Py_None);
++	return Py_None;
++    }
++
++    return spec;
++}
++#else
+     static PyObject *
+ call_load_module(char *name, int len, PyObject *find_module_result)
+ {
+@@ -1336,6 +1372,7 @@ FinderFindModule(PyObject *self, PyObject *args)
+ 
+     return (PyObject *) loader;
+ }
++#endif
+ 
+     static PyObject *
+ VimPathHook(PyObject *self UNUSED, PyObject *args)
+@@ -1367,7 +1404,11 @@ static struct PyMethodDef VimMethods[] = {
+     {"chdir",	    (PyCFunction)VimChdir,	METH_VARARGS|METH_KEYWORDS,	"Change directory"},
+     {"fchdir",	    (PyCFunction)VimFchdir,	METH_VARARGS|METH_KEYWORDS,	"Change directory"},
+     {"foreach_rtp", VimForeachRTP,		METH_O,				"Call given callable for each path in &rtp"},
++#if PY_VERSION_HEX >= 0x030700f0
++    {"find_spec",   FinderFindSpec,		METH_VARARGS,			"Internal use only, returns spec object for any input it receives"},
++#else
+     {"find_module", FinderFindModule,		METH_VARARGS,			"Internal use only, returns loader object for any input it receives"},
++#endif
+     {"path_hook",   VimPathHook,		METH_VARARGS,			"Hook function to install in sys.path_hooks"},
+     {"_get_paths",  (PyCFunction)Vim_GetPaths,	METH_NOARGS,			"Get &rtp-based additions to sys.path"},
+     { NULL,	    NULL,			0,				NULL}
+@@ -6576,6 +6617,7 @@ init_structs(void)
+     OptionsType.tp_traverse = (traverseproc)OptionsTraverse;
+     OptionsType.tp_clear = (inquiry)OptionsClear;
+ 
++#if PY_VERSION_HEX < 0x030700f0
+     vim_memset(&LoaderType, 0, sizeof(LoaderType));
+     LoaderType.tp_name = "vim.Loader";
+     LoaderType.tp_basicsize = sizeof(LoaderObject);
+@@ -6583,6 +6625,7 @@ init_structs(void)
+     LoaderType.tp_doc = "vim message object";
+     LoaderType.tp_methods = LoaderMethods;
+     LoaderType.tp_dealloc = (destructor)LoaderDestructor;
++#endif
+ 
+ #if PY_MAJOR_VERSION >= 3
+     vim_memset(&vimmodule, 0, sizeof(vimmodule));
+@@ -6614,7 +6657,9 @@ init_types(void)
+     PYTYPE_READY(FunctionType);
+     PYTYPE_READY(OptionsType);
+     PYTYPE_READY(OutputType);
++#if PY_VERSION_HEX < 0x030700f0
+     PYTYPE_READY(LoaderType);
++#endif
+     return 0;
+ }
+ 
+@@ -6738,7 +6783,9 @@ static struct object_constant {
+     {"List",       (PyObject *)&ListType},
+     {"Function",   (PyObject *)&FunctionType},
+     {"Options",    (PyObject *)&OptionsType},
++#if PY_VERSION_HEX < 0x030700f0
+     {"_Loader",    (PyObject *)&LoaderType},
++#endif
+ };
+ 
+ #define ADD_OBJECT(m, name, obj) \
+@@ -6760,6 +6807,10 @@ populate_module(PyObject *m)
+     PyObject	*other_module;
+     PyObject	*attr;
+     PyObject	*imp;
++#if PY_VERSION_HEX >= 0x030700f0
++    PyObject	*dict;
++    PyObject	*cls;
++#endif
+ 
+     for (i = 0; i < (int)(sizeof(numeric_constants)
+ 					   / sizeof(struct numeric_constant));
+@@ -6832,6 +6883,28 @@ populate_module(PyObject *m)
+ 
+     ADD_OBJECT(m, "VIM_SPECIAL_PATH", vim_special_path_object);
+ 
++#if PY_VERSION_HEX >= 0x030700f0
++    if (!(imp = PyImport_ImportModule("importlib.machinery")))
++	return -1;
++
++    dict = PyModule_GetDict(imp);
++
++    if (!(cls = PyDict_GetItemString(dict, "PathFinder")))
++    {
++	Py_DECREF(imp);
++	return -1;
++    }
++
++    if (!(py_find_spec = PyObject_GetAttrString(cls, "find_spec")))
++    {
++	Py_DECREF(imp);
++	return -1;
++    }
++
++    Py_DECREF(imp);
++
++    ADD_OBJECT(m, "_find_spec", py_find_spec);
++#else
+     if (!(imp = PyImport_ImportModule("imp")))
+ 	return -1;
+ 
+@@ -6852,6 +6925,7 @@ populate_module(PyObject *m)
+ 
+     ADD_OBJECT(m, "_find_module", py_find_module);
+     ADD_OBJECT(m, "_load_module", py_load_module);
++#endif
+ 
+     return 0;
+ }
+-- 
+2.18.0
+
+
+From af6a110ab17849a41cebfe041b31d55844ef844b Mon Sep 17 00:00:00 2001
+From: ichizok <gclient.gaap at gmail.com>
+Date: Fri, 6 Jul 2018 16:01:43 +0900
+Subject: [PATCH 6/6] Fix test87
+
+https://docs.python.org/3/whatsnew/3.7.html#changes-in-the-python-api
+
+> repr for BaseException has changed to not include the trailing comma.
+---
+ src/testdir/test87.in | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/src/testdir/test87.in b/src/testdir/test87.in
+index ac0410901..31de37b99 100644
+--- a/src/testdir/test87.in
++++ b/src/testdir/test87.in
+@@ -219,6 +219,7 @@ import sys
+ import re
+ 
+ py33_type_error_pattern = re.compile('^__call__\(\) takes (\d+) positional argument but (\d+) were given$')
++py37_exception_repr = re.compile(r'([^\(\),])(\)+)$')
+ 
+ def ee(expr, g=globals(), l=locals()):
+     cb = vim.current.buffer
+@@ -227,17 +228,17 @@ def ee(expr, g=globals(), l=locals()):
+             exec(expr, g, l)
+         except Exception as e:
+             if sys.version_info >= (3, 3) and e.__class__ is AttributeError and str(e).find('has no attribute')>=0 and not str(e).startswith("'vim."):
+-                cb.append(expr + ':' + repr((e.__class__, AttributeError(str(e)[str(e).rfind(" '") + 2:-1]))))
++                msg = repr((e.__class__, AttributeError(str(e)[str(e).rfind(" '") + 2:-1])))
+             elif sys.version_info >= (3, 3) and e.__class__ is ImportError and str(e).find('No module named \'') >= 0:
+-                cb.append(expr + ':' + repr((e.__class__, ImportError(str(e).replace("'", '')))))
++                msg = repr((e.__class__, ImportError(str(e).replace("'", ''))))
+             elif sys.version_info >= (3, 6) and e.__class__ is ModuleNotFoundError:
+                 # Python 3.6 gives ModuleNotFoundError, change it to an ImportError
+-                cb.append(expr + ':' + repr((ImportError, ImportError(str(e).replace("'", '')))))
++                msg = repr((ImportError, ImportError(str(e).replace("'", ''))))
+             elif sys.version_info >= (3, 3) and e.__class__ is TypeError:
+                 m = py33_type_error_pattern.search(str(e))
+                 if m:
+                     msg = '__call__() takes exactly {0} positional argument ({1} given)'.format(m.group(1), m.group(2))
+-                    cb.append(expr + ':' + repr((e.__class__, TypeError(msg))))
++                    msg = repr((e.__class__, TypeError(msg)))
+                 else:
+                     msg = repr((e.__class__, e))
+                     # Messages changed with Python 3.6, change new to old.
+@@ -249,9 +250,8 @@ def ee(expr, g=globals(), l=locals()):
+                     oldmsg2 = '''"Can't convert 'int' object to str implicitly"'''
+                     if msg.find(newmsg2) > -1:
+                         msg = msg.replace(newmsg2, oldmsg2)
+-                    cb.append(expr + ':' + msg)
+             elif sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte':
+-                cb.append(expr + ':' + repr((TypeError, TypeError('expected bytes with no null'))))
++                msg = repr((TypeError, TypeError('expected bytes with no null')))
+             else:
+                 msg = repr((e.__class__, e))
+                 # Some Python versions say can't, others cannot.
+@@ -262,11 +262,16 @@ def ee(expr, g=globals(), l=locals()):
+                     msg = msg.replace('"cannot ', '\'cannot ')
+                 if msg.find(' attributes"') > -1:
+                     msg = msg.replace(' attributes"', ' attributes\'')
+-                cb.append(expr + ':' + msg)
++            if sys.version_info >= (3, 7):
++                msg = py37_exception_repr.sub(r'\1,\2', msg)
++            cb.append(expr + ':' + msg)
+         else:
+             cb.append(expr + ':NOT FAILED')
+     except Exception as e:
+-        cb.append(expr + '::' + repr((e.__class__, e)))
++        msg = repr((e.__class__, e))
++        if sys.version_info >= (3, 7):
++            msg = py37_exception_repr.sub(r'\1,\2', msg)
++        cb.append(expr + '::' + msg)
+ EOF
+ :fun New(...)
+ :   return ['NewStart']+a:000+['NewEnd']
+-- 
+2.18.0
+

Copied: vim/repos/staging-x86_64/vimdoc.hook (from rev 330248, vim/trunk/vimdoc.hook)
===================================================================
--- staging-x86_64/vimdoc.hook	                        (rev 0)
+++ staging-x86_64/vimdoc.hook	2018-08-01 12:35:46 UTC (rev 330249)
@@ -0,0 +1,11 @@
+[Trigger]
+Operation = Install
+Operation = Upgrade
+Operation= Remove
+Type = File
+Target = usr/share/vim/vimfiles/doc/
+
+[Action]
+Description = Updating Vim help tags...
+Exec = /usr/bin/vim -es --cmd ":helptags /usr/share/vim/vimfiles/doc" --cmd ":q"
+When = PostTransaction

Copied: vim/repos/staging-x86_64/vimrc (from rev 330248, vim/trunk/vimrc)
===================================================================
--- staging-x86_64/vimrc	                        (rev 0)
+++ staging-x86_64/vimrc	2018-08-01 12:35:46 UTC (rev 330249)
@@ -0,0 +1,18 @@
+" All system-wide defaults are set in $VIMRUNTIME/archlinux.vim (usually just
+" /usr/share/vim/vimfiles/archlinux.vim) and sourced by the call to :runtime
+" you can find below.  If you wish to change any of those settings, you should
+" do it in this file (/etc/vimrc), since archlinux.vim will be overwritten
+" everytime an upgrade of the vim packages is performed.  It is recommended to
+" make changes after sourcing archlinux.vim since it alters the value of the
+" 'compatible' option.
+
+" This line should not be removed as it ensures that various options are
+" properly set to work with the Vim-related packages.
+runtime! archlinux.vim
+
+" If you prefer the old-style vim functionalty, add 'runtime! vimrc_example.vim'
+" Or better yet, read /usr/share/vim/vim80/vimrc_example.vim or the vim manual
+" and configure vim to your own liking!
+
+" do not load defaults if ~/.vimrc is missing
+"let skip_defaults_vim=1



More information about the arch-commits mailing list