Commit 7a705ecc authored by Owen Arnold's avatar Owen Arnold
Browse files

Print command attempted

This will help diagnosing issues on user machines
parent 34c8e0c7
......@@ -25,13 +25,17 @@ import os
import sys
import re
def extract_upload_url(python, required_version=None):
def _run_subprocess(cmd):
print('attempting to run {0}'.format(' '.join(cmd)))
subprocess.check_call(cmd)
def _extract_upload_url(python, required_version=None):
""" From gitlab project releases fetch the download url for the release matching the tag
"""
try:
import gitlab
except ImportError:
subprocess.check_call([python, '-m', 'pip', 'install', '--upgrade', '--user', 'python-gitlab'])
_run_subprocess([python, '-m', 'pip', 'install', '--upgrade', '--user', 'python-gitlab'])
import gitlab
gl = gitlab.Gitlab('https://git.esss.dk')
......@@ -49,14 +53,14 @@ def extract_upload_url(python, required_version=None):
return upload_url
def do_wfm_stitching_install(python, required_version):
url = extract_upload_url(python, required_version)
subprocess.check_call([python, '-m', 'pip', 'install', '--user', '--upgrade', url])
def _do_wfm_stitching_install(python, required_version):
url = _extract_upload_url(python, required_version)
_run_subprocess([python, '-m', 'pip', 'install', '--user', '--upgrade', url])
def do_wfm_stitching_uninstall(python):
def _do_wfm_stitching_uninstall(python):
"""Convenience function to allow the removal of the wfm-stitching package"""
subprocess.check_call([python, '-m', 'pip', 'uninstall', '-y', 'wfm_stitching'])
subprocess.check_call([python, '-m', 'pip', 'uninstall', '-y', 'python-gitlab'])
_run_subprocess([python, '-m', 'pip', 'uninstall', '-y', 'wfm_stitching'])
_run_subprocess([python, '-m', 'pip', 'uninstall', '-y', 'python-gitlab'])
if __name__ == "__main__":
parser = ArgumentParser(description='Install WFM package http://git.esss.dk/wedel/wfm_sitching')
......@@ -69,6 +73,6 @@ if __name__ == "__main__":
if args.uninstall:
if args.version:
print('Warning: version argument is ignored during uninstall')
do_wfm_stitching_uninstall(interpreter)
_do_wfm_stitching_uninstall(interpreter)
else:
do_wfm_stitching_install(interpreter, required_version=args.version)
_do_wfm_stitching_install(interpreter, required_version=args.version)
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