diff --git a/IPython/html/static/base/js/namespace.js b/IPython/html/static/base/js/namespace.js index 530343c..e865afd 100644 --- a/IPython/html/static/base/js/namespace.js +++ b/IPython/html/static/base/js/namespace.js @@ -1,5 +1,5 @@ //---------------------------------------------------------------------------- -// Copyright (C) 2008-2011 The IPython Development Team +// Copyright (C) 2011 The IPython Development Team // // Distributed under the terms of the BSD License. The full license is in // the file COPYING, distributed as part of this software. @@ -7,6 +7,8 @@ var IPython = IPython || {}; +IPython.version = "2.0.0-dev"; + IPython.namespace = function (ns_string) { "use strict"; diff --git a/setup.py b/setup.py index 020547f..330fbfb 100755 --- a/setup.py +++ b/setup.py @@ -68,6 +68,7 @@ from setupbase import ( require_submodules, UpdateSubmodules, CompileCSS, + JavascriptVersion, install_symlinked, install_lib_symlink, install_scripts_for_symlink, @@ -236,6 +237,7 @@ setup_args['cmdclass'] = { 'symlink': install_symlinked, 'install_lib_symlink': install_lib_symlink, 'install_scripts_sym': install_scripts_for_symlink, + 'jsversion' : JavascriptVersion, } #--------------------------------------------------------------------------- diff --git a/setupbase.py b/setupbase.py index 58c3c87..c12d3bb 100644 --- a/setupbase.py +++ b/setupbase.py @@ -564,3 +564,25 @@ class CompileCSS(Command): def run(self): call("fab css", shell=True, cwd=pjoin(repo_root, "IPython", "html")) + +class JavascriptVersion(Command): + """write the javascript version to notebook javascript""" + description = "Write IPython version to javascript" + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + nsfile = pjoin(repo_root, "IPython", "html", "static", "base", "js", "namespace.js") + with open(nsfile) as f: + lines = f.readlines() + with open(nsfile, 'w') as f: + for line in lines: + if line.startswith("IPython.version"): + line = 'IPython.version = "{0}";\n'.format(version) + f.write(line) +