You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:12:50 UTC

[buildstream] 01/01: Delay import of pkg_resources

This is an automated email from the ASF dual-hosted git repository.

github-bot 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,