def get_versions(dependencies): import importlib from pkg_resources import get_distribution, DistributionNotFound from pytools import find_module_git_revision versions = {} git_revs = {} for dep in dependencies: try: versions[dep] = get_distribution(dep).version except (ModuleNotFoundError, DistributionNotFound): versions[dep] = None try: file = importlib.import_module(dep.replace(".", "")).__file__ git_revs[dep] = find_module_git_revision(file, n_levels_up=1) except ModuleNotFoundError: git_revs[dep] = None return versions, git_revs
def test_find_module_git_revision(): import pytools print(pytools.find_module_git_revision(pytools.__file__, n_levels_up=1))
# {{{ find install- or run-time git revision import os if os.environ.get("AKPYTHON_EXEC_IMPORT_UNAVAILABLE") is not None: # We're just being exec'd by setup.py. We can't import anything. _git_rev = None else: import loopy._git_rev as _git_rev_mod _git_rev = _git_rev_mod.GIT_REVISION # If we're running from a dev tree, the last install (and hence the most # recent update of the above git rev) could have taken place very long ago. from pytools import find_module_git_revision _runtime_git_rev = find_module_git_revision(__file__, n_levels_up=1) if _runtime_git_rev is not None: _git_rev = _runtime_git_rev # }}} VERSION = (2018, 1) VERSION_STATUS = "" VERSION_TEXT = ".".join(str(x) for x in VERSION) + VERSION_STATUS try: import islpy.version except ImportError: _islpy_version = "_UNKNOWN_" else:
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ # {{{ find install- or run-time git revision import os if os.environ.get("AKPYTHON_EXEC_FROM_WITHIN_WITHIN_SETUP_PY") is not None: # We're just being exec'd by setup.py. We can't import anything. _git_rev = None else: import pytential._git_rev as _git_rev_mod _git_rev = _git_rev_mod.GIT_REVISION # If we're running from a dev tree, the last install (and hence the most # recent update of the above git rev) could have taken place very long ago. from pytools import find_module_git_revision _runtime_git_rev = find_module_git_revision(__file__, n_levels_up=1) if _runtime_git_rev is not None: _git_rev = _runtime_git_rev # }}} VERSION = (2020, 2, 1) VERSION_TEXT = ".".join(str(i) for i in VERSION) PYTENTIAL_KERNEL_VERSION = (VERSION, _git_rev, 0)