code: def build(self, store_dir):
      package_dir = os.path.abspath(self.build_dir + "/catboost")
      ya = os.path.abspath(self.r_dir + "/../../ya")
  
      os.makedirs(package_dir)
      export_with = "svn"
      for obj in [
          "DESCRIPTION",
          "NAMESPACE",
          "README.md",
          "R",
          "inst",
          "man",
          "tests",
      ]:
          src = os.path.join(self.r_dir, obj)
          dst = os.path.join(package_dir, obj)
          if export_with == "svn":
              try:
                  _execute([ya, "svn", "export", src, dst])
              except sp.CalledProcessError:
                  export_with = "git"
          if export_with == "git":
              tmp = tempfile.mkstemp(".tar.gz")[1]
              with Cwd(os.path.dirname(src)):
                  _execute(
                      [
                          "git",
                          "archive",
                          "--output",
                          tmp,
                          "HEAD",
                          os.path.basename(src),
                      ]
                  )
              with Cwd(os.path.dirname(dst)):
                  _execute(["tar", "-xvpf", tmp])
              os.unlink(tmp)
  
      _execute(
          [ya, "make", "-r", self.r_dir + "/src"]
          + (
              []
              if _host_os_eq(self.target_os)
              else ["--target-platform={}".format(self.target_os)]
          )
      )
      if self.target_os == "Windows":
          src = self.r_dir + "/src/libcatboostr.dll"
          dst = package_dir + "/inst/libs/x64/libcatboostr.dll"
      else:
          src = self.r_dir + "/src/libcatboostr.so"
          dst = package_dir + "/inst/libs/libcatboostr.so"
      os.makedirs(os.path.dirname(dst))
      shutil.copy2(src, dst)
  
      # Create the package
      result = os.path.join(
          os.path.abspath(store_dir), self.stem + ".tgz"
      )
      if not os.path.exists(os.path.dirname(result)):
          os.makedirs(os.path.dirname(result))
      with Cwd(self.build_dir):
          _execute(["tar", "-cvzf", result, "catboost"])
      return result
  
imports: from __future__ import print_function
  import argparse
  import os
  import re
  import shutil
  import subprocess
  import sys
  import tempfile
label_desc: Use image node_id 3 for calling the RPackager obj's underlying member method code with example usage: obj.build(store_dir) and returns: result