Commit 34c8e0c7 authored by Owen Arnold's avatar Owen Arnold
Browse files

Merge branch 'no_git_install' into 'master'

Cannot use pip url that requires VCS git

See merge request !7
parents 4a64b606 cfee1dff
......@@ -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 on windows:
C:\\MantidInstall\\bin\\launch_mantidplot -x
......@@ -23,22 +23,46 @@ import subprocess
from argparse import ArgumentParser
import os
import sys
import re
def do_wfm_stitching_install(python, required_version):
url = 'git+'
def extract_upload_url(python, required_version=None):
""" From gitlab project releases fetch the download url for the release matching the tag
import gitlab
except ImportError:
subprocess.check_call([python, '-m', 'pip', 'install', '--upgrade', '--user', 'python-gitlab'])
import gitlab
gl = gitlab.Gitlab('')
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(required_version)
# 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 ='\[.*\]\((.*)\)', 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')
parser.add_argument('-v', '--version', default=None,
help='optionally specify the version you wish to use i.e. v0.1.2.'
'Defaults to latest version. Version must match git tag version.')
parser.add_argument('-v', '--version', default='v0.1.0',
help='Specify the version you wish to use i.e. v0.1.2.'
'Defaults to version v0.1.0. Version must match git tag version.')
parser.add_argument('-u', '--uninstall', action='store_true', default=False, help='uninstall any existing wfm-stitching package')
args = parser.parse_args()
interpreter = os.path.join(os.path.dirname(sys.executable), 'python')
......@@ -47,4 +47,12 @@ If this works without issue then, skip forward to the installation of wfm-stitch
On OSX this would be done via `export PYTHONPATH=/Applications/`, or on linux via `export PYTHONPATH=/opt/Mantid/bin`. After doing this, recheck that the mantid modules are in the python path via `/usr/bin/python -c "import mantid"``, which should produce no error.
### Astropy caveat and versioning
Astropy, the up-to-date pacakge for loading fits files, [does not install cleanly]( via pip without a c++ compiler. While we work around this issue, the default will be to install `v0.1.0` (see tags) of the WFM stitching package, which depends on the deprecated [pyfits]( package. Note that you will see this warning at present, but it should not cause alarm.
```PyFITS is deprecated, please use PyFITSDeprecationWarning```
If you want to use astropy, instead and have a suitable environement to support it, you can install it by using `v0.1.2` of this package, which you can pass as a command line argument (`-v`) to the [installation script](
Supports Markdown
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