def get_deps_list(self, pkg_name, installed_distros=None):
        """
        For a given package, returns a list of required packages. Recursive.
        """
        # https://github.com/Miserlou/Zappa/issues/1478.  Using `pkg_resources`
        # instead of `pip` is the recommended approach.  The usage is nearly
        # identical.
        import pkg_resources
        deps = []
        if not installed_distros:
            installed_distros = pkg_resources.WorkingSet()
        for package in installed_distros:
            if package.project_name.lower() == pkg_name.lower():
                deps = [(package.project_name, package.version)]
                for req in package.requires():
                    deps += self.get_deps_list(pkg_name=req.project_name, installed_distros=installed_distros)
        return list(set(deps))
def get_deps_list ( self , pkg_name , installed_distros = None ) : import pkg_resources deps = [ ] if not installed_distros : installed_distros = pkg_resources . WorkingSet ( ) for package in installed_distros : if package . project_name . lower ( ) == pkg_name . lower ( ) : deps = [ ( package . project_name , package . version ) ] for req in package . requires ( ) : deps += self . get_deps_list ( pkg_name = req . project_name , installed_distros = installed_distros ) return list ( set ( deps ) )
For a given package, returns a list of required packages. Recursive.