Add local_install / local_run tools
This commit is contained in:
parent
d8c30e6a96
commit
64119bc03f
5 changed files with 137 additions and 28 deletions
73
INSTALL
73
INSTALL
|
|
@ -1,47 +1,56 @@
|
||||||
Weboob installation
|
Weboob installation
|
||||||
===================
|
===================
|
||||||
|
|
||||||
Like any Python package using setuptools, Weboob can be installed in install
|
Using the packages provided by your distribution is recommended.
|
||||||
mode or in development mode.
|
See http://weboob.org/install for a list of available packages.
|
||||||
|
|
||||||
|
|
||||||
Install mode
|
|
||||||
------------
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
# python setup.py install
|
|
||||||
|
|
||||||
Scripts are copied to /usr/bin.
|
|
||||||
|
|
||||||
Since there are many dependencies, when you install from sources,
|
Since there are many dependencies, when you install from sources,
|
||||||
you have to handle them by hand, according to your distribution.
|
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-info from the Python system-wide packages directory
|
The requirements are provided in ``setup.py``, except for:
|
||||||
and remove the weboob_dev line in easy-install.pth.
|
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
Some modules may have more dependencies.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
After a package or system installation,
|
||||||
|
you should run ``weboob-config update`` as your login user.
|
||||||
|
|
||||||
|
User installation
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
There is a way to install weboob locally without messing with your system.
|
||||||
|
Run ./tools/local_install.sh as your local user. ::
|
||||||
|
|
||||||
|
$ ./tools/local_install.sh ~/bin
|
||||||
|
|
||||||
|
The scripts are copied to ``~/bin``.
|
||||||
|
|
||||||
|
System insallation (discouraged)
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
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
|
Development mode
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
The development mode doesn't copy files, but creates an egg-link
|
This does not actually install anything, but lets you run Weboob from the source code,
|
||||||
in the Python system-wide packages directory which points to the development
|
while also using the modules from that source. This is only recommended if using
|
||||||
directory. It is useful for development when files often change.
|
the git source and not a release. ::
|
||||||
|
|
||||||
# python setup.py develop
|
$ ./tools/local_run.sh APPLICATION COMMANDS
|
||||||
|
|
||||||
Scripts are copied to /usr/bin too.
|
For example, instead of running ``videoob -b youtube search plop``, you would run::
|
||||||
|
|
||||||
To uninstall, remove the egg-link from the Python system-wide packages directory
|
$ ./tools/local_run.sh videoob -b youtube search plop
|
||||||
and remove the weboob_dev line in easy-install.pth.
|
|
||||||
|
|
||||||
It is possible to install in a specific directory, and it does not need root privileges. For instance:
|
|
||||||
|
|
||||||
$ mkdir ~/mydir
|
|
||||||
$ PYTHONPATH=~/mydir python setup.py develop --install-dir ~/mydir
|
|
||||||
|
|
||||||
That way, the only altered directory is the one you chose earlier.
|
|
||||||
|
|
|
||||||
36
tools/local_install.py
Normal file
36
tools/local_install.py
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/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."
|
||||||
10
tools/local_install.sh
Executable file
10
tools/local_install.sh
Executable file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/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" "$@"
|
||||||
44
tools/local_run.py
Normal file
44
tools/local_run.py
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
#!/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)
|
||||||
10
tools/local_run.sh
Executable file
10
tools/local_run.sh
Executable file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/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" "$@"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue