/usr/bin/catkin_package_version is in catkin 0.6.16-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #!/usr/bin/python
from __future__ import print_function
import argparse
import os
import sys
from catkin_pkg.package_version import bump_version
from catkin_pkg.packages import find_packages, verify_equal_package_versions
# find the import relatively if available to work before installing catkin or overlaying installed version
if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'python', 'catkin', '__init__.py')):
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python'))
from catkin.package_version import update_versions
def main():
parser = argparse.ArgumentParser(description='Show or bump the version number in package.xml files.')
parser.add_argument('path', nargs='?', default='.', help='The path to a parent folder which contains package.xml files (default: .)')
parser.add_argument('--bump', choices=('major', 'minor', 'patch'), help='Which part of the version number to bump?')
args = parser.parse_args()
try:
packages = find_packages(args.path)
if not packages:
print('No packages found', file=sys.stderr)
sys.exit(1)
version = verify_equal_package_versions(packages.values())
# only print the version number
if args.bump is None:
print(version)
else:
# bump the version number
new_version = bump_version(version, args.bump)
update_versions(packages.keys(), new_version)
print('%s -> %s' % (version, new_version))
except Exception as e:
sys.exit(str(e))
if __name__ == '__main__':
main()
|