You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 08:08:30 UTC
[buildstream] 01/01: Delay import of pkg_resources
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch bst-1.0
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 6aaff4469b77804a460ca72e6511f18ce94c10ad
Author: Gökçen Nurlu <gn...@bloomberg.net>
AuthorDate: Thu Jan 11 17:38:11 2018 +0000
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 410a4e7..0e1231e 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,