Commit 5f8ba6b3 authored by Owen Arnold's avatar Owen Arnold
Browse files

No git install required

Using python-gitlab to find and point to wheel instead
parent 4a64b606
......@@ -11,7 +11,7 @@ You can install from the command line using the lauch_mantid_plot executable wit
(execute and quit) option set, you can also pass a version to installation script, if not
provided it will fetch the latest wfm_stitching package.
Example:
Example on windows:
C:\\MantidInstall\\bin\\launch_mantidplot -x install_wfm_stitching.py
......@@ -23,16 +23,40 @@ import subprocess
from argparse import ArgumentParser
import os
import sys
import re
def do_wfm_stitching_install(python, required_version):
url = 'git+http://git.esss.dk/wedel/wfm_stitching.git'
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'])
import gitlab
gl = gitlab.Gitlab('https://git.esss.dk')
project = gl.projects.list(search='wfm_stitching')[0]
if required_version:
url = '{0}@{1}'.format(url, required_version)
subprocess.check_call([python, '-m' 'pip', 'install', '--user', '--upgrade', url])
tag = project.tags.get('v{0}'.format(required_version))
else:
# Get the latest tag
tag = project.tags.list(order_by='updated', sort='desc')[0]
description = tag.attributes['release']['description']
# Search for mark-down style upload in the form [link-text](upload-url) and extract upload-url
upload = re.search('\[.*\]\((.*)\)', description).group(1)
# Join with the project web url to obtain the full address
upload_url = project.attributes['web_url'] + upload
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_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', 'wfm-stitching'])
subprocess.check_call([python, '-m', 'pip', 'uninstall', '-y', 'python-gitlab'])
if __name__ == "__main__":
parser = ArgumentParser(description='Install WFM package http://git.esss.dk/wedel/wfm_sitching')
......
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