Commit 62b7339f authored by Laurent Bachelier's avatar Laurent Bachelier 🐧

Add --local-modules option to local_install

Also, building modules failures should not be fatal because some modules
will always be missing some dependencies.
parent a19af187
......@@ -7,7 +7,7 @@ build:2.7:
image: "python:2.7"
stage: "build"
script:
- "./tools/local_install.sh -2 ~/bin"
- "./tools/local_install.sh -2 --local-modules ~/bin"
pyflakes:2.7:
image: "python:2.7"
......@@ -45,7 +45,7 @@ build:3:
image: "python:3"
stage: "build"
script:
- "./tools/local_install.sh ~/bin"
- "./tools/local_install.sh --local-modules ~/bin"
pyflakes:3:
image: "python:3"
......
......@@ -6,8 +6,15 @@ import os
import subprocess
import sys
if '--local-modules' in sys.argv:
local_modules = True
sys.argv.remove('--local-modules')
else:
local_modules = False
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.")
......@@ -22,12 +29,25 @@ else:
print("Installing weboob applications into ‘%s’." % dest)
if local_modules:
sourceslist = os.path.join(
os.environ.get('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), '.config')),
'weboob', 'sources.list')
if not os.path.isdir(os.path.dirname(sourceslist)):
os.makedirs(os.path.dirname(sourceslist))
if not os.path.exists(sourceslist):
with open(sourceslist, 'w') as f:
f.write('file://' + os.path.realpath(
os.path.join(os.path.dirname(__file__), os.pardir, 'modules')
))
subprocess.check_call(
[sys.executable, 'setup.py',
'install', '--user', '--install-scripts=%s' % 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'])
subprocess.call([sys.executable, os.path.join(dest, 'weboob-config'), 'update'])
print()
print("Installation done. Applications are available in ‘%s’." % dest)
......
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