def generate_helper_script(pkg_manager_cmd, os_packages, pip_cmd, failed_deps):
 temp_dir = tempfile.gettempdir()
 script_path = os.path.join(temp_dir, SCRIPT_NAME)
 script_file = file(script_path, 'w')
 script_file.write('#!/bin/bash\n')
 if os_packages:
  missing_pkgs = ' '.join(os_packages)
  script_file.write(('%s %s\n' % (pkg_manager_cmd, missing_pkgs)))
 if failed_deps:
  script_file.write('\n')
  if running_in_virtualenv():
   script_file.write('# Run without sudo to install inside venv\n')
  not_git_pkgs = [fdep for fdep in failed_deps if (not fdep.is_git)]
  git_pkgs = [fdep.git_src for fdep in failed_deps if fdep.is_git]
  if not_git_pkgs:
   cmd = generate_pip_install_non_git(pip_cmd, not_git_pkgs)
   script_file.write(('%s\n' % cmd))
  if git_pkgs:
   for missing_git_pkg in git_pkgs:
    cmd = generate_pip_install_git(pip_cmd, missing_git_pkg)
    script_file.write(('%s\n' % cmd))
 os.chmod(script_path, 493)
 script_file.close()
 return script_path

def generate_helper_script ( pkg_manager_cmd , os_packages , pip_cmd , failed_deps ) : temp_dir = tempfile . gettempdir ( ) script_path = os . path . join ( temp_dir , SCRIPT_NAME ) script_file = file ( script_path , 'w' ) script_file . write ( '#!/bin/bash\n' ) if os_packages : missing_pkgs = ' ' . join ( os_packages ) script_file . write ( ( '%s %s\n' % ( pkg_manager_cmd , missing_pkgs ) ) ) if failed_deps : script_file . write ( '\n' ) if running_in_virtualenv ( ) : script_file . write ( '# Run without sudo to install inside venv\n' ) not_git_pkgs = [ fdep for fdep in failed_deps if ( not fdep . is_git ) ] git_pkgs = [ fdep . git_src for fdep in failed_deps if fdep . is_git ] if not_git_pkgs : cmd = generate_pip_install_non_git ( pip_cmd , not_git_pkgs ) script_file . write ( ( '%s\n' % cmd ) ) if git_pkgs : for missing_git_pkg in git_pkgs : cmd = generate_pip_install_git ( pip_cmd , missing_git_pkg ) script_file . write ( ( '%s\n' % cmd ) ) os . chmod ( script_path , 493 ) script_file . close ( ) return script_path
generates a helper script to be run by the user to install all the dependencies .