From ab2f74727e1cf997113518d24796c8b5c95c097f Mon Sep 17 00:00:00 2001 From: Ankur Sinha (Ankur Sinha Gmail) Date: Jun 10 2014 06:05:07 +0000 Subject: 0.3.7.3 Improve how fpaste errors out when xsel is absent but --clipout is used. rhbz #1107333 - Thanks to Mike Ruckman for reporting the issue. --- diff --git a/CHANGELOG b/CHANGELOG index ce4844e..4500be0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ fpaste ChangeLog +0.3.7.3 - 20140610 + + *) Improve how fpaste fails when xsel is absent for --clipout - rhbz #1107333 + 0.3.7.2.1 - 20140606 *) version bump for consistency diff --git a/docs/man/en/fpaste.1 b/docs/man/en/fpaste.1 index 685a6b6..da09a76 100644 --- a/docs/man/en/fpaste.1 +++ b/docs/man/en/fpaste.1 @@ -1,5 +1,5 @@ .\" first draft by Ankur Sinha <ankursinha at fedoraproject.org> -.TH "fpaste" "1" "version 0.3.7.2.1" "Fedora Unity" "" +.TH "fpaste" "1" "version 0.3.7.3" "Fedora Unity" "" .SH "NAME" fpaste \- A cli frontend for the fpaste.org pastebin .SH "SYNOPSIS" diff --git a/fpaste b/fpaste index aaa6dd9..824e165 100755 --- a/fpaste +++ b/fpaste @@ -16,7 +16,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -VERSION = '0.3.7.2.1' +VERSION = '0.3.7.3' USER_AGENT = 'fpaste/' + VERSION SET_DESCRIPTION_IF_EMPTY = 1 # stdin, clipboard, sysinfo #FPASTE_URL = 'http://fpaste.org/' @@ -641,15 +641,19 @@ Examples: if url: # try to save URL in clipboard, and warn but don't error if options.clipout: - xselcmd = 'xsel -i --%s' % options.selection + if not os.access('/usr/bin/xsel', os.X_OK): + print >> sys.stderr, 'OOPS - the clipboard options currently depend on "/usr/bin/xsel", which does not appear to be installed' + else: + xselcmd = 'xsel -i --%s' % options.selection #os.popen(xselcmd, 'wb').write(url) - p = subprocess.Popen(xselcmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) - (out, err) = p.communicate(input=url) - if p.returncode != 0: - if options.debug: - print >> sys.stderr, err - #parser.error("'xsel' failure. this usually means you're not running X") - print >> sys.stderr, "WARNING: URL not saved to clipboard" + p = subprocess.Popen(xselcmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) + (out, err) = p.communicate(input=url) + if p.returncode != 0: + if options.debug: + print >> sys.stderr, err + print >> sys.stderr, "WARNING: URL not saved to clipboard" + else: + print "URL copied to primary clipboard" if not short_url: print >> sys.stderr, "WARNING: Could not shorten URL"