Skip to content

Commit

Permalink
Convert all newlines to LF when writing files.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakirkham committed Jan 4, 2017
1 parent fa97c70 commit de87a23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion conda_smithy/feedstock_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def write_file(filename):
if dirname and not os.path.exists(dirname):
os.makedirs(dirname)

with io.open(filename, "w", encoding="utf-8") as fh:
with io.open(filename, "w", encoding="utf-8", newline="\n") as fh:
yield fh

repo = get_repo(filename)
Expand Down
10 changes: 5 additions & 5 deletions conda_smithy/tests/test_feedstock_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

def keep_dir(dirname):
keep_filename = os.path.join(dirname, ".keep")
with io.open(keep_filename, "w", encoding="utf-8") as fh:
with io.open(keep_filename, "w", encoding="utf-8", newline="\n") as fh:
fh.write("")


Expand Down Expand Up @@ -54,7 +54,7 @@ def setUp(self):
self.tmp_dir = tempfile.mkdtemp()
os.chdir(self.tmp_dir)

with io.open(os.path.abspath(".keep"), "w", encoding="utf-8") as fh:
with io.open(os.path.abspath(".keep"), "w", encoding="utf-8", newline="\n") as fh:
fh.write("")


Expand Down Expand Up @@ -84,7 +84,7 @@ def test_set_exe_file(self):
for tmp_dir, repo, pathfunc in parameterize():
filename = "test.txt"
filename = os.path.join(tmp_dir, filename)
with io.open(filename, "w", encoding="utf-8") as fh:
with io.open(filename, "w", encoding="utf-8", newline="\n") as fh:
fh.write("")
if repo is not None:
repo.index.add([filename])
Expand Down Expand Up @@ -154,7 +154,7 @@ def test_remove_file(self):

filename = os.path.join(tmp_dir, filename)

with io.open(filename, "w", encoding="utf-8") as fh:
with io.open(filename, "w", encoding="utf-8", newline="\n") as fh:
fh.write("")
if repo is not None:
repo.index.add([filename])
Expand Down Expand Up @@ -189,7 +189,7 @@ def test_copy_file(self):
filename2 = os.path.join(tmp_dir, filename2)

write_text = "text"
with io.open(filename1, "w", encoding="utf-8") as fh:
with io.open(filename1, "w", encoding="utf-8", newline="\n") as fh:
fh.write(write_text)

self.assertTrue(os.path.exists(filename1))
Expand Down

0 comments on commit de87a23

Please sign in to comment.