Merge branch 'master' of https://github.com/ianweller/python-simplemediawiki
authorBenjamin Mako Hill <mako@atdot.cc>
Sat, 12 Feb 2011 19:09:27 +0000 (14:09 -0500)
committerBenjamin Mako Hill <mako@atdot.cc>
Sat, 12 Feb 2011 19:09:27 +0000 (14:09 -0500)
19 files changed:
PKG-INFO [new file with mode: 0644]
debian/.git-dpm [new file with mode: 0644]
debian/README.Debian [new file with mode: 0644]
debian/README.source [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/patches/0001-Fix-not-being-able-to-import-the-module.patch [new file with mode: 0644]
debian/patches/0002-Import-iso8601-in-a-way-that-makes-pylint-happy.patch [new file with mode: 0644]
debian/patches/0003-Refactor-normalize_api_url.patch [new file with mode: 0644]
debian/patches/0004-There-s-no-good-way-to-import-iso8601-apparently.patch [new file with mode: 0644]
debian/patches/0005-Add-docstring-to-_fetch_http.patch [new file with mode: 0644]
debian/patches/0006-Forget-about-version-checking-for-right-now.patch [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/source/format [new file with mode: 0644]
debian/watch.ex [new file with mode: 0644]

diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644 (file)
index 0000000..61537d2
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,14 @@
+Metadata-Version: 1.1
+Name: simplemediawiki
+Version: 1.0.2
+Summary: Extremely low-level wrapper to the MediaWiki API
+Home-page: http://github.com/ianweller/python-simplemediawiki
+Author: Ian Weller
+Author-email: ian@ianweller.org
+License: UNKNOWN
+Description: UNKNOWN
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
+Requires: iso8601
diff --git a/debian/.git-dpm b/debian/.git-dpm
new file mode 100644 (file)
index 0000000..2095053
--- /dev/null
@@ -0,0 +1,8 @@
+# see git-dpm(1) from git-dpm package
+49b148ee4c10fdf671288331217bd4dd0304b8b4
+49b148ee4c10fdf671288331217bd4dd0304b8b4
+04a25c76a33802f39e2afe4989d822c010a7e863
+04a25c76a33802f39e2afe4989d822c010a7e863
+python-simplemediawiki_1.0.2.orig.tar.gz
+9e4e0ad20c0bf2df975e9f81ad0d791644598598
+12353
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644 (file)
index 0000000..424c867
--- /dev/null
@@ -0,0 +1,6 @@
+python-simplemediawiki for Debian
+---------------------------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- Benjamin Mako Hill <mako@debian.org>  Fri, 11 Feb 2011 00:31:20 -0500
diff --git a/debian/README.source b/debian/README.source
new file mode 100644 (file)
index 0000000..72b09d0
--- /dev/null
@@ -0,0 +1,9 @@
+python-simplemediawiki for Debian
+---------------------------------
+
+<this file describes information about the source package, see Debian policy
+manual section 4.14. You WILL either need to modify or delete this file>
+
+
+
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..6b7805e
--- /dev/null
@@ -0,0 +1,5 @@
+python-simplemediawiki (1.0.2-1) unstable; urgency=low
+
+  * Initial release (Closes: #nnnn)  <nnnn is the bug number of your ITP>
+
+ -- Benjamin Mako Hill <mako@debian.org>  Fri, 11 Feb 2011 00:31:20 -0500
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7f8f011
--- /dev/null
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..ccc95ba
--- /dev/null
@@ -0,0 +1,17 @@
+Source: python-simplemediawiki
+Section: unknown
+Priority: extra
+Maintainer: Benjamin Mako Hill <mako@debian.org>
+Build-Depends: cdbs, debhelper (>= 7.0.50~)
+Standards-Version: 3.8.4
+Homepage: <insert the upstream URL, if relevant>
+XS-Python-Version: >= 2.6
+#Vcs-Git: git://git.debian.org/collab-maint/python-simplemediawiki.git
+#Vcs-Browser: http://git.debian.org/?p=collab-maint/python-simplemediawiki.git;a=summary
+
+Package: python-simplemediawiki
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}
+XB-Python-Version: ${python:Versions}
+Description: <insert up to 60 chars description>
+ <insert long description, indented with spaces>
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..abf7a20
--- /dev/null
@@ -0,0 +1,53 @@
+This work was packaged for Debian by:
+
+    Benjamin Mako Hill <mako@debian.org> on Fri, 11 Feb 2011 00:31:20 -0500
+
+It was downloaded from:
+
+    <url://example.com>
+
+Upstream Author(s):
+
+    <put author's name and email here>
+    <likewise for another author>
+
+Copyright:
+
+    <Copyright (C) YYYY Firstname Lastname>
+    <likewise for another author>
+
+License:
+
+### SELECT: ###
+    This package 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.
+### OR ###
+   This package is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License version 2 as
+   published by the Free Software Foundation.
+##########
+
+    This package 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, see <http://www.gnu.org/licenses/>
+
+On Debian systems, the complete text of the GNU General
+Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
+
+The Debian packaging is:
+
+    Copyright (C) 2011 Benjamin Mako Hill <mako@debian.org>
+
+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.
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/patches/0001-Fix-not-being-able-to-import-the-module.patch b/debian/patches/0001-Fix-not-being-able-to-import-the-module.patch
new file mode 100644 (file)
index 0000000..8154aef
--- /dev/null
@@ -0,0 +1,40 @@
+From a54cc1e6cdfacf678711f6c88021c8eca5c6580c Mon Sep 17 00:00:00 2001
+From: Ian Weller <ian@ianweller.org>
+Date: Fri, 4 Feb 2011 22:06:35 -0600
+Subject: Fix not being able to import the module
+
+---
+ simplemediawiki.py |   13 ++++++-------
+ 1 files changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/simplemediawiki.py b/simplemediawiki.py
+index ab0f3f7..6bdd944 100644
+--- a/simplemediawiki.py
++++ b/simplemediawiki.py
+@@ -39,6 +39,12 @@ from StringIO import StringIO
+ import urllib
+ import urllib2
++__author__ = 'Ian Weller <ian@ianweller.org>'
++__version__ = '1.0.2'
++DEFAULT_UA = ('python-simplemediawiki/%s '
++              '+https://github.com/ianweller/python-simplemediawiki') \
++        % __version__
++
+ class MediaWiki():
+     """
+@@ -206,10 +212,3 @@ class MediaWiki():
+         objects.
+         """
+         return iso8601.parse_date(date)
+-
+-
+-__author__ = 'Ian Weller <ian@ianweller.org>'
+-__version__ = '1.0.2'
+-DEFAULT_UA = 'python-simplemediawiki/%s ' + \
+-        '+https://github.com/ianweller/python-simplemediawiki' \
+-        % __version__
+-- 
+1.7.2.3
+
diff --git a/debian/patches/0002-Import-iso8601-in-a-way-that-makes-pylint-happy.patch b/debian/patches/0002-Import-iso8601-in-a-way-that-makes-pylint-happy.patch
new file mode 100644 (file)
index 0000000..5c55bcb
--- /dev/null
@@ -0,0 +1,25 @@
+From 9ce74c8ebc5ac8ee818ec122c89531b1d1b4c9ac Mon Sep 17 00:00:00 2001
+From: Ian Weller <ian@ianweller.org>
+Date: Fri, 4 Feb 2011 22:10:54 -0600
+Subject: Import iso8601 in a way that makes pylint happy
+
+---
+ simplemediawiki.py |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/simplemediawiki.py b/simplemediawiki.py
+index 6bdd944..ff879ed 100644
+--- a/simplemediawiki.py
++++ b/simplemediawiki.py
+@@ -33,7 +33,7 @@ of namespaces are provided for your convenience.
+ import cookielib
+ import gzip
+-from iso8601 import iso8601
++import iso8601.iso8601 as iso8601
+ import json
+ from StringIO import StringIO
+ import urllib
+-- 
+1.7.2.3
+
diff --git a/debian/patches/0003-Refactor-normalize_api_url.patch b/debian/patches/0003-Refactor-normalize_api_url.patch
new file mode 100644 (file)
index 0000000..8a2566b
--- /dev/null
@@ -0,0 +1,78 @@
+From de97f3ccde6527ac63bde701ae759291d93d1aa4 Mon Sep 17 00:00:00 2001
+From: Ian Weller <ian@ianweller.org>
+Date: Fri, 4 Feb 2011 23:58:26 -0600
+Subject: Refactor normalize_api_url
+
+---
+ simplemediawiki.py |   42 +++++++++++++++++++++++-------------------
+ 1 files changed, 23 insertions(+), 19 deletions(-)
+
+diff --git a/simplemediawiki.py b/simplemediawiki.py
+index ff879ed..e123a5b 100644
+--- a/simplemediawiki.py
++++ b/simplemediawiki.py
+@@ -101,7 +101,28 @@ class MediaWiki():
+         returns that URL, while also helpfully setting this object's API URL to
+         it. If it can't magically conjure an API endpoint, it returns False.
+         """
+-        data, data_json = self._normalize_api_url_tester(self._api_url)
++        def tester(self, api_url):
++            """
++            Attempts to fetch general information about the MediaWiki instance
++            in order to test whether the given URL will return JSON.
++            """
++            data = self._fetch_http(api_url, {'action': 'query',
++                                              'meta': 'siteinfo',
++                                              'siprop': 'general',
++                                              'format': 'json'})
++            try:
++                data_json = json.loads(data)
++                # may as well set the version
++                try:
++                    version_string = data_json['query']['general']['generator']
++                    self._mediawiki_version = version_string.split(' ', 1)[1]
++                except KeyError:
++                    pass
++                return (data, data_json)
++            except ValueError:
++                return (data, None)
++
++        data, data_json = tester(self, self._api_url)
+         if data_json:
+             return self._api_url
+         else:
+@@ -109,30 +130,13 @@ class MediaWiki():
+             if 'index.php' in self._api_url:
+                 test_api_url = self._api_url.split('index.php')[0] + 'api.php'
+                 print test_api_url
+-                test_data, test_data_json = \
+-                        self._normalize_api_url_tester(test_api_url)
++                test_data, test_data_json = tester(self, test_api_url)
+                 print (test_data, test_data_json)
+                 if test_data_json:
+                     self._api_url = test_api_url
+                     return self._api_url
+             return False
+-    def _normalize_api_url_tester(self, api_url):
+-        data = self._fetch_http(api_url, {'action': 'query',
+-                                          'meta': 'siteinfo',
+-                                          'siprop': 'general',
+-                                          'format': 'json'})
+-        try:
+-            data_json = json.loads(data)
+-            # may as well set the version
+-            try:
+-                version_string = data_json['query']['general']['generator']
+-                self._mediawiki_version = version_string.split(' ', 1)[1]
+-            except KeyError:
+-                pass
+-            return (data, data_json)
+-        except ValueError:
+-            return (data, None)
+     def login(self, user, passwd, token=None):
+         """
+-- 
+1.7.2.3
+
diff --git a/debian/patches/0004-There-s-no-good-way-to-import-iso8601-apparently.patch b/debian/patches/0004-There-s-no-good-way-to-import-iso8601-apparently.patch
new file mode 100644 (file)
index 0000000..0d6c506
--- /dev/null
@@ -0,0 +1,25 @@
+From efa6e86fcf1586602e39253bca8a7abf5de34efe Mon Sep 17 00:00:00 2001
+From: Ian Weller <ian@ianweller.org>
+Date: Sat, 5 Feb 2011 00:00:31 -0600
+Subject: There's no good way to import iso8601, apparently
+
+---
+ simplemediawiki.py |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/simplemediawiki.py b/simplemediawiki.py
+index e123a5b..f039c5a 100644
+--- a/simplemediawiki.py
++++ b/simplemediawiki.py
+@@ -33,7 +33,7 @@ of namespaces are provided for your convenience.
+ import cookielib
+ import gzip
+-import iso8601.iso8601 as iso8601
++import iso8601
+ import json
+ from StringIO import StringIO
+ import urllib
+-- 
+1.7.2.3
+
diff --git a/debian/patches/0005-Add-docstring-to-_fetch_http.patch b/debian/patches/0005-Add-docstring-to-_fetch_http.patch
new file mode 100644 (file)
index 0000000..008fb9e
--- /dev/null
@@ -0,0 +1,27 @@
+From bed00dea090ba51e33981e0b6784f23253d4f74a Mon Sep 17 00:00:00 2001
+From: Ian Weller <ian@ianweller.org>
+Date: Sat, 5 Feb 2011 00:00:46 -0600
+Subject: Add docstring to _fetch_http
+
+---
+ simplemediawiki.py |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/simplemediawiki.py b/simplemediawiki.py
+index f039c5a..2934ab9 100644
+--- a/simplemediawiki.py
++++ b/simplemediawiki.py
+@@ -74,6 +74,10 @@ class MediaWiki():
+         self._opener.addheaders = [('User-agent', user_agent)]
+     def _fetch_http(self, url, params):
++        """
++        Standard HTTP request handler for this class with gzip and cookie
++        support.
++        """
+         request = urllib2.Request(url, urllib.urlencode(params))
+         request.add_header('Accept-encoding', 'gzip')
+         response = self._opener.open(request)
+-- 
+1.7.2.3
+
diff --git a/debian/patches/0006-Forget-about-version-checking-for-right-now.patch b/debian/patches/0006-Forget-about-version-checking-for-right-now.patch
new file mode 100644 (file)
index 0000000..09d3a5a
--- /dev/null
@@ -0,0 +1,43 @@
+From 49b148ee4c10fdf671288331217bd4dd0304b8b4 Mon Sep 17 00:00:00 2001
+From: Ian Weller <ian@ianweller.org>
+Date: Sat, 5 Feb 2011 00:31:07 -0600
+Subject: Forget about version checking for right now
+
+---
+ simplemediawiki.py |   11 +----------
+ 1 files changed, 1 insertions(+), 10 deletions(-)
+
+diff --git a/simplemediawiki.py b/simplemediawiki.py
+index 2934ab9..ec12a11 100644
+--- a/simplemediawiki.py
++++ b/simplemediawiki.py
+@@ -55,7 +55,6 @@ class MediaWiki():
+     _high_limits = None
+     _namespaces = None
+     _psuedo_namespaces = None
+-    _mediawiki_version = None
+     def __init__(self, api_url, cookie_file=None, user_agent=DEFAULT_UA):
+         self._api_url = api_url
+@@ -111,17 +110,9 @@ class MediaWiki():
+             in order to test whether the given URL will return JSON.
+             """
+             data = self._fetch_http(api_url, {'action': 'query',
+-                                              'meta': 'siteinfo',
+-                                              'siprop': 'general',
+-                                              'format': 'json'})
++                                              'meta': 'siteinfo'})
+             try:
+                 data_json = json.loads(data)
+-                # may as well set the version
+-                try:
+-                    version_string = data_json['query']['general']['generator']
+-                    self._mediawiki_version = version_string.split(' ', 1)[1]
+-                except KeyError:
+-                    pass
+                 return (data, data_json)
+             except ValueError:
+                 return (data, None)
+-- 
+1.7.2.3
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..4cfcd08
--- /dev/null
@@ -0,0 +1,6 @@
+0001-Fix-not-being-able-to-import-the-module.patch
+0002-Import-iso8601-in-a-way-that-makes-pylint-happy.patch
+0003-Refactor-normalize_api_url.patch
+0004-There-s-no-good-way-to-import-iso8601-apparently.patch
+0005-Add-docstring-to-_fetch_http.patch
+0006-Forget-about-version-checking-for-right-now.patch
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..f0a45b3
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+
+DEB_PYTHON_SYSTEM=pysupport
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+#include /usr/share/cdbs/1/class/makefile.mk
+include /usr/share/cdbs/1/class/python-distutils.mk
+
+# Add here any variable or target overrides you need.
diff --git a/debian/source/format b/debian/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/watch.ex b/debian/watch.ex
new file mode 100644 (file)
index 0000000..bc7f9dd
--- /dev/null
@@ -0,0 +1,23 @@
+# Example watch control file for uscan
+# Rename this file to "watch" and then you can run the "uscan" command
+# to check for upstream updates and more.
+# See uscan(1) for format
+
+# Compulsory line, this is a version 3 file
+version=3
+
+# Uncomment to examine a Webpage
+# <Webpage URL> <string match>
+#http://www.example.com/downloads.php python-simplemediawiki-(.*)\.tar\.gz
+
+# Uncomment to examine a Webserver directory
+#http://www.example.com/pub/python-simplemediawiki-(.*)\.tar\.gz
+
+# Uncommment to examine a FTP server
+#ftp://ftp.example.com/pub/python-simplemediawiki-(.*)\.tar\.gz debian uupdate
+
+# Uncomment to find new files on sourceforge, for devscripts >= 2.9
+# http://sf.net/python-simplemediawiki/python-simplemediawiki-(.*)\.tar\.gz
+
+# Uncomment to find new files on GooglePages
+# http://example.googlepages.com/foo.html python-simplemediawiki-(.*)\.tar\.gz

Benjamin Mako Hill || Want to submit a patch?