local_install.py 1.28 KB
Newer Older
1 2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
3 4
from __future__ import print_function

5
import os
6 7 8
import subprocess
import sys

9 10
print("Weboob local installer")
print()
11
if len(sys.argv) < 2:
12 13 14
    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()
15
    print("Usage: %s DESTINATION" % sys.argv[0])
16
    print()
17 18
    print("Error: Please provide a destination, "
          "for example ‘%s/bin’" % os.getenv('HOME'), file=sys.stderr)
19 20 21 22
    sys.exit(1)
else:
    dest = os.path.expanduser(sys.argv[1])

23
print("Installing weboob applications into ‘%s’." % dest)
24

25 26
subprocess.check_call(
    [sys.executable, 'setup.py',
27
        'install', '--user', '--install-scripts=%s' % dest] + sys.argv[2:],
28 29 30 31
    cwd=os.path.join(os.path.dirname(__file__), os.pardir))

subprocess.check_call([sys.executable, os.path.join(dest, 'weboob-config'), 'update'])

32 33 34 35 36 37 38 39
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.")