Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
b1e51c76
Commit
b1e51c76
authored
8 years ago
by
LINJIAO email
Browse files
Options
Downloads
Patches
Plain Diff
Refs #17237. use cmake macro for git_rev and detect no-change
parent
249f6f10
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
buildconfig/CMake/conda-update-recipe.py.in
+31
-23
31 additions, 23 deletions
buildconfig/CMake/conda-update-recipe.py.in
with
31 additions
and
23 deletions
buildconfig/CMake/conda-update-recipe.py.in
+
31
−
23
View file @
b1e51c76
# -*- Python -*-
# -*- Python -*-
version = "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@"
version = "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@"
git_rev = "@MtdVersion_WC_LAST_CHANGED_SHA_LONG@"
import subprocess as sp, shlex, os
import subprocess as sp, shlex, os
git_rev = sp.check_output("git rev-parse HEAD".split(),
cwd="@CMAKE_SOURCE_DIR@").strip()
# checkout recipe
def main():
if not os.path.exists('conda-recipes'):
# checkout recipe
cmd = 'git clone git@github.com:mantidproject/conda-recipes'
if not os.path.exists('conda-recipes'):
sp.check_call(cmd.split())
cmd = 'git clone git@github.com:mantidproject/conda-recipes'
else:
sp.check_call(cmd.split())
cmd = 'git pull'
else:
sp.check_call(cmd.split(), cwd='conda-recipes')
cmd = 'git pull'
sp.check_call(cmd.split(), cwd='conda-recipes')
# change framework meta.yaml
# change framework meta.yaml
path = 'conda-recipes/framework/meta.yaml'
path = 'conda-recipes/framework/meta.yaml'
header = []
header = []
header.append('{% set version = "' + '%s' % version + '" %}')
header.append('{% set version = "' + '%s' % version + '" %}')
header.append('{% set git_rev = "' + '%s' % git_rev + '" %}')
header.append('{% set git_rev = "' + '%s' % git_rev + '" %}')
body = open(path, 'rt').read().split('\n')
content = open(path, 'rt').read().split('\n')
body = body[2:]
old_header = content[:2]
open(path, 'wt').write('\n'.join(header+body))
body = content[2:]
# if nothing changed just exit
if header == old_header:
print "Nothing changed. Skipping."
return
open(path, 'wt').write('\n'.join(header+body))
# commit
# commit
cmd = 'git commit -m "update version and git_rev" framework/meta.yaml'
cmd = 'git commit -m "update version and git_rev" framework/meta.yaml'
sp.check_call(shlex.split(cmd), cwd="conda-recipes")
sp.check_call(shlex.split(cmd), cwd="conda-recipes")
# push
# push
cmd = 'git push'
cmd = 'git push'
sp.check_call(cmd.split(), cwd="conda-recipes")
sp.check_call(cmd.split(), cwd="conda-recipes")
return
if __name__ == '__main__': main()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment