From 9778d67ea6569a6ec514bc300425942857ec54c1 Mon Sep 17 00:00:00 2001 From: Christophe Benz Date: Mon, 2 Aug 2010 11:24:01 +0200 Subject: [PATCH 1/7] update doc --- INSTALL | 71 +++++++++++++++++---------------------------------------- README | 10 ++++++++ 2 files changed, 31 insertions(+), 50 deletions(-) diff --git a/INSTALL b/INSTALL index eaab8f46..b58a79cd 100644 --- a/INSTALL +++ b/INSTALL @@ -1,64 +1,35 @@ Weboob installation =================== -Like any Python package using setuptools, Weboob can be installed: - * from eggs - * from Debian packages - * from setup.py in install mode or in development mode +Like any Python package using setuptools, Weboob can be installed in install +mode or in development mode. -From Eggs ---------- +Install mode +------------ -Weboob is distributed using many packages. There is one package for the core -library, many packages for backends (grouped by capabilities), and one package -for each application. +The install mode copies files to the Python system-wide packages directory +(for example /usr/lib/python2.5/site-packages for Python 2.5, +or /usr/local/lib/python2.6/dist-packages for Python 2.6) -To install: -TODO: no packages released for the moment - -To uninstall: -TODO: no packages released for the moment - - -From Debian packages --------------------- - -Install from the Weboob repository: -TODO: no Debian repository exists - -For developers: build yourself Debian packages using -$ ./tools/packaging/create_debian_packages.sh - - -From setup.py -------------- - -The install mode copies files to /usr/lib/python2.5/site-packages -or /usr/local/lib/python2.6/dist-packages - -The development mode doesn't copy files, but it creates an egg-link -which points to the development directory. -It is useful for development when files often change. - -# ./setup.py develop -Creates /usr/lib/python2.5/site-packages/weboob_dev.egg-link -or /usr/local/lib/python2.6/dist-packages/weboob_dev.egg-link - -If you don't want to install all the dependencies, use the --no-deps option: -# ./setup.py develop --no-deps -and install dependencies by hand from your distribution packages, or from PyPI -using easy_install, or the more modern pip. +# ./setup.py install Scripts are copied to /usr/bin. +Since there are many dependencies, when you install from sources, +you have to handle them by hand, according to your distribution. +If you still want to download them, you can uncomment the dependencies +in setup.py + To uninstall, remove the egg-link and remove the weboob_dev line in -/usr/lib/python2.5/site-packages/easy-install.pth -or /usr/local/lib/python2.6/dist-packages/easy-install.pth +your Python system-wide packages directory. -Bash completion ---------------- +Development mode +---------------- -To enable bash completion, just source the tools/weboob_bash_completion -file from your ~/.bash_completion file (which is sourced by /etc/bash_completion). +The development mode doesn't copy files, but creates an egg-link +in the Python system-wide packages directory which points to the development +directory. It is useful for development when files often change. + +# ./setup.py develop diff --git a/README b/README index 519b226a..7298bf44 100644 --- a/README +++ b/README @@ -1,5 +1,8 @@ Weboob is a project which provides a core library, backends and applications. +Overview +-------- + The core library defines capabilities: features common to various websites. For example, http://www.youtube.com and http://www.dailymotion.com are both videos providers: Weboob defines the “ICapVideo” capability. @@ -18,3 +21,10 @@ The core library provides base classes which help the developer to write backends and applications. Weboob is written in Python and is distributed under the GPLv3 license. + + +Bash completion +--------------- + +To enable bash completion, just source the tools/weboob_bash_completion +file from your ~/.bash_completion file (which is sourced by /etc/bash_completion). From cee58d1c2717c8a3f96c821ebc0320d7d5dfab68 Mon Sep 17 00:00:00 2001 From: Christophe Benz Date: Mon, 2 Aug 2010 11:24:15 +0200 Subject: [PATCH 2/7] comment dependencies --- setup.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/setup.py b/setup.py index d8a1b8a7..702484c8 100755 --- a/setup.py +++ b/setup.py @@ -40,20 +40,20 @@ setup( packages=find_packages(), scripts=[os.path.join('scripts', script) for script in os.listdir('scripts')], install_requires=[ - 'ClientForm', # python-clientform - 'elementtidy', # python-elementtidy - 'FeedParser', # python-feedparser - 'gdata', # python-gdata - 'html5lib', # python-html5lib - 'lxml', # python-lxml - 'Mako', # python-mako - 'mechanize', # python-mechanize - 'PIL', # python-imaging - 'PyQt', # python-qt4 - 'python-dateutil', # python-dateutil - 'PyYAML', # python-yaml - 'Routes', # python-routes - 'simplejson', # python-simplejson - 'WebOb', # python-webob + # 'ClientForm', # python-clientform + # 'elementtidy', # python-elementtidy + # 'FeedParser', # python-feedparser + # 'gdata', # python-gdata + # 'html5lib', # python-html5lib + # 'lxml', # python-lxml + # 'Mako', # python-mako + # 'mechanize', # python-mechanize + # 'PIL', # python-imaging + # 'PyQt', # python-qt4 + # 'python-dateutil', # python-dateutil + # 'PyYAML', # python-yaml + # 'Routes', # python-routes + # 'simplejson', # python-simplejson + # 'WebOb', # python-webob ], ) From 72dfd343c49e6b7b93609edb5be9cd23db9a4b52 Mon Sep 17 00:00:00 2001 From: Christophe Benz Date: Mon, 2 Aug 2010 16:34:51 +0200 Subject: [PATCH 3/7] reparent -f option to formatting options group --- weboob/tools/application/console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weboob/tools/application/console.py b/weboob/tools/application/console.py index d14c43f6..bce71236 100644 --- a/weboob/tools/application/console.py +++ b/weboob/tools/application/console.py @@ -66,11 +66,11 @@ class ConsoleApplication(BaseApplication): results_options = OptionGroup(self._parser, 'Results Options') results_options.add_option('-c', '--condition', help='filter result items to display given a boolean condition') results_options.add_option('-n', '--count', type='int', help='get a maximum number of results (all backends merged)') - results_options.add_option('-f', '--formatter', choices=formatters, help='select output formatter (%s)' % u','.join(formatters)) results_options.add_option('-s', '--select', help='select result item keys to display (comma separated)') self._parser.add_option_group(results_options) formatting_options = OptionGroup(self._parser, 'Formatting Options') + formatting_options.add_option('-f', '--formatter', choices=formatters, help='select output formatter (%s)' % u','.join(formatters)) formatting_options.add_option('--no-header', dest='no_header', action='store_true', help='do not display header') formatting_options.add_option('--no-keys', dest='no_keys', action='store_true', help='do not display item keys') self._parser.add_option_group(formatting_options) From a37e1a00181a0e81427eb03ff4a48ffb2d17583d Mon Sep 17 00:00:00 2001 From: Christophe Benz Date: Mon, 2 Aug 2010 16:35:19 +0200 Subject: [PATCH 4/7] indicate how to configure backends with qt gui --- weboob/tools/application/console.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/weboob/tools/application/console.py b/weboob/tools/application/console.py index bce71236..acd3ca2f 100644 --- a/weboob/tools/application/console.py +++ b/weboob/tools/application/console.py @@ -15,12 +15,16 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +from __future__ import with_statement + from functools import partial import getpass from inspect import getargspec import logging from optparse import OptionGroup, OptionParser import re +import subprocess import sys from weboob.core import CallErrors @@ -256,7 +260,12 @@ class ConsoleApplication(BaseApplication): caps = (caps,) caps = iter(cap.__name__ for cap in caps) weboobcfg.command_backends(*caps) - logging.error(u'You can configure a backends using the "weboob-config add" command:\nweboob-config add [options..]') + logging.error(u'You can configure backends using the "weboob-config add" command:\nweboob-config add [options..]') + with open('/dev/null', 'w') as devnull: + process = subprocess.Popen(['which', 'weboob-config-qt'], stdout=devnull) + return_code = process.wait() + if return_code == 0: + logging.error(u'You can configure backends using the "weboob-config-qt" GUI, too.') sys.exit(0) def parse_id(self, _id): From cea76a076d263033b391da1378d1092c3c4ffb69 Mon Sep 17 00:00:00 2001 From: Christophe Benz Date: Mon, 2 Aug 2010 16:35:29 +0200 Subject: [PATCH 5/7] bugfix with args --- weboob/tools/application/formatters/table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weboob/tools/application/formatters/table.py b/weboob/tools/application/formatters/table.py index 21267f52..3b74ca6f 100644 --- a/weboob/tools/application/formatters/table.py +++ b/weboob/tools/application/formatters/table.py @@ -30,7 +30,7 @@ class TableFormatter(IFormatter): header = None def __init__(self, display_keys=True, return_only=False, result_funcname='get_string'): - IFormatter.__init__(self, display_keys, return_only) + IFormatter.__init__(self, display_keys=display_keys, return_only=return_only) self.result_funcname = result_funcname def after_format(self, formatted): From d7e010e8150d7839f636690a2a34d1b0a49c1a54 Mon Sep 17 00:00:00 2001 From: Christophe Benz Date: Mon, 2 Aug 2010 16:35:59 +0200 Subject: [PATCH 6/7] ignore egg-info dirs --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c3fd7085..58478946 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ Session.vim build dist +*.egg-info From cd08025ee2ecf31246f761b3dc1c73a1db490679 Mon Sep 17 00:00:00 2001 From: Christophe Benz Date: Mon, 2 Aug 2010 16:44:41 +0200 Subject: [PATCH 7/7] bugfix with recursive func --- weboob/tools/config/iniconfig.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/weboob/tools/config/iniconfig.py b/weboob/tools/config/iniconfig.py index 61daef7f..6244f3af 100644 --- a/weboob/tools/config/iniconfig.py +++ b/weboob/tools/config/iniconfig.py @@ -38,8 +38,10 @@ class INIConfig(IConfig): def load_section(section): sections = section.split(':') if len(sections) > 1: + result = {} for s in sections: - values = load_section(s) + result[s] = load_section(s) + return result else: return {section: dict(self.config.items(section))}