parameters: (options, dependency_file, config_build_dir, settings)
docstring: Generates Python bindings file from swig.
  
      This method will do a sys.exit() if something fails.  If it returns to
      the caller, it succeeded.
  
      @param options the parsed command line options structure.
      @param dependency_file path to the bindings dependency file
      to be generated; otherwise, None if a dependency file is not
      to be generated.
      @param config_build_dir used as the output directory used by swig
      @param settings the SwigSettings that specify a number of aspects used
      to configure building the Python binding with swig (mostly paths)
docstring_summary: Generates Python bindings file from swig.
docstring_tokens: Generates Python bindings file from swig .
function: def do_swig_rebuild(options, dependency_file, config_build_dir, settings):
      """Generates Python bindings file from swig.
  
      This method will do a sys.exit() if something fails.  If it returns to
      the caller, it succeeded.
  
      @param options the parsed command line options structure.
      @param dependency_file path to the bindings dependency file
      to be generated; otherwise, None if a dependency file is not
      to be generated.
      @param config_build_dir used as the output directory used by swig
      @param settings the SwigSettings that specify a number of aspects used
      to configure building the Python binding with swig (mostly paths)
      """
      if options.generate_dependency_file:
          temp_dep_file_path = dependency_file + ".tmp"
  
      # Build the SWIG args list
      is_darwin = options.target_platform == "Darwin"
      gen_deps = options.generate_dependency_file
      darwin_extras = ["-D__APPLE__"] if is_darwin else []
      deps_args = ["-MMD", "-MF", temp_dep_file_path] if gen_deps else []
      command = ([
              options.swig_executable,
              "-c++",
              "-shadow",
              "-python",
              "-threads",
              "-I" + os.path.normpath(os.path.join(options.src_root, "include")),
              "-I" + os.path.curdir,
              "-D__STDC_LIMIT_MACROS",
              "-D__STDC_CONSTANT_MACROS"
          ]
          + darwin_extras
          + deps_args
          + [
              "-outdir", config_build_dir,
              "-o", settings.output_file,
              settings.input_file
          ]
      )
      logging.info("running swig with: %r", command)
  
      # Execute swig
      process = subprocess.Popen(
          command,
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
      )
      # Wait for SWIG process to terminate
      swig_stdout, swig_stderr = process.communicate()
      return_code = process.returncode
      if return_code != 0:
          logging.error(
              "swig failed with error code %d: stdout=%s, stderr=%s",
              return_code,
              swig_stdout,
              swig_stderr)
          logging.error(
              "command line:\n%s", ' '.join(command))
          sys.exit(return_code)
  
      logging.info("swig generation succeeded")
      if swig_stdout is not None and len(swig_stdout) > 0:
          logging.info("swig output: %s", swig_stdout)
  
      # Move the depedency file we just generated to the proper location.
      if options.generate_dependency_file:
          if os.path.exists(temp_dep_file_path):
              shutil.move(temp_dep_file_path, dependency_file)
          else:
              logging.error(
                  "failed to generate Python binding depedency file '%s'",
                  temp_dep_file_path)
              if os.path.exists(dependency_file):
                  # Delete the old one.
                  os.remove(dependency_file)
              sys.exit(-10)
function_tokens: def do_swig_rebuild ( options , dependency_file , config_build_dir , settings ) : if options . generate_dependency_file : temp_dep_file_path = dependency_file + ".tmp" # Build the SWIG args list is_darwin = options . target_platform == "Darwin" gen_deps = options . generate_dependency_file darwin_extras = [ "-D__APPLE__" ] if is_darwin else [ ] deps_args = [ "-MMD" , "-MF" , temp_dep_file_path ] if gen_deps else [ ] command = ( [ options . swig_executable , "-c++" , "-shadow" , "-python" , "-threads" , "-I" + os . path . normpath ( os . path . join ( options . src_root , "include" ) ) , "-I" + os . path . curdir , "-D__STDC_LIMIT_MACROS" , "-D__STDC_CONSTANT_MACROS" ] + darwin_extras + deps_args + [ "-outdir" , config_build_dir , "-o" , settings . output_file , settings . input_file ] ) logging . info ( "running swig with: %r" , command ) # Execute swig process = subprocess . Popen ( command , stdout = subprocess . PIPE , stderr = subprocess . PIPE , ) # Wait for SWIG process to terminate swig_stdout , swig_stderr = process . communicate ( ) return_code = process . returncode if return_code != 0 : logging . error ( "swig failed with error code %d: stdout=%s, stderr=%s" , return_code , swig_stdout , swig_stderr ) logging . error ( "command line:\n%s" , ' ' . join ( command ) ) sys . exit ( return_code ) logging . info ( "swig generation succeeded" ) if swig_stdout is not None and len ( swig_stdout ) > 0 : logging . info ( "swig output: %s" , swig_stdout ) # Move the depedency file we just generated to the proper location. if options . generate_dependency_file : if os . path . exists ( temp_dep_file_path ) : shutil . move ( temp_dep_file_path , dependency_file ) else : logging . error ( "failed to generate Python binding depedency file '%s'" , temp_dep_file_path ) if os . path . exists ( dependency_file ) : # Delete the old one. os . remove ( dependency_file ) sys . exit ( - 10 )