parameters: (
          self,
          fbcode_builder_dir,
          scratch_dir,
          host_type,
          install_dir=None,
          num_jobs=0,
          use_shipit=False,
          vcvars_path=None,
          allow_system_packages=False,
          lfs_path=None,
      )
docstring: fbcode_builder_dir - the path to either the in-fbsource fbcode_builder dir,
                               or for shipit-transformed repos, the build dir that
                               has been mapped into that dir.
          scratch_dir - a place where we can store repos and build bits.
                        This path should be stable across runs and ideally
                        should not be in the repo of the project being built,
                        but that is ultimately where we generally fall back
                        for builds outside of FB
          install_dir - where the project will ultimately be installed
          num_jobs - the level of concurrency to use while building
          use_shipit - use real shipit instead of the simple shipit transformer
          vcvars_path - Path to external VS toolchain's vsvarsall.bat
docstring_summary: fbcode_builder_dir - the path to either the in-fbsource fbcode_builder dir,
                               or for shipit-transformed repos, the build dir that
                               has been mapped into that dir.
          scratch_dir - a place where we can store repos and build bits.
                        This path should be stable across runs and ideally
                        should not be in the repo of the project being built,
                        but that is ultimately where we generally fall back
                        for builds outside of FB
          install_dir - where the project will ultimately be installed
          num_jobs - the level of concurrency to use while building
          use_shipit - use real shipit instead of the simple shipit transformer
          vcvars_path - Path to external VS toolchain's vsvarsall.bat
docstring_tokens: fbcode_builder_dir - the path to either the in - fbsource fbcode_builder dir or for shipit - transformed repos the build dir that has been mapped into that dir . scratch_dir - a place where we can store repos and build bits . This path should be stable across runs and ideally should not be in the repo of the project being built but that is ultimately where we generally fall back for builds outside of FB install_dir - where the project will ultimately be installed num_jobs - the level of concurrency to use while building use_shipit - use real shipit instead of the simple shipit transformer vcvars_path - Path to external VS toolchain s vsvarsall . bat
function: def __init__(
          self,
          fbcode_builder_dir,
          scratch_dir,
          host_type,
          install_dir=None,
          num_jobs=0,
          use_shipit=False,
          vcvars_path=None,
          allow_system_packages=False,
          lfs_path=None,
      ):
          """fbcode_builder_dir - the path to either the in-fbsource fbcode_builder dir,
                               or for shipit-transformed repos, the build dir that
                               has been mapped into that dir.
          scratch_dir - a place where we can store repos and build bits.
                        This path should be stable across runs and ideally
                        should not be in the repo of the project being built,
                        but that is ultimately where we generally fall back
                        for builds outside of FB
          install_dir - where the project will ultimately be installed
          num_jobs - the level of concurrency to use while building
          use_shipit - use real shipit instead of the simple shipit transformer
          vcvars_path - Path to external VS toolchain's vsvarsall.bat
          """
          if not num_jobs:
              import multiprocessing
  
              num_jobs = multiprocessing.cpu_count() // 2
  
          if not install_dir:
              install_dir = os.path.join(scratch_dir, "installed")
  
          self.project_hashes = None
          for p in ["../deps/github_hashes", "../project_hashes"]:
              hashes = os.path.join(fbcode_builder_dir, p)
              if os.path.exists(hashes):
                  self.project_hashes = hashes
                  break
  
          # Detect what repository and project we are being run from.
          self.repo_root, self.repo_project = detect_project(os.getcwd())
  
          # If we are running from an fbsource repository, set self.fbsource_dir
          # to allow the ShipIt-based fetchers to use it.
          if self.repo_project == "fbsource":
              self.fbsource_dir = self.repo_root
          else:
              self.fbsource_dir = None
  
          self.num_jobs = num_jobs
          self.scratch_dir = scratch_dir
          self.install_dir = install_dir
          self.fbcode_builder_dir = fbcode_builder_dir
          self.host_type = host_type
          self.use_shipit = use_shipit
          self.allow_system_packages = allow_system_packages
          self.lfs_path = lfs_path
          if vcvars_path is None and is_windows():
  
              # On Windows, the compiler is not available in the PATH by
              # default so we need to run the vcvarsall script to populate the
              # environment. We use a glob to find some version of this script
              # as deployed with Visual Studio 2017.  This logic can also
              # locate Visual Studio 2019 but note that at the time of writing
              # the version of boost in our manifest cannot be built with
              # VS 2019, so we're effectively tied to VS 2017 until we upgrade
              # the boost dependency.
              vcvarsall = []
              for year in ["2017", "2019"]:
                  vcvarsall += glob.glob(
                      os.path.join(
                          os.environ["ProgramFiles(x86)"],
                          "Microsoft Visual Studio",
                          year,
                          "*",
                          "VC",
                          "Auxiliary",
                          "Build",
                          "vcvarsall.bat",
                      )
                  )
              vcvars_path = vcvarsall[0]
  
          self.vcvars_path = vcvars_path
function_tokens: def __init__ ( self , fbcode_builder_dir , scratch_dir , host_type , install_dir = None , num_jobs = 0 , use_shipit = False , vcvars_path = None , allow_system_packages = False , lfs_path = None , ) : if not num_jobs : import multiprocessing num_jobs = multiprocessing . cpu_count ( ) // 2 if not install_dir : install_dir = os . path . join ( scratch_dir , "installed" ) self . project_hashes = None for p in [ "../deps/github_hashes" , "../project_hashes" ] : hashes = os . path . join ( fbcode_builder_dir , p ) if os . path . exists ( hashes ) : self . project_hashes = hashes break # Detect what repository and project we are being run from. self . repo_root , self . repo_project = detect_project ( os . getcwd ( ) ) # If we are running from an fbsource repository, set self.fbsource_dir # to allow the ShipIt-based fetchers to use it. if self . repo_project == "fbsource" : self . fbsource_dir = self . repo_root else : self . fbsource_dir = None self . num_jobs = num_jobs self . scratch_dir = scratch_dir self . install_dir = install_dir self . fbcode_builder_dir = fbcode_builder_dir self . host_type = host_type self . use_shipit = use_shipit self . allow_system_packages = allow_system_packages self . lfs_path = lfs_path if vcvars_path is None and is_windows ( ) : # On Windows, the compiler is not available in the PATH by # default so we need to run the vcvarsall script to populate the # environment. We use a glob to find some version of this script # as deployed with Visual Studio 2017.  This logic can also # locate Visual Studio 2019 but note that at the time of writing # the version of boost in our manifest cannot be built with # VS 2019, so we're effectively tied to VS 2017 until we upgrade # the boost dependency. vcvarsall = [ ] for year in [ "2017" , "2019" ] : vcvarsall += glob . glob ( os . path . join ( os . environ [ "ProgramFiles(x86)" ] , "Microsoft Visual Studio" , year , "*" , "VC" , "Auxiliary" , "Build" , "vcvarsall.bat" , ) ) vcvars_path = vcvarsall [ 0 ] self . vcvars_path = vcvars_path