Thanks to visit codestin.com
Credit goes to github.com

Skip to content

List installed Win10 SDK's when looking for windows sdk tool #838

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

Merged
merged 2 commits into from
Apr 5, 2019

Conversation

OneBlue
Copy link

@OneBlue OneBlue commented Apr 2, 2019

What does this implement/fix? Explain your changes.

When I try to run setup.py install, the installation failed with the following error:

RuntimeError: mt.exe could not be found

Because setup.py is searching for specific versions of the Windows 10 sdk.

This patch changes that behaviour to use the installed Windows 10 sdk instead of relying on specific versions.

Does this close any currently open issues?

No.

Any other comments?

I kept the existing hard-coded sdk version to ensure that this is a non-breaking change.

The objective of this patch is make installation easier.

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

@codecov
Copy link

codecov bot commented Apr 2, 2019

Codecov Report

Merging #838 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #838      +/-   ##
==========================================
+ Coverage   76.67%   76.72%   +0.05%     
==========================================
  Files          64       64              
  Lines        5928     5943      +15     
  Branches      978      978              
==========================================
+ Hits         4545     4560      +15     
  Misses       1052     1052              
  Partials      331      331
Flag Coverage Δ
#setup_linux 65.43% <12.5%> (-3.12%) ⬇️
#setup_windows 75.95% <100%> (+0.06%) ⬆️
Impacted Files Coverage Δ
setup.py 86.91% <100%> (+0.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4919915...a4318e1. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Apr 2, 2019

Codecov Report

Merging #838 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #838      +/-   ##
==========================================
+ Coverage   76.67%   76.72%   +0.05%     
==========================================
  Files          64       64              
  Lines        5928     5943      +15     
  Branches      978      978              
==========================================
+ Hits         4545     4560      +15     
  Misses       1052     1052              
  Partials      331      331
Flag Coverage Δ
#setup_linux 65.43% <12.5%> (-3.12%) ⬇️
#setup_windows 75.95% <100%> (+0.06%) ⬆️
Impacted Files Coverage Δ
setup.py 86.91% <100%> (+0.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4919915...a4318e1. Read the comment docs.

@filmor
Copy link
Member

filmor commented Apr 5, 2019

Thank you very much :)

I'm going to merge this for now, I'm just wondering whether we'll need this in the future. In PR #830 I've experimented with vswhere which is available on newer VS installations, would that work for you as well?

@filmor filmor merged commit 501cbbe into pythonnet:master Apr 5, 2019
@OneBlue
Copy link
Author

OneBlue commented Apr 5, 2019

Looking at #830, using vswhere is a much better solution.

I'm not sure when was vswhere introduced so I would recommend keeping the current logic as a fallback in case vswhere is not available on the machine.

@den-run-ai
Copy link
Contributor

@OneBlue a copy of vswhere is included with pythonnet in tools. Can you try updating that version and see if it resolves your issue?

@OneBlue
Copy link
Author

OneBlue commented Apr 6, 2019

The tool that wasn't found was mt.exe, which is looked up like this:

mt = self._find_msbuild_tool("mt.exe", use_windows_sdk=True)

This code path doesn't use vswhere (because use_windows_sdk is True). So updating vswhere won't fix the problem.

I also tried to checkout #830, but when I tried to build, I got:

running install
running build
running build_ext
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 06/04/2019 12:35:47.
Project "C:\Users\Blue\Desktop\repos\pythonnet\pythonnet.sln" on node 1 (Clean target(s)).
ValidateSolutionConfiguration:
  Building solution configuration "ReleaseWin|x64".
Project "C:\Users\Blue\Desktop\repos\pythonnet\pythonnet.sln" (1) is building "C:\Users\Blue\Desktop\repos\pythonnet\src\testing\Python.Test.csproj" (2) on node 1 (Clean target(s)).
Project "C:\Users\Blue\Desktop\repos\pythonnet\src\testing\Python.Test.csproj" (2) is building "C:\Users\Blue\Desktop\repos\pythonnet\src\testing\Python.Test.csproj" (2:2) on node 1 (Clean target(s)).
CoreClean:
  Creating directory "obj\x64\ReleaseWin\".
Project "C:\Users\Blue\Desktop\repos\pythonnet\src\testing\Python.Test.csproj" (2:2) is building "C:\Users\Blue\Desktop\repos\pythonnet\src\runtime\Python.Runtime.csproj" (3:2) on node 1 (Clean target(s)).
CoreClean:
  Creating directory "obj\ReleaseWin\".
Done Building Project "C:\Users\Blue\Desktop\repos\pythonnet\src\runtime\Python.Runtime.csproj" (Clean target(s)).

Done Building Project "C:\Users\Blue\Desktop\repos\pythonnet\src\testing\Python.Test.csproj" (Clean target(s)).

Project "C:\Users\Blue\Desktop\repos\pythonnet\src\testing\Python.Test.csproj" (2) is building "C:\Users\Blue\Desktop\repos\pythonnet\src\testing\Python.Test.csproj" (2:3) on node 1 (Clean target(s)).
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets(126,5): error : The current .NET SDK does not support targeting .NET Standard 2.0.  Either  target .NET Standard 1.6 or lower, or use a version of the .NET SDK that supports .NET Standard 2.0. [C:\Users\Blue\Desktop\repos\pythonnet\src\testing\Python.Test.csproj]

While master builds correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants