<commit_before>#!/usr/bin/env python
#
# bump-version.py
#
# Change version number in all places that contain the version number
#

import argparse
import subprocess

PROJECT_VERSION    = '0.1.0'  # Current version of the project (ViennaGrid for Python)
BOOST_VERSION      = '1.53.0' # Version of Boost used for development
VIENNAGRID_VERSION = '1.0.1'  # Version of ViennaGrid used for development

def main(project_version, boost_version, viennagrid_version):
	paths = ' '.join(['doc', 'scripts', 'test', 'viennagrid-python'])
	old_versions = [PROJECT_VERSION, BOOST_VERSION, VIENNAGRID_VERSION]
	new_versions = [project_version, boost_version, viennagrid_version]
	for old_str, new_str in zip(old_versions, new_versions):
		old_str = old_str.replace('.', '\.')
		new_str = new_str.replace('.', '\.')
		cmd = "perl -p -i -e 's/%(old_str)s/%(new_str)s/g' `ack-grep -l '%(old_str)s' %(paths)s`" % locals()
		subprocess.call(cmd, shell=True)
		cmd = "perl -p -i -e 's/%(old_str)s/%(new_str)s/g' src/wrapper.cpp" % locals()
		subprocess.call(cmd, shell=True)
		cmd = "perl -p -i -e 's/%(old_str)s/%(new_str)s/g' README.md" % locals()
		subprocess.call(cmd, shell=True)
		cmd = "perl -p -i -e 's/%(old_str)s/%(new_str)s/g' src/CMakeLists.txt" % locals()
		subprocess.call(cmd, shell=True)

if __name__ == "__main__":
	parser = argparse.ArgumentParser()
	parser.add_argument('project_version', help='version number of the next release of ViennaGrid for Python')
	parser.add_argument('boost_version', help='ViennaGrid version number to be used', nargs='?', default=BOOST_VERSION)
	parser.add_argument('viennagrid_version', help='Boost version number to be used', nargs='?', default=VIENNAGRID_VERSION)
	
	args = parser.parse_args()
	
	main(args.project_version, args.boost_version, args.viennagrid_version)<commit_msg>Fix 'bump_version.py' to replace both the release number (MAJOR.MINOR.BUGFIX) and the version number (MAJOR.MINOR).<commit_after>#!/usr/bin/env python
#
# bump-version.py
#
# Change version number in all places that contain the version number
#

import argparse
import subprocess

PROJECT_VERSION    = '0.1.0'  # Current version of the project (ViennaGrid for Python)
BOOST_VERSION      = '1.53.0' # Version of Boost used for development
VIENNAGRID_VERSION = '1.0.1'  # Version of ViennaGrid used for development

def main(project_version, boost_version, viennagrid_version):
	paths = ' '.join(['doc', 'scripts', 'test', 'viennagrid-python'])
	old_version_short = '.'.join(PROJECT_VERSION.split('.')[0:2])
	new_version_short = '.'.join(project_version.split('.')[0:2])
	old_versions = [PROJECT_VERSION, BOOST_VERSION, VIENNAGRID_VERSION, old_version_short]
	new_versions = [project_version, boost_version, viennagrid_version, new_version_short]
	for old_str, new_str in zip(old_versions, new_versions):
		old_str = old_str.replace('.', '\.')
		new_str = new_str.replace('.', '\.')
		cmd = "perl -p -i -e 's/%(old_str)s/%(new_str)s/g' `ack-grep -l '%(old_str)s' %(paths)s`" % locals()
		subprocess.call(cmd, shell=True)
		cmd = "perl -p -i -e 's/%(old_str)s/%(new_str)s/g' src/wrapper.cpp" % locals()
		subprocess.call(cmd, shell=True)
		cmd = "perl -p -i -e 's/%(old_str)s/%(new_str)s/g' README.md" % locals()
		subprocess.call(cmd, shell=True)
		cmd = "perl -p -i -e 's/%(old_str)s/%(new_str)s/g' src/CMakeLists.txt" % locals()
		subprocess.call(cmd, shell=True)

if __name__ == "__main__":
	parser = argparse.ArgumentParser()
	parser.add_argument('project_version', help='version number of the next release of ViennaGrid for Python')
	parser.add_argument('boost_version', help='ViennaGrid version number to be used', nargs='?', default=BOOST_VERSION)
	parser.add_argument('viennagrid_version', help='Boost version number to be used', nargs='?', default=VIENNAGRID_VERSION)
	
	args = parser.parse_args()
	
	main(args.project_version, args.boost_version, args.viennagrid_version)
{'fraction_non_alphanumeric': 0.1539054470709147, 'fraction_numerical': 0.006166495375128468, 'mean_word_length': 5.2288, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4518195', 'n_tokens_mistral': 1477, 'n_tokens_neox': 1408, 'n_words': 324}