-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/justpy-org/justpy
- Loading branch information
Showing
2 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,53 @@ | ||
#!/bin/bash | ||
# WF 2022-10-23 | ||
python -m venv --upgrade-deps venv | ||
source venv/bin/activate | ||
pip install '.[test]' | ||
|
||
export PYTHONPATH=. | ||
host=$(hostname -f) | ||
port=8099 | ||
|
||
# | ||
# start the webbrowser | ||
# | ||
webbrowser() { | ||
local l_sleeptime=$1 | ||
local l_host=$2 | ||
local l_port=$3 | ||
sleep $l_sleeptime | ||
open http://$l_host:$l_port | ||
} | ||
echo "Starting justpy demo browser on host $host port $port ..." | ||
webbrowser 1 $host $port& | ||
python examples/demo_browser.py --port $port --host $host | ||
|
||
# show usage | ||
# | ||
usage() { | ||
echo "$0 [-h|--help]" | ||
echo "-s |--server: start justpy demo server" | ||
echo "-b |--browser: start local demo browser" | ||
echo "-h |--help: show this usage" | ||
exit 1 | ||
} | ||
|
||
if [ $# -lt 1 ] | ||
then | ||
usage | ||
else | ||
while [ "$1" != "" ] | ||
do | ||
option="$1" | ||
case $option in | ||
-h|--help) | ||
usage | ||
;; | ||
-s|--serve) | ||
echo "Starting justpy demo browser on host $host port $port ..." | ||
python examples/demo_browser.py --port $port --host $host | ||
;; | ||
-b|--browse) | ||
webbrowser 1 $host $port& | ||
;; | ||
esac | ||
shift | ||
done | ||
fi |