MCPcopy Index your code
hub / github.com/kivy/python-for-android / get_dep_names_of_package

Function get_dep_names_of_package

pythonforandroid/pythonpackage.py:682–719  ·  view source on GitHub ↗

Gets the dependencies from the package in the given folder, then attempts to deduce the actual package name resulting from each dependency line, stripping away everything else.

(
        package,
        keep_version_pins=False,
        recursive=False,
        verbose=False,
        include_build_requirements=False
        )

Source from the content-addressed store, hash-verified

680
681
682def get_dep_names_of_package(
683 package,
684 keep_version_pins=False,
685 recursive=False,
686 verbose=False,
687 include_build_requirements=False
688 ):
689 """ Gets the dependencies from the package in the given folder,
690 then attempts to deduce the actual package name resulting
691 from each dependency line, stripping away everything else.
692 """
693
694 # First, obtain the dependencies:
695 dependencies = get_package_dependencies(
696 package, recursive=recursive, verbose=verbose,
697 include_build_requirements=include_build_requirements,
698 )
699 if verbose:
700 print("get_dep_names_of_package_folder: " +
701 "processing dependency list to names: " +
702 str(dependencies))
703
704 # Transform dependencies to their stripped down names:
705 # (they can still have version pins/restrictions, conditionals, ...)
706 dependency_names = set()
707 for dep in dependencies:
708 # If we are supposed to keep exact version pins, extract first:
709 pin_to_append = ""
710 if keep_version_pins and "(==" in dep and dep.endswith(")"):
711 # This is a dependency of the format: 'pkg (==1.0)'
712 pin_to_append = "==" + dep.rpartition("==")[2][:-1]
713 elif keep_version_pins and "==" in dep and not dep.endswith(")"):
714 # This is a dependency of the format: 'pkg==1.0'
715 pin_to_append = "==" + dep.rpartition("==")[2]
716 # Now get true (and e.g. case-corrected) dependency name:
717 dep_name = get_package_name(dep) + pin_to_append
718 dependency_names.add(dep_name)
719 return dependency_names

Callers 3

__init__Method · 0.90

Calls 2

get_package_dependenciesFunction · 0.85
get_package_nameFunction · 0.85

Tested by 2