From 248f0a1de14ffccf3b1ff541b5965eedc2483051 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Sun, 26 Dec 2021 20:10:36 -0800 Subject: [PATCH] Initial commit --- LICENSE | 21 +++++++++++++++++++++ README.md | 5 +++++ hello-world/index.html | 22 ++++++++++++++++------ server.py | 5 +++-- 4 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 LICENSE create mode 100644 README.md mode change 100644 => 100755 server.py diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7f28c2b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Pyodide Project + +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/README.md b/README.md new file mode 100644 index 0000000..65b32ad --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +## Pyodide Examples + +Use the `./server.py` to serve the files. If you request "some_directory.zip" it +the server will zip the directory on the fly and serve it. This is useful for +developing Python packages for use with Pyodide. diff --git a/hello-world/index.html b/hello-world/index.html index 6f3f497..b026101 100644 --- a/hello-world/index.html +++ b/hello-world/index.html @@ -1,22 +1,32 @@ - + - Pyodide test page
+ Pyodide test page
Open your browser console to see Pyodide output - \ No newline at end of file + diff --git a/server.py b/server.py old mode 100644 new mode 100755 index 4ec31b2..4f9ed41 --- a/server.py +++ b/server.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + import argparse from contextlib import contextmanager import http.server @@ -41,10 +43,9 @@ def server(port): def main(args): - build_dir = args.build_dir port = args.port with server(port) as httpd: - print(f"serving from {build_dir} at http://localhost:{port}") + print(f"serving from {Path(__file__).resolve().parent} at http://localhost:{port}") httpd.serve_forever()