Skip to content

Commit cef0639

Browse files
committed
Preparing better lockFileContents for Pyodide 0.28.1
1 parent 2f800a9 commit cef0639

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

esm/interpreter/pyodide.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,19 @@ export default {
9999
// packages are uniquely stored as JSON key
100100
const key = stringify(packages);
101101
if (storage.has(key)) {
102-
const blob = new Blob(
103-
[storage.get(key)],
104-
{ type: 'application/json' },
105-
);
106-
// this should be used to bootstrap loadPyodide
107-
options.lockFileURL = URL.createObjectURL(blob);
108-
// versions are not currently understood by pyodide when
109-
// a lockFileURL is used instead of micropip.install(packages)
110-
// https://github.com/pyodide/pyodide/issues/5135#issuecomment-2441038644
111-
// https://github.com/pyscript/pyscript/issues/2245
112-
options.packages = packages.map(name => name.split(/[>=<]=/)[0]);
102+
const value = storage.get(key);
103+
if (save && !version.startsWith('0.27'))
104+
options.lockFileContents = Promise.resolve(value);
105+
else {
106+
const blob = new Blob([value], { type: 'application/json' });
107+
// this should be used to bootstrap loadPyodide
108+
options.lockFileURL = URL.createObjectURL(blob);
109+
// versions are not currently understood by pyodide when
110+
// a lockFileURL is used instead of micropip.install(packages)
111+
// https://github.com/pyodide/pyodide/issues/5135#issuecomment-2441038644
112+
// https://github.com/pyscript/pyscript/issues/2245
113+
options.packages = packages.map(name => name.split(/[>=<]=/)[0]);
114+
}
113115
packages = null;
114116
}
115117
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy