[yt-svn] commit/yt: MatthewTurk: Adding get_version_stack() and get_script_contents() functions.
Bitbucket
commits-noreply at bitbucket.org
Sat Jan 14 04:37:19 PST 2012
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/changeset/c7e81f654083/
changeset: c7e81f654083
branch: yt
user: MatthewTurk
date: 2012-01-14 13:37:03
summary: Adding get_version_stack() and get_script_contents() functions.
affected #: 1 file
diff -r 911d456c3e1973ccc31c0c683456a724e5712a32 -r c7e81f654083be69a5b6154dfafc0e851bda1985 yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -474,7 +474,26 @@
version = get_hg_version(path)[:12]
return version
+def get_version_stack():
+ import numpy, matplotlib, h5py
+ version_info = {}
+ version_info['yt'] = get_yt_version()
+ version_info['numpy'] = numpy.version.version
+ version_info['matplotlib'] = matplotlib.__version__
+ version_info['h5py'] = h5py.version.version
+ return version_info
+def get_script_contents():
+ stack = inspect.stack()
+ top_frame = inspect.stack()[-1]
+ finfo = inspect.getframeinfo(top_frame[0])
+ if finfo[2] != "<module>": return None
+ if not os.path.exists(finfo[0]): return None
+ try:
+ contents = open(finfo[0]).read()
+ except:
+ contents = None
+ return contents
# This code snippet is modified from Georg Brandl
def bb_apicall(endpoint, data, use_pass = True):
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list