mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-14 06:58:21 +00:00
Fix Dockerfile parsing on Windows
Line endings are written as "\r" by default on Windows, which makes the Dockerfiles unreadable by Docker. See: https://github.com/overhangio/tutor/pull/385#issuecomment-730387969
This commit is contained in:
parent
7b16af22b8
commit
727c204e92
@ -4,6 +4,8 @@ Note: Breaking changes between versions are indicated by "💥".
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- [Bugfix] Fix Dockerfile parsing on Windows
|
||||||
|
|
||||||
## v10.5.0 (2020-11-19)
|
## v10.5.0 (2020-11-19)
|
||||||
|
|
||||||
- 💥[Improvement] Remove `dev/local pullimages`. Instead, run `dev/local dc pull`.
|
- 💥[Improvement] Remove `dev/local pullimages`. Instead, run `dev/local dc pull`.
|
||||||
|
@ -117,7 +117,7 @@ def install(location):
|
|||||||
# Save file
|
# Save file
|
||||||
if not os.path.exists(plugins.DictPlugin.ROOT):
|
if not os.path.exists(plugins.DictPlugin.ROOT):
|
||||||
os.makedirs(plugins.DictPlugin.ROOT)
|
os.makedirs(plugins.DictPlugin.ROOT)
|
||||||
with open(plugin_path, "w") as f:
|
with open(plugin_path, "w", newline="\n") as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
fmt.echo_info("Plugin installed at {}".format(plugin_path))
|
fmt.echo_info("Plugin installed at {}".format(plugin_path))
|
||||||
|
|
||||||
|
12
tutor/env.py
12
tutor/env.py
@ -227,13 +227,15 @@ def write_to(content, path):
|
|||||||
"""
|
"""
|
||||||
Write some content to a path. Content can be either str or bytes.
|
Write some content to a path. Content can be either str or bytes.
|
||||||
"""
|
"""
|
||||||
open_mode = "w"
|
open_kwargs = {"mode": "w"}
|
||||||
encoding = "utf8"
|
|
||||||
if isinstance(content, bytes):
|
if isinstance(content, bytes):
|
||||||
open_mode += "b"
|
open_kwargs["mode"] += "b"
|
||||||
encoding = None
|
else:
|
||||||
|
# Make files readable by Docker on Windows
|
||||||
|
open_kwargs["encoding"] = "utf8"
|
||||||
|
open_kwargs["newline"] = "\n"
|
||||||
utils.ensure_file_directory_exists(path)
|
utils.ensure_file_directory_exists(path)
|
||||||
with open(path, open_mode, encoding=encoding) as of:
|
with open(path, **open_kwargs) as of:
|
||||||
of.write(content)
|
of.write(content)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user