mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
commit
8aaac7b14c
@ -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";
|
||||
|
||||
|
21
IPython/html/tests/casperjs/test_cases/misc_tests.js
Normal file
21
IPython/html/tests/casperjs/test_cases/misc_tests.js
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
//
|
||||
// Miscellaneous javascript tests
|
||||
//
|
||||
casper.notebook_test(function () {
|
||||
var jsver = this.evaluate(function () {
|
||||
var cell = IPython.notebook.get_cell(0);
|
||||
cell.set_text('import IPython; print(IPython.__version__)');
|
||||
cell.execute();
|
||||
return IPython.version;
|
||||
});
|
||||
|
||||
this.wait_for_output(0);
|
||||
|
||||
// refactor this into just a get_output(0)
|
||||
this.then(function () {
|
||||
var result = this.get_output_cell(0);
|
||||
this.test.assertEquals(result.text.trim(), jsver, 'IPython.version in JS matches IPython.');
|
||||
});
|
||||
|
||||
});
|
2
setup.py
2
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,
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
22
setupbase.py
22
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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user