public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/trash-cli] pr6: Update to latest git commit
Date: Sun, 20 Sep 2026 13:18:03 GMT	[thread overview]
Message-ID: <178991028300.1.8457091215026639109.rpms-trash-cli-756311447290@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/trash-cli
            Branch : pr6
            Commit : 7563114472909abebfb079e34e490abf31625fc9
            Author : Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com>
            Date   : 2016-02-15T11:26:16+00:00
            Stats  : +193/-10 in 5 file(s)
            URL    : https://src.fedoraproject.org/rpms/trash-cli/c/7563114472909abebfb079e34e490abf31625fc9?branch=pr6

            Log:
            Update to latest git commit

- Updated to 798b71dcb887828dee776c150a29c3c8b7387bf6.
- Also included patches that should fix #1291236.

---
diff --git a/.gitignore b/.gitignore
index 798d55d..3d76d2f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,5 @@ trash-cli-0.11.2.tar.gz
 /trash-cli-0.11.3-r315.tar.gz
 /trash-cli-0.12.4.24.tar.gz
 /trash-cli-0.12.9.14.tar.gz
+/trash-cli-0.12.9.14-git798b71d.tar.gz
+/trash-cli-798b71d.tar.gz

diff --git a/0001-Rely-on-Python-to-open-close-files.patch b/0001-Rely-on-Python-to-open-close-files.patch
new file mode 100644
index 0000000..a8dc82b
--- /dev/null
+++ b/0001-Rely-on-Python-to-open-close-files.patch
@@ -0,0 +1,67 @@
+From c39f4e92433fb27b42b36c2747cff63b98b11ccb Mon Sep 17 00:00:00 2001
+From: Antony Lee <anntzer.lee@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 _mount_points_from_df_output(df_output):
+ 	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 @@ def _mounted_filesystems_from_getmnt() :
+     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()
+-- 
+2.5.0
+

diff --git a/0002-Another-fix-that-does-not-depend-on-pythonapi.patch b/0002-Another-fix-that-does-not-depend-on-pythonapi.patch
new file mode 100644
index 0000000..97721d5
--- /dev/null
+++ b/0002-Another-fix-that-does-not-depend-on-pythonapi.patch
@@ -0,0 +1,102 @@
+From 8ab3c23f70eb2f373df7c588317b21211ea1b185 Mon Sep 17 00:00:00 2001
+From: Antony Lee <anntzer.lee@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 _mount_points_from_df_output(df_output):
+ 	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 @@ def _mounted_filesystems_from_getmnt() :
+     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)
+-- 
+2.5.0
+

diff --git a/sources b/sources
index cb03976..6320a05 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-79135954bbe5d0c806d298c38e3e0527  trash-cli-0.12.9.14.tar.gz
+4e6217633e7d2ebfa4da2684c491562a  trash-cli-798b71d.tar.gz

diff --git a/trash-cli.spec b/trash-cli.spec
index 1344b3b..ac89845 100644
--- a/trash-cli.spec
+++ b/trash-cli.spec
@@ -1,44 +1,56 @@
+%global commit0 798b71dcb887828dee776c150a29c3c8b7387bf6
+%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
+
 Summary:        Command line interface to the freedesktop.org trashcan
 Name:           trash-cli
 Version:        0.12.9.14
-Release:        9%{?dist}
+Release:        10git%{shortcommit0}%{?dist}
 License:        GPLv2+
 Group:          System Environment/Base
 URL  :          https://github.com/andreafrancia/trash-cli
-Source0:        http://pypi.python.org/packages/source/t/trash-cli/trash-cli-%{version}.tar.gz
+#Source0:        http://pypi.python.org/packages/source/t/trash-cli/trash-cli-%{version}.tar.gz
+Source0:        https://github.com/andreafrancia/%{name}/archive/%{commit0}.tar.gz#/%{name}-%{shortcommit0}.tar.gz
+Patch0:         0001-Rely-on-Python-to-open-close-files.patch
+Patch1:         0002-Another-fix-that-does-not-depend-on-pythonapi.patch
 BuildArch:      noarch
 BuildRequires:  python-setuptools dos2unix
 Requires:       python-unipath python-setuptools
 
 %description
-trash-cli provides a command line trash usable with GNOME, KDE, Xfce or any 
+trash-cli provides a command line trash usable with GNOME, KDE, Xfce or any
 freedesktop.org compatible trash implementation. The command line interface is
-compatible with rm and you can use trash-put as an alias to rm.  
+compatible with rm and you can use trash-put as an alias to rm.
 
 %prep
-%setup -q 
+%setup -q -n %{name}-%{shortcommit0}
+%patch0 -p1
+%patch1 -p1
 
 %build
 %{__python} setup.py build
 
 %install
-%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT 
+%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
 
 # remove the testing part
 rm -fvr $RPM_BUILD_ROOT/%{python_sitelib}/unit_tests
-rm -fvr $RPM_BUILD_ROOT/%{python_sitelib}/integration_tests 
+rm -fvr $RPM_BUILD_ROOT/%{python_sitelib}/integration_tests
 
 %files
 %doc README.rst
 
 %{_bindir}/trash*
-%{_bindir}/restore-trash
+#%{_bindir}/restore-trash
 %{python_sitelib}/trashcli/
 %{python_sitelib}/trash_cli-*-py*.egg-info
 %{_mandir}/man1/trash-*
-%{_mandir}/man1/restore-trash*
+#%{_mandir}/man1/restore-trash*
 
 %changelog
+* Mon Feb 15 2016 Ankur Sinha <ankursinha AT fedoraproject DOT org> 0.12.9.14-10git798b71d
+- Update to latest git commit
+- Add patches that are pending merge to fix #1291236
+
 * Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.9.14-9
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
 

                 reply	other threads:[~2026-09-20 13:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178991028300.1.8457091215026639109.rpms-trash-cli-756311447290@fedoraproject.org \
    --to=sanjay.ankur@gmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox