From 6aaff4469b77804a460ca72e6511f18ce94c10ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6k=C3=A7en=20Nurlu?= Date: Thu, 11 Jan 2018 17:38:11 +0000 Subject: 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. --- buildstream/_plugincontext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, -- cgit v1.2.1