summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Wimpress <[email protected]>2017-01-18 14:25:36 +0000
committerGitHub <[email protected]>2017-01-18 14:25:36 +0000
commit928775bac18b3c6583b56f338f4ed6d6e89a7713 (patch)
treedd87184dc3411ecb95a3390f051e6f408b05ab4d
parent3884cf44d85e99e99852160f90a2145ef15a4c34 (diff)
parentf26c3508ca3be0ce8844b2fb63ace0d53152abce (diff)
downloadmate-desktop-928775bac18b3c6583b56f338f4ed6d6e89a7713.tar.bz2
mate-desktop-928775bac18b3c6583b56f338f4ed6d6e89a7713.tar.xz
Merge pull request #244 from flexiondotorg/drop-mpaste
Drop mpaste.
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac8
-rw-r--r--man/Makefile.am4
-rw-r--r--man/mpaste.150
-rw-r--r--tools/Makefile.am7
-rwxr-xr-xtools/mpaste178
6 files changed, 3 insertions, 247 deletions
diff --git a/Makefile.am b/Makefile.am
index 9e1827f..78bf95a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,8 +7,7 @@ endif
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
DISTCHECK_CONFIGURE_FLAGS = \
- --enable-gtk-doc \
- --enable-mpaste
+ --enable-gtk-doc
if MATE_ABOUT_ENABLED
versiondir = $(datadir)/mate-about
diff --git a/configure.ac b/configure.ac
index 40d511b..72ce4ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,13 +91,6 @@ AC_ARG_ENABLE([mate-about],
AM_CONDITIONAL(MATE_ABOUT_ENABLED, test "x$enable_mate_about" = "xyes")
-# Install tool to paste text to paste.mate-desktop.org
-AC_ARG_ENABLE([mpaste],
- [AS_HELP_STRING([--enable-mpaste],[install mpaste tool])],,
- [enable_mpaste=no])
-AM_CONDITIONAL(MPASTE_ENABLED, test "x$enable_mpaste" = "xyes")
-
-
# Path to the pnp.ids file -- to know if we use one shipped with another
# package, or an internal file
@@ -306,7 +299,6 @@ mate-desktop $VERSION
Use *_DISABLE_DEPRECATED: ${enable_deprecation_flags}
Build mate-about: ${enable_mate_about}
- Install mpaste: ${enable_mpaste}
Use external pnp.ids: ${EXTERNAL_PNP_IDS}
Startup notification support: ${have_startup_notification}
XRandr support: ${have_randr}
diff --git a/man/Makefile.am b/man/Makefile.am
index df62198..227b6e3 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,9 +1,9 @@
-man_MANS = mate-color-select.1 mpaste.1
+man_MANS = mate-color-select.1
if MATE_ABOUT_ENABLED
man_MANS += mate-about.1
endif
-EXTRA_DIST = mate-about.1 mate-color-select.1 mpaste.1
+EXTRA_DIST = mate-about.1 mate-color-select.1
-include $(top_srcdir)/git.mk
diff --git a/man/mpaste.1 b/man/mpaste.1
deleted file mode 100644
index 2f6fcdf..0000000
--- a/man/mpaste.1
+++ /dev/null
@@ -1,50 +0,0 @@
-.\"
-.\" mpaste manual page.
-.\" (C) 2015 Mike Gabriel <[email protected]>
-.\"
-.TH MPASTE 1 "MATE"
-.SH NAME
-mpaste \- command\-line client for https://paste.mate\-desktop.org
-.SH SYNOPSIS
-.B mpaste [<OPTIONS>] [<INFILE>]
-.SH DESCRIPTION
-The \fBmpaste\fR program reads text from file or STDIN and sends it to
-
- \fIhttps://paste.mate\-desktop.org\fR,
-
-a pastebin site run by the MATE Desktop project. After pasting some text,
-\fBmpaste\fR returns the URL of the pasted text to the user.
-
-If \fI<INFILE>\fR is omitted, \fBmpaste\fR waits for incoming text on STDIN.
-
-.SH OPTIONS
-The following options are supported:
-.TP
-.I "\-t, \-\-title <TITLE>"
-Title of the paste.
-.\" .TP
-.\" .I "\-a, \-\-author"
-.\" Author of the paste.
-.TP
-.I "\-p, \-\-private"
-Should this paste be private?
-.TP
-.I "\-pwd, \-\-password <PASSWORD>"
-Protect paste with a given password.
-.TP
-.I "\-lang, \-\-language <LANG>"
-Language that the paste is in.
-.TP
-.I "\-ll, \-\-language\-list"
-List all supported languages.
-.TP
-.I "\-e, \-\-expire <MINUTES>"
-Paste expires in a given number of minutes.
-
-.SH BUGS
-If you find bugs in the \fImpaste\fP program, please report
-these on https://github.com/mate\-desktop/mate\-desktop/issues.
-
-.SH AUTHOR
-This manual page has been written for the Debian project by Mike Gabriel
-<mike.gabriel@das\-netzwerkteam.de> and maybe used by others.
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 79b5b8e..301ef25 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -21,11 +21,4 @@ desktopdir = $(datadir)/applications
desktop_in_files = mate-color-select.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
-if MPASTE_ENABLED
-bin_SCRIPTS += mpaste
-endif
-
-EXTRA_DIST = \
- mpaste
-
CLEANFILES = *.desktop *.desktop.in
diff --git a/tools/mpaste b/tools/mpaste
deleted file mode 100755
index 08af04b..0000000
--- a/tools/mpaste
+++ /dev/null
@@ -1,178 +0,0 @@
-#!/usr/bin/python
-
-# Pastes input from stdin to paste.mate-desktop.org
-
-# Copyright (C) 2013 Steve Zesch
-
-# Rewritten for Sticky notes 2014-10-09
-# Copyright (C) 2014 Sander Sweers
-
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# TODO: cache language/expire results on disk
-# TODO: If api is updated for registered users add back --author
-
-from __future__ import unicode_literals, print_function
-from gi.repository import Gio
-import json
-import requests
-import argparse
-import sys
-
-def build_paste(args, data):
- '''Build paste from arguments and data'''
- values = {}
- for opt, val in args.__dict__.items():
- if opt == 'infile': continue
- if opt == 'title' and val: values[opt] = val[:29]
- if val: values[opt] = val
-
- values['data'] = data
-
- return values
-
-def create_parser():
- '''Build argument parser'''
- parser = argparse.ArgumentParser(prog='mpaste')
- parser.add_argument('-t', '--title', dest='title',
- help='title of this paste')
- ## parser.add_argument('-a', '--author', dest='author',
- ## help='author of this paste')
- parser.add_argument('-p', '--private', dest='private', action='store_true',
- help='should this paste be private')
- parser.add_argument('-pwd', '--password', dest='password',
- help='password of this paste')
- parser.add_argument('-lang', '--language', dest='language', default="text",
- help='language this paste is in')
- parser.add_argument('-ll', '--language-list', dest='lang_list', action='store_true',
- help='List all supported languages')
- parser.add_argument('-e', '--expire', dest='expire', type=int, default=1800,
- help='paste expiration in minutes')
- parser.add_argument('infile', nargs='?', type=argparse.FileType('r'), default=sys.stdin,
- help='The file to paste or when no file read stdin')
-
- return parser
-
-def get_params(session):
- '''Retrieve valid parameters and defaults'''
- param_api_url = 'http://paste.mate-desktop.org/api/json/parameter/'
- params = {}
-
- resp_lang = session.get(param_api_url + 'language')
- if resp_lang.status_code != 200:
- params['languages'] = 'text'
- print('Could not load languages from api, defaulting to \"text\"')
- else:
- params['languages'] = json.loads(resp_lang.content)['result']['values']
-
- resp_expire = session.get(param_api_url + 'expire')
- if resp_expire.status_code != 200:
- params['expires'] = 1800
- print('Could not get expiration times, defaulting to 1800')
- else:
- params['expires'] = json.loads(resp_expire.content)['result']['values']
-
- return params
-
-def get_proxies():
- '''Read proxy from gsettings'''
-
- proxies = {}
- schemas = ('org.gnome.system.proxy.ftp',
- 'org.gnome.system.proxy.http',
- 'org.gnome.system.proxy.https',
- 'org.gnome.system.proxy.socks')
-
- settings = Gio.Settings.new('org.gnome.system.proxy')
- mode = settings['mode']
-
- if mode == 'none':
- return {}
-
- for schema in schemas:
- settings = Gio.Settings.new(schema)
- host = settings['host']
- port = str(settings['port'])
- proxy_type = schema.split('.')[-1]
-
- if not host:
- continue
-
- proxies[proxy_type] = ':'.join((host, port))
-
- return proxies
-
-if __name__ == '__main__':
- api_url = 'http://paste.mate-desktop.org/api/json/'
-
- # Get proxies from gsettings
- proxies = get_proxies()
-
- # create session and add proxies
- session = requests.session()
- session.proxies = proxies
-
- params = get_params(session)
-
- # Create argument parser and read arguments
- parser = create_parser()
- args = parser.parse_args()
-
- # Print all supported languages
- if args.lang_list:
- print('Supported languages are:')
- for lang in params['languages']:
- print('* %s' % lang)
- sys.exit()
-
- # Check if we are reading from a file or stdin
- if sys.stdin.isatty():
- print('Reading file: %s ...' % args.infile.name)
- data = args.infile.read()
- else:
- print('Reading from stdin ...')
- data = sys.stdin.read()
-
- # Check if provided lang is supported
- if not args.language in params['languages']:
- print('Unsupported language: %s' % args.language)
- print('Run --all-language to get a list of valid values')
- sys.exit(1)
-
- # Check if expiration in minutes is valid
- if not args.expire in params['expires']:
- valid = ', '.join([str(i) for i in sorted(params['expires'])])
- print('Invalid expiring time: %s' % args.expire)
- print('Valid expire values in minutes are: \n%s' % valid)
- sys.exit(1)
-
- # Build the paste dict used by requests
- paste = build_paste(args, data)
-
- # If we read a file and no title given use the file name
- if not args.title and args.infile.name != '<stdin>':
- paste['title'] = args.infile.name[:29]
-
- # Post the data to the website
- resp = session.post(api_url + 'create', data=paste)
- result = json.loads(resp.content)['result']
-
- # Show url or error
- if len(result) < 2:
- print('Could not paste, got error: %s' % result['error'])
- else:
- print('Pasted successfully \o/')
- print('Url: http://paste.mate-desktop.org/%s' % result['id'])
- if result['hash']: print('Got the following hash: %s' % result['hash'])