Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michael Wedel
wfm_stitching
Commits
5f8ba6b3
Commit
5f8ba6b3
authored
Jul 06, 2018
by
Owen Arnold
Browse files
No git install required
Using python-gitlab to find and point to wheel instead
parent
4a64b606
Changes
1
Hide whitespace changes
Inline
Side-by-side
install_wfm_stitching.py
View file @
5f8ba6b3
...
...
@@ -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'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment