Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions setup/brython/make_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ def make(package_name, package_path, exclude_dirs=None, output_path=None):

output_path = output_path or os.path.join(package_path, package_name + ".brython.js")
with open(output_path, "w", encoding="utf-8") as out:
out.write('__BRYTHON__.use_VFS = true;\n')
out.write('var scripts = {}\n'.format(json.dumps(VFS)))
out.write('__BRYTHON__.update_VFS(scripts)\n')
out.write(f'__BRYTHON__.loadBrythonPackage({json.dumps(VFS)})\n')

if __name__ == "__main__":
import sys
Expand Down
5 changes: 5 additions & 0 deletions www/src/brython_builtins.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ $B.update_VFS = function(scripts){
$B.stdlib_module_names = Object.keys($B.VFS)
}

$B.loadBrythonPackage = function(brythonPackage){
$B.use_VFS = true
$B.update_VFS(brythonPackage)
}

$B.add_files = function(files){
// Used to add files that programs can open with open()
$B.files = $B.files || {}
Expand Down