zestsoftware / zest.releaser

Python software releasing made easy and repeatable
https://zestreleaser.readthedocs.io
GNU General Public License v2.0
198 stars 62 forks source link

Fix #259: lineendings are properly handled on windows now #304

Closed reinout closed 5 years ago

reinout commented 5 years ago

We do a .splitlines() in read_text_file() now. This function uses rb mode to get binary data in order to properly detect encodings, so there's no automatic "universal newline" behaviour. With .splitlines() we get that behaviour back.

The accompanying write_text_file() already uses the regular w mode, so "universal newline" behaviour is on already there.

The advantage is that it removes some dirty-looking redefinitions like this:

lines = read_text_file(...)
lines = lines.split('\n')
reinout commented 5 years ago

I see a problem: the splitlines() version strips trailing newlines, something that `.split('\n') doesn't do.

So I see a diff like this:

diff --git a/setup.py b/setup.py
index 8f14dcb..57d13a6 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ from setuptools import find_packages
 from setuptools import setup

-version = '6.15.5.dev0'
+version = '6.16.0.dev0'

 def read(filename):
@@ -110,4 +110,4 @@ setup(name='zest.releaser',
       ],

       },
-      )
+      )
\ No newline at end of file
reinout commented 5 years ago

Yeah it works now. The diff I showed earlier was what I got out of "bumpversion" for zest.releaser itself. So bumpversion removed the newline at the end of our own setup.py and changelog. Now it works, see the version bump I just pushed :-)

mauritsvanrees commented 5 years ago

Go ahead and make a release, unless you have other changes planned.