parameters: (release_tag, release_version, c_driver_dir, quiet, skip_distcheck)
return_statement: return dist_file
docstring: Perform the necessary steps to build the distribution tarball which will be
      attached to the release in GitHub.  Return the path to the distribution
      tarball for a successful build and return None for a failed build.
docstring_summary: Perform the necessary steps to build the distribution tarball which will be
      attached to the release in GitHub.  Return the path to the distribution
      tarball for a successful build and return None for a failed build.
docstring_tokens: Perform the necessary steps to build the distribution tarball which will be attached to the release in GitHub . Return the path to the distribution tarball for a successful build and return None for a failed build .
function: def build_distribution(release_tag, release_version, c_driver_dir, quiet, skip_distcheck):
      """
      Perform the necessary steps to build the distribution tarball which will be
      attached to the release in GitHub.  Return the path to the distribution
      tarball for a successful build and return None for a failed build.
      """
  
      dist_file = 'build/mongo-cxx-driver-{}.tar.gz'.format(release_tag)
  
      if not quiet:
          click.echo('Building C++ distribution tarball: {}'.format(dist_file))
  
      if os.path.exists(dist_file):
          click.echo('Distribution tarball already exists: {}'.format(dist_file))
          click.echo('Refusing to build distribution tarball.')
          click.echo('To use the existing tarball, pass: --dist-file {}'.format(dist_file), err=True)
          return None
  
      if os.path.exists('build/CMakeCache.txt'):
          click.echo('Remnants of prior build found in ./build directory.')
          click.echo('Refusing to build distribution tarball.')
          click.echo('Clear ./build with "git clean -xdf ./build"', err=True)
          return None
  
      run_shell_script('. .evergreen/find_cmake.sh;'
                       'cd build;'
                       'echo ' + release_version + ' > VERSION_CURRENT;'
                       '${CMAKE} -DCMAKE_BUILD_TYPE=Release '
                       '-DCMAKE_PREFIX_PATH="' + c_driver_dir + '" '
                       '-DENABLE_UNINSTALL=ON ..;'
                       'cmake --build . --target dist')
  
      if not quiet:
          click.echo('C++ Driver build was successful.')
          click.echo('Distribution file: {}'.format(dist_file))
  
      if not skip_distcheck:
          click.echo('Building C++ driver from tarball and running tests.')
          click.echo('This may take several minutes. This may be skipped with --skip_distcheck')
          run_shell_script('cmake --build build --target distcheck')
      return dist_file
function_tokens: def build_distribution ( release_tag , release_version , c_driver_dir , quiet , skip_distcheck ) : dist_file = 'build/mongo-cxx-driver-{}.tar.gz' . format ( release_tag ) if not quiet : click . echo ( 'Building C++ distribution tarball: {}' . format ( dist_file ) ) if os . path . exists ( dist_file ) : click . echo ( 'Distribution tarball already exists: {}' . format ( dist_file ) ) click . echo ( 'Refusing to build distribution tarball.' ) click . echo ( 'To use the existing tarball, pass: --dist-file {}' . format ( dist_file ) , err = True ) return None if os . path . exists ( 'build/CMakeCache.txt' ) : click . echo ( 'Remnants of prior build found in ./build directory.' ) click . echo ( 'Refusing to build distribution tarball.' ) click . echo ( 'Clear ./build with "git clean -xdf ./build"' , err = True ) return None run_shell_script ( '. .evergreen/find_cmake.sh;' 'cd build;' 'echo ' + release_version + ' > VERSION_CURRENT;' '${CMAKE} -DCMAKE_BUILD_TYPE=Release ' '-DCMAKE_PREFIX_PATH="' + c_driver_dir + '" ' '-DENABLE_UNINSTALL=ON ..;' 'cmake --build . --target dist' ) if not quiet : click . echo ( 'C++ Driver build was successful.' ) click . echo ( 'Distribution file: {}' . format ( dist_file ) ) if not skip_distcheck : click . echo ( 'Building C++ driver from tarball and running tests.' ) click . echo ( 'This may take several minutes. This may be skipped with --skip_distcheck' ) run_shell_script ( 'cmake --build build --target distcheck' ) return dist_file