[Python-modules-commits] [jupyter-notebook] 17/19: Add local copy of requirejs-plugins/src/json.js

Gordon Ball chronitis-guest at moszumanska.debian.org
Sun Sep 17 21:09:01 UTC 2017


This is an automated email from the git hooks/post-receive script.

chronitis-guest pushed a commit to branch master
in repository jupyter-notebook.

commit c8bb8c071f2a49fa3567de500a3e5fc0cb8b9d10
Author: Gordon Ball <gordon at chronitis.net>
Date:   Sun Sep 17 20:36:05 2017 +0000

    Add local copy of requirejs-plugins/src/json.js
---
 .gitignore                                         |  1 -
 debian/README.source                               |  8 +++
 debian/changelog                                   |  2 +
 debian/copyright                                   | 23 +++++++
 .../missing-sources/requirejs-plugins/src/json.js  | 72 ++++++++++++++++++++++
 debian/rules                                       |  3 +
 6 files changed, 108 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 2c2eb30..98462a9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,7 +25,6 @@ __pycache__
 \#*#
 .#*
 .coverage
-src
 
 *.swp
 *.map
diff --git a/debian/README.source b/debian/README.source
index af99130..6eec70e 100644
--- a/debian/README.source
+++ b/debian/README.source
@@ -66,6 +66,14 @@ There is an explicit dependency on python{,3}-terminado which is listed as a
 platform-specific requirement in setup.py, which it appears pybuild doesn't
 interpret.
 
+requirejs-plugins
+-----------------
+
+The single file `json.js` from requirejs-plugins (unpackaged) is pulled in. This
+is included in missing-sources/requirejs-plugins/src/json.js (from
+https://github.com/millermedeiros/requirejs-plugins.git commit 71956b1). This
+file is in source form (rather than being in any way transpiled).
+
 Built-Using
 -----------
 
diff --git a/debian/changelog b/debian/changelog
index 3b452b1..37ab0b3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,8 @@ jupyter-notebook (5.1.0-1) UNRELEASED; urgency=medium
   * Update Standards-Version to 4.1.0
   * Documentation now includes sample notebooks; a patch is added to ignore
     errors while building these
+  * New dependencies: libjs-jed, libjs-requirejs-text
+  * New missing-sources: json.js from requirejs-plugins
   * This version is built with a dummy shim replacing the unpackaged
     preact, preact-compat and proptypes javascript libraries. Consequently,
     the shortcut editor will not work.
diff --git a/debian/copyright b/debian/copyright
index fa72c42..c2bfc80 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -8,6 +8,10 @@ Files: debian/*
 Copyright: 2016 Gordon Ball <gordon at chronitis.net>
 License: BSD-3-clause
 
+Files: debian/missing-sources/requirejs-plugins/src/json.js
+Copyright: 2014 Miller Medeiros
+License: MIT
+
 Files: debian/missing-sources/*
 Copyright: 2008-2014 Google Inc.
 License: Apache-2.0
@@ -55,3 +59,22 @@ License: Apache-2.0
  limitations under the License.
  .
  On Debian systems, see /usr/share/common-licenses/Apache-2.0
+
+License: MIT
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ 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.
diff --git a/debian/missing-sources/requirejs-plugins/src/json.js b/debian/missing-sources/requirejs-plugins/src/json.js
new file mode 100644
index 0000000..6f40f57
--- /dev/null
+++ b/debian/missing-sources/requirejs-plugins/src/json.js
@@ -0,0 +1,72 @@
+/** @license
+ * RequireJS plugin for loading JSON files
+ * - depends on Text plugin and it was HEAVILY "inspired" by it as well.
+ * Author: Miller Medeiros
+ * Version: 0.4.0 (2014/04/10)
+ * Released under the MIT license
+ */
+define(['text'], function(text){
+
+    var CACHE_BUST_QUERY_PARAM = 'bust',
+        CACHE_BUST_FLAG = '!bust',
+        jsonParse = (typeof JSON !== 'undefined' && typeof JSON.parse === 'function')? JSON.parse : function(val){
+            return eval('('+ val +')'); //quick and dirty
+        },
+        buildMap = {};
+
+    function cacheBust(url){
+        url = url.replace(CACHE_BUST_FLAG, '');
+        url += (url.indexOf('?') < 0)? '?' : '&';
+        return url + CACHE_BUST_QUERY_PARAM +'='+ Math.round(2147483647 * Math.random());
+    }
+
+    //API
+    return {
+
+        load : function(name, req, onLoad, config) {
+            if (( config.isBuild && (config.inlineJSON === false || name.indexOf(CACHE_BUST_QUERY_PARAM +'=') !== -1)) || (req.toUrl(name).indexOf('empty:') === 0)) {
+                //avoid inlining cache busted JSON or if inlineJSON:false
+                //and don't inline files marked as empty!
+                onLoad(null);
+            } else {
+                text.get(req.toUrl(name), function(data){
+                    var parsed;
+                    if (config.isBuild) {
+                        buildMap[name] = data;
+                        onLoad(data);
+                    } else {
+                        try {
+                            parsed = jsonParse(data);
+                        } catch (e) {
+                            onLoad.error(e);
+                        }
+                        onLoad(parsed);
+                    }
+                },
+                    onLoad.error, {
+                        accept: 'application/json'
+                    }
+                );
+            }
+        },
+
+        normalize : function (name, normalize) {
+            // used normalize to avoid caching references to a "cache busted" request
+            if (name.indexOf(CACHE_BUST_FLAG) !== -1) {
+                name = cacheBust(name);
+            }
+            // resolve any relative paths
+            return normalize(name);
+        },
+
+        //write method based on RequireJS official text plugin by James Burke
+        //https://github.com/jrburke/requirejs/blob/master/text.js
+        write : function(pluginName, moduleName, write){
+            if(moduleName in buildMap){
+                var content = buildMap[moduleName];
+                write('define("'+ pluginName +'!'+ moduleName +'", function(){ return '+ content +';});\n');
+            }
+        }
+
+    };
+});
diff --git a/debian/rules b/debian/rules
index a35f045..dc4bc78 100755
--- a/debian/rules
+++ b/debian/rules
@@ -67,6 +67,9 @@ override_dh_auto_configure:
 	#requirejs
 	ln -s $(JSBASE)/requirejs $(COMP)/
 
+	#requirejs-plugins
+	cp -r debian/missing-sources/requirejs-plugins $(COMP)/
+
 	#xterm.js
 	mkdir -p $(COMP)/xterm.js
 	ln -s $(JSBASE)/xterm $(COMP)/xterm.js/dist

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/jupyter-notebook.git



More information about the Python-modules-commits mailing list