Skip to content

Instantly share code, notes, and snippets.

@gforcada
Created February 16, 2015 22:06
Show Gist options
  • Save gforcada/4003e08c34aeb9c3d557 to your computer and use it in GitHub Desktop.
Save gforcada/4003e08c34aeb9c3d557 to your computer and use it in GitHub Desktop.
# run it on a buildout.coredev checkout, plone 5 branch
# save its output so that you have the same imports as on ``pkg_resources.py``
import os
for folder in os.listdir('src/'):
print("""
try:
import {0}
except ImportError:
print('{0} not found')
""".format(folder))
# run it on a buildout.coredev checkout, plone 5 branch
import pkg_resources
import os
for folder in os.listdir('src/'):
try:
pkg_resources.get_distribution(folder)
except pkg_resources.DistributionNotFound:
print('{0} not found'.format(folder))
@gforcada
Copy link
Author

With this two files you can roughly compare how fast/slow is checking for and ImportError rather than a DistributionNotFound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment