summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Bysiek <mb@mbdev.pl>2016-01-14 19:47:11 +0900
committerClaudiu Popa <pcmanticore@gmail.com>2016-01-15 14:14:00 +0200
commit547117638d99bf3cbc8a2e070ac139a0b6422158 (patch)
treea47dda5d6f8598adf19ba59166668be74596f505
parentda683ae017cc5e29a16f63b670272821afdf3b29 (diff)
downloadastroid-git-547117638d99bf3cbc8a2e070ac139a0b6422158.tar.gz
added 3 pkg_resources functions to brain
[Those 3 are] methods of WorkingSet objects [that] are also available as module- level functions in pkg_resources that apply to the default working_set instance. Thus, you can use e.g. pkg_resources.require() as an abbreviation for pkg_resources.working_set.require() above taken from: https://pythonhosted.org/setuptools/pkg_resources.html#basic-workingset-methods this fixes https://github.com/PyCQA/pylint/issues/780 Signed-off-by: Mateusz Bysiek <mb@mbdev.pl>
-rw-r--r--astroid/brain/brain_stdlib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/astroid/brain/brain_stdlib.py b/astroid/brain/brain_stdlib.py
index cbc9736f..ac731887 100644
--- a/astroid/brain/brain_stdlib.py
+++ b/astroid/brain/brain_stdlib.py
@@ -156,6 +156,15 @@ class deque(object):
def pkg_resources_transform():
return AstroidBuilder(MANAGER).string_build('''
+def require(*requirements):
+ return pkg_resources.working_set.require(*requirements)
+
+def run_script(requires, script_name):
+ return pkg_resources.working_set.run_script(requires, script_name)
+
+def iter_entry_points(group, name=None):
+ return pkg_resources.working_set.iter_entry_points(group, name)
+
def resource_exists(package_or_requirement, resource_name):
return get_provider(package_or_requirement).has_resource(resource_name)