def find_dependencies(filename, executable): """Return a list of Dependency objects representing all Hoc files imported (directly or indirectly) by a given Hoc file.""" executable_path = os.path.realpath(executable.path) heuristics = [core.find_versions_from_versioncontrol, ] paths = find_xopened_files(filename).union(find_loaded_files(filename, executable.path)) dependencies = [Dependency(name) for name in paths] dependencies = [d for d in dependencies if not d.in_stdlib(executable.path)] return core.find_versions(dependencies, heuristics)
def find_dependencies(filename, executable): """ Return a list of Dependency objects representing all files included, whether directly or indirectly, by a given .g file. """ heuristics = [core.find_versions_from_versioncontrol, ] paths = find_included_files(filename) # also need to find .p files dependencies = [Dependency(name) for name in paths] return core.find_versions(dependencies, heuristics)
def find_dependencies(filename, executable): """Return a list of Dependency objects representing all the top-level modules or packages imported (directly or indirectly) by a given Python file.""" heuristics = [core.find_versions_from_versioncontrol, lambda deps: find_versions_by_attribute(deps, executable), find_versions_from_egg] logger.debug("Finding imported packages") packages = find_imported_packages(filename, executable.path, exclude_stdlib=True) dependencies = [Dependency.from_module(module, executable.path) for module in packages.values()] logger.debug("Finding versions of dependencies") return core.find_versions(dependencies, heuristics)
def find_dependencies(filename, executable): """ Return a list of Dependency objects representing all files included, whether directly or indirectly, by a given .g file. """ heuristics = [ core.find_versions_from_versioncontrol, ] paths = find_included_files(filename) # also need to find .p files dependencies = [Dependency(name) for name in paths] return core.find_versions(dependencies, heuristics)
def find_dependencies(filename, executable): """Return a list of Dependency objects representing all Hoc files imported (directly or indirectly) by a given Hoc file.""" executable_path = os.path.realpath(executable.path) heuristics = [ core.find_versions_from_versioncontrol, ] paths = find_xopened_files(filename).union( find_loaded_files(filename, executable.path)) dependencies = [Dependency(name) for name in paths] dependencies = [ d for d in dependencies if not d.in_stdlib(executable.path) ] return core.find_versions(dependencies, heuristics)
def find_dependencies(filename, executable): """Return a list of Dependency objects representing all the top-level modules or packages imported (directly or indirectly) by a given Python file.""" heuristics = [ core.find_versions_from_versioncontrol, lambda deps: find_versions_by_attribute(deps, executable), find_versions_from_egg ] logger.debug("Finding imported packages") packages = find_imported_packages(filename, executable.path, exclude_stdlib=True) dependencies = [ Dependency.from_module(module, executable.path) for module in packages.values() ] logger.debug("Finding versions of dependencies") return core.find_versions(dependencies, heuristics)