Commit b763c1f5 authored by Owen Arnold's avatar Owen Arnold
Browse files

Cleanup and add more options

parent 01b8df06
# -*- coding: utf-8 -*-
""" Script to correctly install wfm-stitching alongside Mantid.
Can either be used to install a specific wfm-stitching package version, or without modification,
will install the latest version.
You should run this script inside MantidPlot from the script window, to ensure that you are using
the same python interpreter that Mantid uses. The installation must use the same python interpreter
that mantid uses.
You can install from the command line using the lauch_mantid_plot executable with the xq (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:
C:\\MantidInstall\\bin\\launch_mantidplot -x install_wfm_stitching.py
or
C:\\MantidInstall\\bin\\launch_mantidplot -x install_wfm_stitching.py --version 0.1.0
"""
import subprocess
import argparse
import os
import sys
def do_wfm_stitching_install(python, required_version):
url = 'git+http://git.esss.dk/wedel/wfm_stitching.git'
if required_version:
url = '{0}@{1}'.format(url, 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'])
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Install WFM core package from http://git.esss.dk/wedel/wfm_sitching')
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')
args = parser.parse_args()
interpreter = os.path.join(os.path.dirname(sys.executable), 'python')
do_wfm_stitching_install(interpreter, required_version=args.version)
#do_wfm_stitching_uninstall(interpreter)
# -*- coding: utf-8 -*-
""" Script to correctly install wfm-stitching alongside Mantid.
Can either be used to install a specific wfm-stitching package version, or without modification,
will install the latest version.
You should run this script inside MantidPlot from the script window, to ensure that you are using
the same python interpreter that Mantid uses. The installation must use the same python interpreter
that mantid uses.
You can install from the command line using the lauch_mantid_plot executable with the xq
(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:
C:\\MantidInstall\\bin\\launch_mantidplot -x install_wfm_stitching.py
or
C:\\MantidInstall\\bin\\launch_mantidplot -x install_wfm_stitching.py -v v0.1.0
"""
import subprocess
from argparse import ArgumentParser
import os
import sys
def do_wfm_stitching_install(python, required_version):
url = 'git+http://git.esss.dk/wedel/wfm_stitching.git'
if required_version:
url = '{0}@{1}'.format(url, 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'])
if __name__ == "__main__":
parser = ArgumentParser(description='Install WFM package http://git.esss.dk/wedel/wfm_sitching')
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('-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')
if args.uninstall:
if args.version:
print('Warning: version argument is ignored during uninstall')
do_wfm_stitching_uninstall(interpreter)
else:
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