'Return the relative path of setup.py to the git repo root.'

def _get_subdirectory(self, location):

    git_dir = self.run_command(['rev-parse', '--git-dir'], show_stdout=False, cwd=location).strip()
    if (not os.path.isabs(git_dir)):
        git_dir = os.path.join(location, git_dir)
    root_dir = os.path.join(git_dir, '..')
    orig_location = location
    while (not os.path.exists(os.path.join(location, 'setup.py'))):
        last_location = location
        location = os.path.dirname(location)
        if (location == last_location):
            logger.warning('Could    not    find    setup.py    for    directory    %s    (tried    all    parent    directories)', orig_location)
            return None
    if samefile(root_dir, location):
        return None
    return os.path.relpath(location, root_dir)
