Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository 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
schwede
openstructure
Commits
d3358d50
Commit
d3358d50
authored
5 years ago
by
Gerardo Tauriello
Browse files
Options
Downloads
Patches
Plain Diff
SCHWED-4329: fix version bumping script.
parent
35c3954a
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
scripts/bump-version.py
+46
-18
46 additions, 18 deletions
scripts/bump-version.py
with
46 additions
and
18 deletions
scripts/bump-version.py
+
46
−
18
View file @
d3358d50
#!/usr/bin/env python
import
sys
out
=
[]
version
=
sys
.
argv
[
1
].
split
(
'
.
'
)
if
len
(
version
)
==
2
:
major
,
minor
,
patch
=
(
int
(
version
[
0
]),
int
(
version
[
1
]),
0
)
import
sys
,
fileinput
if
len
(
sys
.
argv
)
<
2
:
print
"
USAGE: python scripts/bump-version.py OST_VERSION
"
print
"
-> OST_VERSION is MAJOR.MINOR.PATCH (e.g. 1.9.1)
"
print
"
-> assumption is that a git tag OST_VERSION will exist
"
sys
.
exit
(
1
)
# split up version number
version_string
=
sys
.
argv
[
1
]
version
=
version_string
.
split
(
'
.
'
)
if
len
(
version
)
==
2
:
major
,
minor
,
patch
=
(
int
(
version
[
0
]),
int
(
version
[
1
]),
0
)
version_string
+=
"
.0
"
else
:
major
,
minor
,
patch
=
(
int
(
version
[
0
]),
int
(
version
[
1
]),
int
(
version
[
2
]))
for
line
in
open
(
'
modules/config/version.hh
'
):
if
line
.
startswith
(
'
#define OST_VERSION_MAJOR
'
):
out
.
append
(
'
#define OST_VERSION_MAJOR %d
\n
'
%
major
)
elif
line
.
startswith
(
'
#define OST_VERSION_MINOR
'
):
out
.
append
(
'
#define OST_VERSION_MINOR %d
\n
'
%
minor
)
elif
line
.
startswith
(
'
#define OST_VERSION_PATCH
'
):
out
.
append
(
'
#define OST_VERSION_PATCH %d
\n
'
%
patch
)
elif
line
.
startswith
(
"
#define OST_VERSION_STRING
"
):
out
.
append
(
'
#define OST_VERSION_STRING
"
%d.%d.%d
"
\n
'
%
(
major
,
minor
,
patch
))
else
:
out
.
append
(
line
)
major
,
minor
,
patch
=
(
int
(
version
[
0
]),
int
(
version
[
1
]),
int
(
version
[
2
]))
# fix CMakeLists
lines
=
open
(
"
CMakeLists.txt
"
).
readlines
()
for
i
,
line
in
enumerate
(
lines
):
if
line
.
startswith
(
"
set (OST_VERSION_MAJOR
"
):
lines
[
i
]
=
"
set (OST_VERSION_MAJOR %d)
\n
"
%
major
elif
line
.
startswith
(
"
set (OST_VERSION_MINOR
"
):
lines
[
i
]
=
"
set (OST_VERSION_MINOR %d)
\n
"
%
minor
elif
line
.
startswith
(
"
set (OST_VERSION_PATCH
"
):
lines
[
i
]
=
"
set (OST_VERSION_PATCH %d)
\n
"
%
patch
open
(
"
CMakeLists.txt
"
,
"
w
"
).
writelines
(
lines
)
# fix CHANGELOG
lines
=
open
(
"
CHANGELOG.txt
"
).
readlines
()
for
i
,
line
in
enumerate
(
lines
):
if
line
.
startswith
(
"
Changes in Release
"
)
and
"
X
"
in
line
.
upper
():
lines
[
i
]
=
"
Changes in Release %s
\n
"
%
version_string
open
(
"
CHANGELOG.txt
"
,
"
w
"
).
writelines
(
lines
)
# fix Docker recipe
lines
=
open
(
"
docker/Dockerfile
"
).
readlines
()
for
i
,
line
in
enumerate
(
lines
):
if
line
.
startswith
(
"
ARG OPENSTRUCTURE_VERSION
"
):
lines
[
i
]
=
'
ARG OPENSTRUCTURE_VERSION=
"
%s
"
\n
'
%
version_string
open
(
"
docker/Dockerfile
"
,
"
w
"
).
writelines
(
lines
)
open
(
'
modules/config/version.hh
'
,
'
w
'
).
write
(
''
.
join
(
out
))
\ No newline at end of file
# fix Singularity recipe
lines
=
open
(
"
singularity/Singularity
"
).
readlines
()
for
i
,
line
in
enumerate
(
lines
):
if
line
.
startswith
(
"
export OPENSTRUCTURE_VERSION=
"
):
lines
[
i
]
=
'
export OPENSTRUCTURE_VERSION=
"
%s
"
\n
'
%
version_string
open
(
"
singularity/Singularity
"
,
"
w
"
).
writelines
(
lines
)
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