Date: Wednesday, December 28, 2016 @ 18:57:05 Author: ambrevar Revision: 203206
upgpkg: trash-cli 0.16.12.26-1 Modified: trash-cli/trunk/PKGBUILD Deleted: trash-cli/trunk/53.patch ----------+ 53.patch | 164 ------------------------------------------------------------- PKGBUILD | 22 ++------ 2 files changed, 6 insertions(+), 180 deletions(-) Deleted: 53.patch =================================================================== --- 53.patch 2016-12-28 18:50:15 UTC (rev 203205) +++ 53.patch 2016-12-28 18:57:05 UTC (rev 203206) @@ -1,164 +0,0 @@ -From c39f4e92433fb27b42b36c2747cff63b98b11ccb Mon Sep 17 00:00:00 2001 -From: Antony Lee <anntzer....@gmail.com> -Date: Tue, 16 Jun 2015 19:45:51 -0700 -Subject: [PATCH 1/2] Rely on Python to open/close files. - -Fixes #52. ---- - trashcli/list_mount_points.py | 31 ++++++++++++++----------------- - 1 file changed, 14 insertions(+), 17 deletions(-) - -diff --git a/trashcli/list_mount_points.py b/trashcli/list_mount_points.py -index 7f481f3..a26aef5 100644 ---- a/trashcli/list_mount_points.py -+++ b/trashcli/list_mount_points.py -@@ -27,8 +27,8 @@ def chomp(string): - yield line.split(None, 5)[-1] - - def _mounted_filesystems_from_getmnt() : -- from ctypes import Structure, c_char_p, c_int, c_void_p, cdll, POINTER -- from ctypes.util import find_library -+ from ctypes import ( -+ c_char_p, c_int, c_void_p, cdll, POINTER, pythonapi, Structure, util) - import sys - class Filesystem: - def __init__(self, mount_dir, type, name) : -@@ -49,26 +49,23 @@ class mntent_struct(Structure): - if sys.platform == "cygwin": - libc_name = "cygwin1.dll" - else: -- libc_name = find_library("c") -- -- if libc_name == None : -- libc_name="/lib/libc.so.6" # fix for my Gentoo 4.0 -- -+ libc_name = util.find_library("c") or "/lib/libc.so.6" # fix for my Gentoo 4.0 - libc = cdll.LoadLibrary(libc_name) - libc.getmntent.restype = POINTER(mntent_struct) -- libc.fopen.restype = c_void_p -+ PyFile_AsFile = pythonapi.PyFile_AsFile -+ PyFile_AsFile.argtypes = [pythonapi.py_object] - -- f = libc.fopen("/proc/mounts", "r") -- if f==None: -- f = libc.fopen("/etc/mtab", "r") -- if f == None: -+ try: -+ f = open("/proc/mounts") -+ except IOError: -+ try: -+ f = open("/etc/mtab") -+ except IOError: - raise IOError("Unable to open /proc/mounts nor /etc/mtab") - -- while True: -- entry = libc.getmntent(f) -- if bool(entry) == False: -- libc.fclose(f) -- break -+ for entry in iter(lambda: libc.getmntent(PyFile_AsFile(f)), None): - yield Filesystem(entry.contents.mnt_dir, - entry.contents.mnt_type, - entry.contents.mnt_fsname) -+ -+ f.close() - -From 8ab3c23f70eb2f373df7c588317b21211ea1b185 Mon Sep 17 00:00:00 2001 -From: Antony Lee <anntzer....@gmail.com> -Date: Wed, 24 Jun 2015 11:14:11 -0700 -Subject: [PATCH 2/2] Another fix that does not depend on pythonapi. - ---- - trashcli/list_mount_points.py | 47 +++++++++++++++++++++++-------------------- - 1 file changed, 25 insertions(+), 22 deletions(-) - -diff --git a/trashcli/list_mount_points.py b/trashcli/list_mount_points.py -index a26aef5..0d782bd 100644 ---- a/trashcli/list_mount_points.py -+++ b/trashcli/list_mount_points.py -@@ -1,4 +1,11 @@ - # Copyright (C) 2009-2011 Andrea Francia Trivolzio(PV) Italy -+from collections import namedtuple -+from ctypes import Structure, c_char_p, c_int, c_void_p, cdll, POINTER -+from ctypes.util import find_library -+from itertools import imap, repeat, takewhile -+import subprocess -+import sys -+ - - def mount_points(): - try: -@@ -6,15 +13,17 @@ def mount_points(): - except AttributeError: - return mount_points_from_df() - -+ - def mount_points_from_getmnt(): - for elem in _mounted_filesystems_from_getmnt(): - yield elem.mount_dir - -+ - def mount_points_from_df(): -- import subprocess - df_output = subprocess.Popen(["df", "-P"], stdout=subprocess.PIPE).stdout - return list(_mount_points_from_df_output(df_output)) - -+ - def _mount_points_from_df_output(df_output): - def skip_header(): - df_output.readline() -@@ -26,15 +35,11 @@ def chomp(string): - line = chomp(line) - yield line.split(None, 5)[-1] - -+ - def _mounted_filesystems_from_getmnt() : -- from ctypes import ( -- c_char_p, c_int, c_void_p, cdll, POINTER, pythonapi, Structure, util) -- import sys -- class Filesystem: -- def __init__(self, mount_dir, type, name) : -- self.mount_dir = mount_dir -- self.type = type -- self.name = name -+ -+ Filesystem = namedtuple("Filesystem", "mount_dir type name") -+ - class mntent_struct(Structure): - _fields_ = [("mnt_fsname", c_char_p), # Device or server for - # filesystem. -@@ -49,23 +54,21 @@ class mntent_struct(Structure): - if sys.platform == "cygwin": - libc_name = "cygwin1.dll" - else: -- libc_name = util.find_library("c") or "/lib/libc.so.6" # fix for my Gentoo 4.0 -+ libc_name = (find_library("c") or -+ find_library("/lib/libc.so.6")) # fix for Gentoo 4.0 -+ - libc = cdll.LoadLibrary(libc_name) -+ libc.fopen.restype = c_void_p -+ libc.getmntent.argtypes = libc.fclose.argtypes = [c_void_p] - libc.getmntent.restype = POINTER(mntent_struct) -- PyFile_AsFile = pythonapi.PyFile_AsFile -- PyFile_AsFile.argtypes = [pythonapi.py_object] - -- try: -- f = open("/proc/mounts") -- except IOError: -- try: -- f = open("/etc/mtab") -- except IOError: -- raise IOError("Unable to open /proc/mounts nor /etc/mtab") -- -- for entry in iter(lambda: libc.getmntent(PyFile_AsFile(f)), None): -+ f = libc.fopen("/proc/mounts", "r") or libc.fopen("/etc/mtab", "r") -+ if not f: -+ raise IOError("Unable to open /proc/mounts nor /etc/mtab") -+ -+ for entry in takewhile(bool, imap(libc.getmntent, repeat(f))): - yield Filesystem(entry.contents.mnt_dir, - entry.contents.mnt_type, - entry.contents.mnt_fsname) - -- f.close() -+ libc.fclose(f) Modified: PKGBUILD =================================================================== --- PKGBUILD 2016-12-28 18:50:15 UTC (rev 203205) +++ PKGBUILD 2016-12-28 18:57:05 UTC (rev 203206) @@ -3,9 +3,8 @@ # Contributor: Renato Garcia <fgarcia.ren...@gmail.com> pkgname=trash-cli -pkgver=0.12.9.14.r34.g7913a0b -_commit=7913a0b8296b006c942e117dd1e94397110467b7 -pkgrel=3 +pkgver=0.16.12.26 +pkgrel=1 pkgdesc="Command line trashcan (recycle bin) interface" arch=("any") url="https://github.com/andreafrancia/$pkgname" @@ -12,24 +11,15 @@ license=("GPL") depends=("python2") makedepends=("python2-setuptools") -source=("$url/archive/$_commit.tar.gz" - "53.patch") -sha256sums=("6a2e3d522072c3fdb76ffa1f1067aeda5a551ecf6b3d71f724b82764ecd2d292" - "c0320a095b0d33be8809d61fde49670ca207dac23cadcb8c1ddea0fc15d50833") +source=("$pkgname-$pkgver.tar.gz::https://github.com/andreafrancia/$pkgname/archive/$pkgver.tar.gz") +sha256sums=('2dbb103f66b40cda54beb58cd47697c079fccd313cb0a7af4abdec054554addc') -prepare(){ - cd "$srcdir/$pkgname-$_commit" - - # Fix segfaults, see: https://github.com/andreafrancia/trash-cli/issues/52 - patch -p1 -i "$srcdir/53.patch" -} - build() { - cd "$srcdir/$pkgname-$_commit" + cd "$srcdir/$pkgname-$pkgver" python2 setup.py build } package(){ - cd "$srcdir/$pkgname-$_commit" + cd "$srcdir/$pkgname-$pkgver" python2 setup.py install --root="$pkgdir" --optimize=1 }