diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 45d022662d00aa2f544697215d678db95bc03a31..dc06ef8270eb59c418ad14599d862d240fd5d226 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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" diff --git a/tools/local_install.py b/tools/local_install.py index 80831928c7db5ff5766b849f2151688ef8f3245b..93d0b4f93a2782232873f279bca13eb8e7a41567 100644 --- a/tools/local_install.py +++ b/tools/local_install.py @@ -6,8 +6,15 @@ 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 @@ 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)