(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).
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).
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 ) .
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 ''
def get_package_dir ( self , package ) : 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 ''