summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGökçen Nurlu <gnurlu1@bloomberg.net>2018-01-11 17:38:11 +0000
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-01-16 15:27:57 +0900
commitfc48f087c918231bbad7f80206b1f85e7acf8d8a (patch)
tree41abbd476253de86e99b684f7d3745760aa8ba74
parent571406d44dd1aafa8f1518a14fc23e3f111145cd (diff)
downloadbuildstream-fc48f087c918231bbad7f80206b1f85e7acf8d8a.tar.gz
Delay import of pkg_resources
This does not introduce a performance gain alone, but importing pkg_resources is costly at the moment and can be avoided until it is actually needed.
-rw-r--r--buildstream/_plugincontext.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/buildstream/_plugincontext.py b/buildstream/_plugincontext.py
index 410a4e718..0e1231e63 100644
--- a/buildstream/_plugincontext.py
+++ b/buildstream/_plugincontext.py
@@ -20,7 +20,6 @@
import os
import inspect
-import pkg_resources
from ._exceptions import PluginError
from . import utils
@@ -84,6 +83,7 @@ class PluginContext():
def _get_pip_plugin_source(self, package_name, kind):
defaults = None
if ('pip', package_name) not in self.alternate_sources:
+ import pkg_resources
# key by a tuple to avoid collision
try:
package = pkg_resources.get_entry_info(package_name,