@@ -0,0 +1,2133 @@
+#!/usr/bin/env python%0A# Copyright 2014 the V8 project authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0A%22%22%22%0AScript to set v8's version file to the version given by the latest tag.%0A%22%22%22%0A%0A%0Aimport os%0Aimport re%0Aimport subprocess%0Aimport sys%0A%0A%0ACWD = os.path.abspath(%0A    os.path.dirname(os.path.dirname(os.path.dirname(__file__))))%0AVERSION_CC = os.path.join(CWD, %22src%22, %22version.cc%22)%0A%0Adef main():%0A  tag = subprocess.check_output(%0A      %22git describe --tags%22,%0A      shell=True,%0A      cwd=CWD,%0A  ).strip()%0A  assert tag%0A%0A  # Check for commits not exactly matching a tag. Those are candidate builds%0A  # for the next version. The output has the form%0A  # %3Ctag name%3E-%3Cn commits%3E-%3Chash%3E.%0A  if %22-%22 in tag:%0A    version = tag.split(%22-%22)%5B0%5D%0A    candidate = %221%22%0A  else:%0A    version = tag%0A    candidate = %220%22%0A  version_levels = version.split(%22.%22)%0A%0A  # Set default patch level if none is given.%0A  if len(version_levels) == 3:%0A    version_levels.append(%220%22)%0A  assert len(version_levels) == 4%0A%0A  major, minor, build, patch = version_levels%0A%0A  # Increment build level for candidate builds.%0A  if candidate == %221%22:%0A    build = str(int(build) + 1)%0A    patch = %220%22%0A%0A  # Modify version.cc with the new values.%0A  with open(VERSION_CC, %22r%22) as f:%0A    text = f.read()%0A  output = %5B%5D%0A  for line in text.split(%22%5Cn%22):%0A    for definition, substitute in (%0A        (%22MAJOR_VERSION%22, major),%0A        (%22MINOR_VERSION%22, minor),%0A        (%22BUILD_NUMBER%22, build),%0A        (%22PATCH_LEVEL%22, patch),%0A        (%22IS_CANDIDATE_VERSION%22, candidate)):%0A      if line.startswith(%22#define %25s%22 %25 definition):%0A        line =  re.sub(%22%5Cd+$%22, substitute, line)%0A    output.append(line)%0A  with open(VERSION_CC, %22w%22) as f:%0A    f.write(%22%5Cn%22.join(output))%0A%0A  # Log what was done.%0A  candidate_txt = %22 (candidate)%22 if candidate == %221%22 else %22%22%0A  patch_txt = %22.%25s%22 %25 patch if patch != %220%22 else %22%22%0A  version_txt = (%22%25s.%25s.%25s%25s%25s%22 %25%0A                 (major, minor, build, patch_txt, candidate_txt))%0A  print %22Modified version.cc. Set V8 version to %25s%22 %25  version_txt%0A  return 0%0A%0Aif __name__ == %22__main__%22:%0A  sys.exit(main())%0A

Add script to generate the v8 version.