Commit 64119bc0 authored by Laurent Bachelier's avatar Laurent Bachelier 🐧 Committed by Florent Fourcot

Add local_install / local_run tools

parent d8c30e6a
Weboob installation
===================
Like any Python package using setuptools, Weboob can be installed in install
mode or in development mode.
Using the packages provided by your distribution is recommended.
See http://weboob.org/install for a list of available packages.
Since there are many dependencies, when you install from sources,
you have to handle them by hand, according to your distribution.
Install mode
------------
The requirements are provided in ``setup.py``, except for:
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)
* gpgv (for secure updates). If not packaged alone, it should be in ``gnupg`` or ``gpg``.
* PyQt4 (python-qt4) for graphical applications.
* For more performance, ensure you have ``libyaml`` and ``simplejson`` installed.
# python setup.py install
Some modules may have more dependencies.
Scripts are copied to /usr/bin.
All installation procedures allow you to chose wether you want graphical applications.
Add ``--no-qt --no-xdg`` to disable them; ``--qt --xdg`` to enable them.
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
After a package or system installation,
you should run ``weboob-config update`` as your login user.
To uninstall, remove the egg-info from the Python system-wide packages directory
and remove the weboob_dev line in easy-install.pth.
User installation
-----------------
There is a way to install weboob locally without messing with your system.
Run ./tools/local_install.sh as your local user. ::
Development mode
----------------
$ ./tools/local_install.sh ~/bin
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.
The scripts are copied to ``~/bin``.
# python setup.py develop
System insallation (discouraged)
--------------------------------
Scripts are copied to /usr/bin too.
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). ::
# ./setup.py install
Scripts are copied to ``/usr/bin``.
Development mode
----------------
To uninstall, remove the egg-link from the Python system-wide packages directory
and remove the weboob_dev line in easy-install.pth.
This does not actually install anything, but lets you run Weboob from the source code,
while also using the modules from that source. This is only recommended if using
the git source and not a release. ::
It is possible to install in a specific directory, and it does not need root privileges. For instance:
$ ./tools/local_run.sh APPLICATION COMMANDS
$ mkdir ~/mydir
$ PYTHONPATH=~/mydir python setup.py develop --install-dir ~/mydir
For example, instead of running ``videoob -b youtube search plop``, you would run::
That way, the only altered directory is the one you chose earlier.
$ ./tools/local_run.sh videoob -b youtube search plop
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import sys
import os
print "Weboob local installer"
print
if len(sys.argv) < 2:
print "This tool will install Weboob to be usuable without requiring"
print "messing with your system, which should only be touched by a package manager."
print
print "Usage: %s DESTINATION" % sys.argv[0]
print
print >>sys.stderr, "Error: Please provide a destination, " \
"for example ‘%s/bin’" % os.getenv('HOME')
sys.exit(1)
else:
dest = os.path.expanduser(sys.argv[1])
print "Installing weboob applications into ‘%s’." % dest
subprocess.check_call(
[sys.executable, 'setup.py',
'install', '--user', '--install-scripts', dest] + sys.argv[2:],
cwd=os.path.join(os.path.dirname(__file__), os.pardir))
subprocess.check_call([sys.executable, os.path.join(dest, 'weboob-config'), 'update'])
print
print "Installation done. Applications are available in ‘%s’." % dest
print "You can remove the source files."
print
print "To have easy access to the Weboob applications,"
print "you should add the following line to your ~/.bashrc or ~/.zshrc file:"
print "export PATH=\"$PATH:%s\"" % dest
print "And then restart your shells."
#!/bin/sh
set -e
if [ -z "${PYTHON}" ]; then
which python >/dev/null 2>&1 && PYTHON=$(which python)
which python2 >/dev/null 2>&1 && PYTHON=$(which python2)
which python2.7 >/dev/null 2>&1 && PYTHON=$(which python2.7)
fi
exec "${PYTHON}" "$(dirname $0)/local_install.py" "$@"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import sys
import os
import shutil
if len(sys.argv) < 2:
print "Usage: %s SCRIPTNAME [args]" % sys.argv[0]
sys.exit(1)
else:
script = sys.argv[1]
args = sys.argv[2:]
project = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
wd = os.path.join(project, 'localconfig')
if not os.path.isdir(wd):
os.path.makedirs(wd)
env = os.environ.copy()
env['PYTHONPATH'] = project
env['WEBOOB_WORKDIR'] = wd
shutil.copyfile(
os.path.expanduser('~/.config/weboob/backends'),
os.path.join(project, wd, 'backends'))
with open(os.path.join(wd, 'sources.list'), 'w') as f:
f.write("file://%s\n" % os.path.join(project, 'modules'))
# Hide output unless there is an error
p = subprocess.Popen(
[sys.executable, os.path.join(project, 'scripts', 'weboob-config'), 'update'],
env=env,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
s = p.communicate()
if p.returncode != 0:
print s[0]
sys.exit(p.returncode)
os.execvpe(
sys.executable,
['-Wall', os.path.join(project, 'scripts', script)] + args,
env)
#!/bin/sh
set -e
if [ -z "${PYTHON}" ]; then
which python >/dev/null 2>&1 && PYTHON=$(which python)
which python2 >/dev/null 2>&1 && PYTHON=$(which python2)
which python2.7 >/dev/null 2>&1 && PYTHON=$(which python2.7)
fi
exec "${PYTHON}" "$(dirname $0)/local_run.py" "$@"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment