docstr: Return the directory, relative to the top of the source
  distribution, where package 'package' should be found
  (at least according to the 'package_dir' option, if any).
docstr_tok: ["Return","the","directory",",","relative","to","the","top","of","the","source","distribution",",","where","package","'package","'","should","be","found","(","at","least","according","to","the","'package_dir","'","option",",","if","any",")","."]
code: def get_package_dir(self, package):
      """Return the directory, relative to the top of the source
      distribution, where package 'package' should be found
      (at least according to the 'package_dir' option, if any)."""
      path = package.split(".")
  
      if not self.package_dir:
          if path:
              return os.path.join(*path)
          else:
              return ""
      else:
          tail = []
          while path:
              try:
                  pdir = self.package_dir[".".join(path)]
              except KeyError:
                  tail.insert(0, path[-1])
                  del path[-1]
              else:
                  tail.insert(0, pdir)
                  return os.path.join(*tail)
          else:
              # Oops, got all the way through 'path' without finding a
              # match in package_dir.  If package_dir defines a directory
              # for the root (nameless) package, then fallback on it;
              # otherwise, we might as well have not consulted
              # package_dir at all, as we just use the directory implied
              # by 'tail' (which should be the same as the original value
              # of 'path' at this point).
              pdir = self.package_dir.get("")
              if pdir is not None:
                  tail.insert(0, pdir)
  
              if tail:
                  return os.path.join(*tail)
              else:
                  return ""
  
imports: import os
  import importlib.util
  import sys
  import glob
  from distutils.core import Command
  from distutils.errors import *
  from distutils.util import convert_path, Mixin2to3
  from distutils import log
label_desc: Use image node_id 7 for calling the build_py obj's underlying member method code with example usage: obj.get_package_dir(package) and returns: os, str, os, os, str