kopia lustrzana https://github.com/micropython/micropython-lib
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
rodzic
b27a22e3cf
commit
4eca48d724
|
@ -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")
|
Ładowanie…
Reference in New Issue