pkg_resources: Implement resource_stream().

This module is not part of CPython stdlib, but rather of setuptools. But
so happens that it's functionality either lies on critical path, or should
be duplicated, in pkgutil module.
pull/35/head
Paul Sokolovsky 2015-06-26 02:17:32 +03:00
rodzic b27a22e3cf
commit 4eca48d724
1 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,9 @@
import os
import os.path
def resource_stream(package, resource):
p = __import__(package)
d = os.path.dirname(p.__file__)
if d[0] != "/":
d = os.getcwd() + "/" + d
return open(d + "/" + resource, "rb")