Skip to content

Commit bc065c6

Browse files
committed
Merge pull request #10 from torbjoernk/feature/set-version
cmake: make set_version more robust against insufficient python versions
2 parents 194f50c + 7527fe9 commit bc065c6

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,9 @@ message(STATUS "****************************************************************
155155
message(STATUS "Configuring sources")
156156
update_site_config()
157157

158+
find_package(PythonInterp REQUIRED)
158159
add_custom_target(set_version ALL
159-
COMMAND ${pfasst_SOURCE_DIR}/tools/get_pfasst_version.py
160+
COMMAND ${PYTHON_EXECUTABLE} ${pfasst_SOURCE_DIR}/tools/get_pfasst_version.py
160161
WORKING_DIRECTORY ${pfasst_SOURCE_DIR}
161162
COMMENT "Updating PFASST++ version number"
162163
USES_TERMINAL

tools/get_pfasst_version.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
#!/usr/bin/env python
2-
#
3-
#
4-
#
1+
# encoding: utf-8
2+
3+
from __future__ import print_function
4+
5+
from sys import version_info
6+
7+
if version_info[0] == 2 and version_info[1] < 7:
8+
raise SystemExit("Insufficient Python Interpreter Version (%s < 2.7)" % (version_info,))
59

610
import re
711
import subprocess
@@ -25,3 +29,6 @@
2529
if config != new_config:
2630
with open(site_config, 'w') as f:
2731
f.write(new_config)
32+
print("PFASST++ version set to: %s" % (version,))
33+
else:
34+
print("PFASST++ version did not change (still %s)" % (version,))

0 commit comments

Comments
 (0)