Merge remote branch 'cbenz/master'

This commit is contained in:
Romain Bignon 2010-08-02 16:48:17 +02:00
commit 9189161c39
7 changed files with 61 additions and 68 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@
Session.vim Session.vim
build build
dist dist
*.egg-info

71
INSTALL
View file

@ -1,64 +1,35 @@
Weboob installation Weboob installation
=================== ===================
Like any Python package using setuptools, Weboob can be installed: Like any Python package using setuptools, Weboob can be installed in install
* from eggs mode or in development mode.
* from Debian packages
* from setup.py in install mode or in development mode
From Eggs Install mode
--------- ------------
Weboob is distributed using many packages. There is one package for the core The install mode copies files to the Python system-wide packages directory
library, many packages for backends (grouped by capabilities), and one package (for example /usr/lib/python2.5/site-packages for Python 2.5,
for each application. or /usr/local/lib/python2.6/dist-packages for Python 2.6)
To install: # ./setup.py 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.
Scripts are copied to /usr/bin. 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 To uninstall, remove the egg-link and remove the weboob_dev line in
/usr/lib/python2.5/site-packages/easy-install.pth your Python system-wide packages directory.
or /usr/local/lib/python2.6/dist-packages/easy-install.pth
Bash completion Development mode
--------------- ----------------
To enable bash completion, just source the tools/weboob_bash_completion The development mode doesn't copy files, but creates an egg-link
file from your ~/.bash_completion file (which is sourced by /etc/bash_completion). 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

10
README
View file

@ -1,5 +1,8 @@
Weboob is a project which provides a core library, backends and applications. Weboob is a project which provides a core library, backends and applications.
Overview
--------
The core library defines capabilities: features common to various websites. For The core library defines capabilities: features common to various websites. For
example, http://www.youtube.com and http://www.dailymotion.com are both videos example, http://www.youtube.com and http://www.dailymotion.com are both videos
providers: Weboob defines the “ICapVideo” capability. 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. backends and applications.
Weboob is written in Python and is distributed under the GPLv3 license. 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).

View file

@ -40,20 +40,20 @@ setup(
packages=find_packages(), packages=find_packages(),
scripts=[os.path.join('scripts', script) for script in os.listdir('scripts')], scripts=[os.path.join('scripts', script) for script in os.listdir('scripts')],
install_requires=[ install_requires=[
'ClientForm', # python-clientform # 'ClientForm', # python-clientform
'elementtidy', # python-elementtidy # 'elementtidy', # python-elementtidy
'FeedParser', # python-feedparser # 'FeedParser', # python-feedparser
'gdata', # python-gdata # 'gdata', # python-gdata
'html5lib', # python-html5lib # 'html5lib', # python-html5lib
'lxml', # python-lxml # 'lxml', # python-lxml
'Mako', # python-mako # 'Mako', # python-mako
'mechanize', # python-mechanize # 'mechanize', # python-mechanize
'PIL', # python-imaging # 'PIL', # python-imaging
'PyQt', # python-qt4 # 'PyQt', # python-qt4
'python-dateutil', # python-dateutil # 'python-dateutil', # python-dateutil
'PyYAML', # python-yaml # 'PyYAML', # python-yaml
'Routes', # python-routes # 'Routes', # python-routes
'simplejson', # python-simplejson # 'simplejson', # python-simplejson
'WebOb', # python-webob # 'WebOb', # python-webob
], ],
) )

View file

@ -15,12 +15,16 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from __future__ import with_statement
from functools import partial from functools import partial
import getpass import getpass
from inspect import getargspec from inspect import getargspec
import logging import logging
from optparse import OptionGroup, OptionParser from optparse import OptionGroup, OptionParser
import re import re
import subprocess
import sys import sys
from weboob.core import CallErrors from weboob.core import CallErrors
@ -66,11 +70,11 @@ class ConsoleApplication(BaseApplication):
results_options = OptionGroup(self._parser, 'Results Options') 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('-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('-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)') results_options.add_option('-s', '--select', help='select result item keys to display (comma separated)')
self._parser.add_option_group(results_options) self._parser.add_option_group(results_options)
formatting_options = OptionGroup(self._parser, 'Formatting 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-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') 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) self._parser.add_option_group(formatting_options)
@ -256,7 +260,12 @@ class ConsoleApplication(BaseApplication):
caps = (caps,) caps = (caps,)
caps = iter(cap.__name__ for cap in caps) caps = iter(cap.__name__ for cap in caps)
weboobcfg.command_backends(*caps) weboobcfg.command_backends(*caps)
logging.error(u'You can configure a backends using the "weboob-config add" command:\nweboob-config add <name> [options..]') logging.error(u'You can configure backends using the "weboob-config add" command:\nweboob-config add <name> [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) sys.exit(0)
def parse_id(self, _id): def parse_id(self, _id):

View file

@ -30,7 +30,7 @@ class TableFormatter(IFormatter):
header = None header = None
def __init__(self, display_keys=True, return_only=False, result_funcname='get_string'): 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 self.result_funcname = result_funcname
def after_format(self, formatted): def after_format(self, formatted):

View file

@ -38,8 +38,10 @@ class INIConfig(IConfig):
def load_section(section): def load_section(section):
sections = section.split(':') sections = section.split(':')
if len(sections) > 1: if len(sections) > 1:
result = {}
for s in sections: for s in sections:
values = load_section(s) result[s] = load_section(s)
return result
else: else:
return {section: dict(self.config.items(section))} return {section: dict(self.config.items(section))}