-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
Fix EOL formatting on Windows #407
Conversation
To make this easier to test @nicoddemus , I went ahead and merged this with PR ( #401 ). Will back that out once we are done testing. Please let me know if this stops conversion of everything to CRLF. |
Thanks @jakirkham. Re-rendered It is still changing the line endings of the local files though:
Looking at my local files, I see their line endings are still CRLF. I think the way conda-smithy is rendering the files is messing with Git's autocrlf setting, which in my case is the default ( How does conda-smithy write the text of the files to disk? It seems that just reading/writing
Update: took a cursory glance at the code, it seems it does the write thing on the |
The local files still have CRLF, but does the cache? In any event, I agree with you that this is still not a fix. Though we may be making some progress if the cache is at least correct. |
I'm pretty sure it does because I remember just doing a |
Yeah, now that I think about it, you are probably right. I'll take a closer look at this tomorrow. |
So I don't see lots of calls to |
Rá, bingo! nicoddemus/py-feedstock@9db93cc And my local copy, after creating a fresh branch off
That seems to do it! 🎉 The last tweak, the recommended message should use
Thanks a lot @jakirkham! 😁 |
Sounds reasonable. Would you be willing to do a PR? 😉 |
Glad to see it is working. One question though. In your example, it seems to have the |
In any event, glad we seem to have figured out what was going on and fixed it. Will try to investigate this odd test failure now. |
Sure, will do it right away. 😁
Oops that was my bad. I merged with my local changes (which contained 2178f18) to your fork at 3d804b3, instead of resetting to it. After I reset |
Opened a PR at #408 |
Phew. 😅 Good to know that was not needed. |
for line in fh_src: | ||
fh_dst.write(line) | ||
|
||
shutil.copymode(src, dst) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I had added this to ensure all files that we copy from conda-smithy
have the right line endings. However, I expect we probably don't need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be needed as demonstrated by the comment below. Otherwise files that have been copied end up with the wrong EOL formatting.
Thanks so much for your help testing this @nicoddemus . If it isn't too much to ask, would you mind doing one more test? I had some code that forced line endings of copied files that I wanted to try removing. If this still works ok without it, I'd like to not include it. |
Not at all, glad I can help!
Rerendering with the latest commit in this branch unfortunately changes the line endings of these files: |
Thanks @nicoddemus . That is very helpful. I have added back the commit that reads and then writes each file to the destination to copy them. So this should be back to working order. |
Thanks @jakirkham, here's the rerender for the last commit in this branch: nicoddemus/py-feedstock@f0e598e So I think this is good to go. 👍 |
Also note to future self and future others, this assumes the LF is the only EOL character that should be used and it should be used everywhere. This works now as everything does use LF currently. However, that may not be the case in the future if say batch files were included in the feedstock files (not the recipe). This should be an easy fix for writing files as we can expose the |
This has been included into the config channels PR ( #401 ) explicitly. |
This configures git to normalize more line endings to avoid differences caused by a user's development environment (e.g. Windows vs. Unix). By doing this, we can be sure to get LF in all the cases we were already accustomed to having them. With Windows specific files (e.g. Batch files), we use CRLF as Windows would expect. This extends it beyond simply
bld.bat
as was the case before.