irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

get_irods_version.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 from __future__ import print_function
3 
4 from functools import reduce
5 import sys
6 
7 from irods.configuration import IrodsConfig
8 
9 def usage():
10  print('Usage: get_irods_version.py ["string"|"integer"|"major"|"minor"|"patchlevel"]')
11 
12 # check parameters
13 if len(sys.argv) != 2:
14  usage()
15  sys.exit(1)
16 
17 operations = {}
18 operations['string'] = lambda x: x
19 operations['integer'] = lambda x: reduce(lambda y, z: y*1000 + int(z), x.split('.'), 0)
20 operations['major'] = lambda x: int(x.split('.')[0])
21 operations['minor'] = lambda x: int(x.split('.')[1])
22 operations['patchlevel'] = lambda x: int(x.split('.')[2])
23 
24 # read version from VERSION.json
25 version_string = IrodsConfig().version['irods_version']
26 try :
27  value = operations[sys.argv[1]](version_string)
28 except KeyError:
29  print('ERROR: unknown format [%s] requested' % sys.argv[1], file=sys.stderr)
30  usage()
31  sys.exit(1)
32 
33 print(value)
irods.configuration.IrodsConfig
Definition: configuration.py:22
irods.configuration
Definition: configuration.py:1
get_irods_version.usage
def usage()
Definition: get_irods_version.py:9
int
typedef int((*funcPtr)())