-
Notifications
You must be signed in to change notification settings - Fork 421
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
Attempting to improve the logic for VS on Win #861
Conversation
Both VS9 and VS10 do not work out of the box for 64-bit builds. This should try and remedy that. For VS9 it prefers the Microsoft Visual C++ Compiler for Python 2.7 and when falling back VS9 will call the correct bat file manually, rather than relying on the broken logic in vcvarsall.bat. For VS10, it will correctly call the Windows SDK rather than relying on the also potentially incorrect vcvarsall.bat.
@msarahan, looks like there is a PR for straightening this out. 😉 |
This is excellent work @patricksnape Testing this would be hard without something like vagrant + salt. I think an adequate substitute might be something like this pseudocode:
I can put that together later tonight - or if you want to pick it up, that works too. Post here if you want to work on that, so I don't duplicate your effort. |
Given the timezone difference, he might already be asleep. |
Sure. Any comment on the test strategy I proposed, @jakirkham? |
Tests being done at patricksnape#1 |
Sorry, was out of action as @jakirkham correctly guessed. Merged @msarahan's awesome testing suite to keep the action over here. As previously mentioned, would be really good to make 100% this still works before merging! |
No problem. Github is not realtime communication. I just wanted to make sure to not duplicate effort. To get appveyor going on this, we need to set up appveyor here (conda-build). This is long overdue. I'll see what I can do about it. I'm a little skeptical of my test suite though. I realized that I had my logic inverted here: https://github.com/conda/conda-build/pull/861/files#diff-910f3184f6aa73a494bd48608b5a8bf7R43 anything that is not in good locations should error out. At least some of the tests should have been failing. When I flip that logic, the tests still all pass. I thought it might be the calling syntax, but this checks out OK:
I changed to exit /b 1 so that it didn't kill my prompt. Any ideas on a better test here? Any suggestions on how i'm ending up always passing? |
I'm working on Appveyor restoration here: #864 If you pull in that branch, you might be able to utilize it before that PR gets merged. |
#864 is merged. I'll keep playing with the tests - I'm now also testing the tests to make sure we aren't getting meaningless passes. |
@patricksnape the tests are now "fixed" - but it warrants a little further discussion. The tests are a little dumb: they lack some of the encoding about when it's OK to have one but not the other. For example, the VC for Python overrides Visual Studio, but that override is a failing test right now, because the tests are testing that a particular environment gets activated when all environments are present. Is this a good way to do tests? If so, we can correct the code by making it do more try/except stuff, actually trying to run scripts rather than just verifying that they exist. |
OK I had a look, agree with most of the changes. I can see where you are coming from w.r.t the VS 2008 Express changes - however, if we don't want to explicitly perform that, I believe we should maybe print a warning at least? Or I fear you will get a lot of people who will run into the error and start raising bugs - maybe we write it in the Wiki and then somehow direct people there? Or maybe when we detect a setup error in Windows at all we try and route them to the Wiki where we can answer many questions? |
Fix tests - remove explicit failure when no bat found
Before merging this, one thing I would like to do is set up a dummy CMake project and make sure that CMake finds the correct VS on Appveyor in each case and is actually able to build. For example, the VS 2008 workaround I have has not been tested though logically it should work. |
Great. That sounds like a good additional test. Ping me when you're ready. IMHO this is ready to merge now, but that will further improve this PR. |
I guess the harder part about that is that you actually have to have all the compilers installed to test them. So, it'll be valuable on AppVeyor, but I'd like to limit that test to being something that we manually enable on the command line, so that it doesn't trip up testing on other, less complete build platforms (like my computer) |
Also, cleaned the file up to a be more consistent, 80 chars width and using append rather than '\n' for building the command. Main issue is that the Windows SDK command was wrong AND calling vcvarsall.bat doesn't EXIT 1 - it just EXIT 0. Therefore, try calling the Windows SDK no matter what!
Was defaulting to C: which was wrong.
The tests pointed this out to me - use 'os.path.abspath(os.sep)' as a trick to get the current drive.
We always call the Windows SDK now.
OK, that took me longer than I would have liked. Here are the things that I've learnt:
In short, It looks like a bunch of changes but a lot of it was just cleaning up - the list of changes is:
Finally, make sure that this actually all works using this test harness which Appveyor builds here - which now successfully build. As a note, this just tests that it successfully builds - I am just manually checking the correct compiler at the moment from the NMake output. Also, I am not checking the Therefore, I think I am now happy with this, barring the possible |
Time well spent! That's a lot of valuable information, and a lot of bad assumptions on my part. Thanks for digging in. I'll merge once appveyor finishes. |
Squash if you want, but it's fine as is. |
Thanks @patricksnape, this was a bad bug, and you have greatly improved this code. |
I added a note about the NMake/VS9 with Python tools to the Wiki. |
Sorry, I missed this comment, @msarahan. I think the test strategy sounds reasonable and agree. Thanks so much @patricksnape and @msarahan for working on this and getting it integrated into conda-build. 😄 |
thanks! |
Both VS9 and VS10 do not work out of the box for 64-bit builds.
This should try and remedy that. For VS9 it prefers the
Microsoft Visual C++ Compiler for Python 2.7 and when
falling back VS9 will call the correct bat file manually, rather
than relying on the broken logic in vcvarsall.bat.
For VS10, it will correctly call the Windows SDK rather than
relying on the also potentially incorrect vcvarsall.bat.
This was pretty difficult to test in my VM because I broke
it trying to test the different combinations. I need to create
a clean image and try each of the scenarios.
What would be the best way to test this? I guess builds
need to be kicked off on Appveyor?