-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nox -s vendoring -- --upgrade fails on Windows #9462
Comments
Ping @pradyunsg |
What's the value of |
"". Because we have extra blank lines in the file. |
This works on macOS, with current versions of everything, so it could be Windows only, perhaps? ( |
It is Windows only, it's a line ending issue as far as I can tell. |
The current version does not work on Windows, as reported by @pfmoore in pypa/pip#9462. Files opened in text mode should not have the native line ending applied - Python normalizes this for you. Quick demo of problem: ```python from pathlib import Path from os import linesep txt = Path("tmp.txt") with txt.open("w", encoding="utf-8") as f: f.writelines(f"{p}{linesep}" for p in range(3)) with txt.open(encoding="utf-8") as f: print(f.read()) ``` Produces empty lines between outputs, but only Windows (due to the separator there).
I submitted #9537 to make the parsing part more resilient on pip’s end. |
The problem seen by @pfmoore should be fixed by pradyunsg/vendoring#27. Vendoring is using os.linesep on a file opened in text mode, which causes double line breaks on Windows. Do you want this to silently pass and succeed if there are extra blank lines? They shouldn't be there in the first place. :) PS: That is a question, I don't know the correct answer. If it never gets saved with blank lines, then it likely doesn't matter. |
I do think the parser should be less brittle. Empty lines are not unreasonable to allow in a file listing requirements no matter what. |
Environment
Description
Using
nox -s vendoring -- --upgrade
on Windows, causes extra newlines to be added tovendor.txt
, resulting in the process failing.Expected behavior
The process works on Windows.
How to Reproduce
nox -s vendoring -- --upgrade
on a Windows system.Output
I suspect the issue is two-fold: the nox session doesn't handle blank lines in
vendor.txt
, but also something (possibly the vendoring tool?) is writing unnecessary blank lines?The text was updated successfully, but these errors were encountered: