mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-13 14:43:03 +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
|
||||
|
||||
- [Bugfix] Fix Dockerfile parsing on Windows
|
||||
|
||||
## v10.5.0 (2020-11-19)
|
||||
|
||||
- 💥[Improvement] Remove `dev/local pullimages`. Instead, run `dev/local dc pull`.
|
||||
|
@ -117,7 +117,7 @@ def install(location):
|
||||
# Save file
|
||||
if not os.path.exists(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)
|
||||
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.
|
||||
"""
|
||||
open_mode = "w"
|
||||
encoding = "utf8"
|
||||
open_kwargs = {"mode": "w"}
|
||||
if isinstance(content, bytes):
|
||||
open_mode += "b"
|
||||
encoding = None
|
||||
open_kwargs["mode"] += "b"
|
||||
else:
|
||||
# Make files readable by Docker on Windows
|
||||
open_kwargs["encoding"] = "utf8"
|
||||
open_kwargs["newline"] = "\n"
|
||||
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)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user