Get the version of the package from the given file by executing it and extracting the given `name`.
(file, name='__version__')
| 78 | # --------------------------------------------------------------------------- |
| 79 | |
| 80 | def get_version(file, name='__version__'): |
| 81 | """Get the version of the package from the given file by |
| 82 | executing it and extracting the given `name`. |
| 83 | """ |
| 84 | path = os.path.realpath(file) |
| 85 | version_ns = {} |
| 86 | with io.open(path, encoding="utf8") as f: |
| 87 | exec(f.read(), {}, version_ns) |
| 88 | return version_ns[name] |
| 89 | |
| 90 | |
| 91 | def ensure_python(specs): |