Created
May 17, 2016 17:07
-
-
Save vladiibine/d4bccc9485333156eb022600fa275f72 to your computer and use it in GitHub Desktop.
Python entry point scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List all the console_scripts entry points in the given distribution, or all distributions if None | |
def list_entry_points(desired_distribution=None): | |
all_entry_maps = {} | |
for key, distribution in pkg_resources.working_set.by_key.items(): | |
if desired_distribution and distribution.key != desired_distribution: | |
continue | |
distribution_entrypoints = distribution.get_entry_map() | |
if distribution_entrypoints: | |
if 'console_scripts' in distribution_entrypoints: | |
all_entry_maps[key]= [str(entry_point) for entry_point in distribution_entrypoints['console_scripts'].values()] | |
return all_entry_maps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment