diff --git a/CHANGELOG.md b/CHANGELOG.md index a23c4fe2..26ae920f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Development ----------- - Remove existing sketch after clearing/running it again [PR #199](https://github.com/berinhard/pyp5js/pull/199) - Add share button to demo editor [PR #205](https://github.com/berinhard/pyp5js/pull/205) +- Fixed bug of adding new lines when saving Sketch in Windowns [PR #209](https://github.com/berinhard/pyp5js/pull/209) 0.7.1 ----- diff --git a/Makefile.bat b/Makefile.bat new file mode 100644 index 00000000..0acaad11 --- /dev/null +++ b/Makefile.bat @@ -0,0 +1,33 @@ +@echo off + +IF /I "%1"=="test" GOTO test +IF /I "%1"=="update_dist" GOTO update_dist +IF /I "%1"=="upload_pypi" GOTO upload_pypi +IF /I "%1"=="run_demo" GOTO run_demo +GOTO error + +:test + set PYTHONWARNINGS=ignore::flask.DeprecationWarning && pytest + GOTO :EOF + +:update_dist + @python3 setup.py sdist bdist_wheel + GOTO :EOF + +:upload_pypi + @twine upload dist/* + GOTO :EOF + +:run_demo + PUSHD docs/pyodide + python -m http.server + POPD + GOTO :EOF + +:error + IF "%1"=="" ( + ECHO make: *** No targets specified and no makefile found. Stop. + ) ELSE ( + ECHO make: *** No rule to make target '%1%'. Stop. + ) + GOTO :EOF diff --git a/pyp5js/http/web_app.py b/pyp5js/http/web_app.py index 36be3762..57dca84d 100644 --- a/pyp5js/http/web_app.py +++ b/pyp5js/http/web_app.py @@ -98,7 +98,7 @@ def render_sketch_view(sketch_name, static_path): else: try: ast.parse(py_code, sketch.sketch_py.name) - sketch.sketch_py.write_text(py_code) + sketch.sketch_py.write_bytes(bytes(py_code, encoding="utf-8")) except SyntaxError as exc: error = f'SyntaxError: {exc}' diff --git a/requirements.txt b/requirements.txt index 97a786d5..282eaf43 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,6 @@ cprint==1.1 gunicorn==19.9.0 watchdog==0.9.0 python-decouple==3.1 -Flask==1.1.2 +Flask==1.1.4 python-slugify==3.0.4 +markupsafe==2.0.1 \ No newline at end of file