File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- VERSION = "6.0b1"
1+ from packaging . version import Version
22
3+ # Version needs to be python PEP 440 compliant (no leading v)
4+ VERSION = '6.0b1' .removeprefix ("v" )
35
46def get_versions ():
57 """Returns versions for the ITK Python package.
@@ -20,7 +22,10 @@ def get_versions():
2022 # '4.11.0.dev20170208+139.g922f2d9'
2123 get_versions()['package-version']
2224 """
25+
26+ Version (VERSION ) # Raise InvalidVersion exception if not PEP 440 compliant
27+
2328 versions = {}
24- versions [" version" ] = VERSION
25- versions [" package-version" ] = VERSION .split ("+" )[0 ]
29+ versions [' version' ] = VERSION
30+ versions [' package-version' ] = VERSION .split ('+' )[0 ]
2631 return versions
Original file line number Diff line number Diff line change 88import os
99import subprocess
1010from datetime import datetime
11+ from packaging .version import Version
1112
1213argparser = argparse .ArgumentParser (description = __doc__ )
1314argparser .add_argument ("itkSourceDir" )
6162
6263os .chdir (itkPythonPackageDir )
6364itkVersionPath = os .path .join (itkPythonPackageDir , "itkVersion.py" )
65+
66+ Version (VERSION ) # Raise InvalidVersion exception if not PEP 440 compliant
67+
6468if not os .path .exists (itkVersionPath ):
6569 print ("Expected file " + itkVersionPath + " not found!" )
6670 sys .exit (1 )
You can’t perform that action at this time.
0 commit comments