Skip to content

Commit 368743d

Browse files
committed
itkVersion.py: Package version uses .devYYYYMMDD and no '+'
GitHub Releases do not support the '+' character in filenames.
1 parent b2f29e9 commit 368743d

4 files changed

Lines changed: 40 additions & 10 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ if(ITKPythonPackage_SUPERBUILD)
4949
include(ExternalProject)
5050

5151
set(ITK_REPOSITORY "https://github.com/InsightSoftwareConsortium/ITK.git")
52-
# ITK nightly-master 2017-02-08
53-
set(ITK_GIT_TAG "922f2d9")
52+
# ITK nightly-master 2017-02-09
53+
set(ITK_GIT_TAG "3fe1126")
5454

5555
# Add an empty external project
5656
function(itk_ExternalProject_Add_Empty proj depends)

‎itkVersion.py‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
1-
VERSION = '4.11.0.dev139+20170208.g922f2d9'
1+
VERSION = '4.11.0.dev20170209+149.g3fe1126'
2+
3+
def get_versions():
4+
"""Returns versions for the ITK Python package.
5+
6+
from itkVersion import get_versions
7+
8+
# Returns the ITK repository version
9+
get_versions()['version']
10+
11+
# Returns the package version. Since GitHub Releases do not support the '+'
12+
# character in file names, this does not contain the local version
13+
# identifier in nightly builds, i.e.
14+
#
15+
# '4.11.0.dev20170208'
16+
#
17+
# instead of
18+
#
19+
# '4.11.0.dev20170208+139.g922f2d9'
20+
get_versions()['package-version']
21+
"""
22+
versions = {}
23+
versions['version'] = VERSION
24+
versions['package-version'] = VERSION.split('+')[0]
25+
return versions

‎scripts/update_python_version.py‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
pythonRevision = version
5151
if int(numberOfCommits) > 0:
5252
pythonRevision += '.dev'
53-
pythonRevision += numberOfCommits
54-
pythonRevision += '+'
5553
pythonRevision += commitDate
54+
pythonRevision += '+'
55+
pythonRevision += numberOfCommits
5656
pythonRevision += '.'
5757
pythonRevision += gHash
5858

@@ -61,10 +61,16 @@
6161
if not os.path.exists(itkVersionPath):
6262
print('Expected file ' + itkVersionPath + ' not found!')
6363
sys.exit(1)
64+
with open(itkVersionPath, 'r') as fp:
65+
lines = fp.readlines()
6466
with open(itkVersionPath, 'w') as fp:
65-
fp.write("VERSION = '")
66-
fp.write(pythonRevision)
67-
fp.write("'\n")
67+
for line in lines:
68+
if line.startswith('VERSION = '):
69+
fp.write("VERSION = '")
70+
fp.write(pythonRevision)
71+
fp.write("'\n")
72+
else:
73+
fp.write(line)
6874

6975

7076
with open('CMakeLists.txt', 'r') as fp:

‎setup.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from skbuild import setup
44

55
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
6-
from itkVersion import VERSION
6+
from itkVersion import get_versions
77

88
setup(
99
name='itk',
10-
version=VERSION,
10+
version=get_versions()['package-version'],
1111
author='Insight Software Consortium',
1212
author_email='community@itk.org',
1313
packages=['itk'],

0 commit comments

Comments
 (0)