Skip to content

Commit

Permalink
Merge pull request #2443 from hanagasira/nuget_python_fix
Browse files Browse the repository at this point in the history
nuget python package error fix
  • Loading branch information
nickclark2016 authored Mar 12, 2025
2 parents 62b9bc7 + 116c515 commit 6385739
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
3 changes: 2 additions & 1 deletion modules/vstudio/tests/vc2010/test_ensure_nuget_imports.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

if http ~= nil and _OPTIONS["test-all"] then
function suite.structureIsCorrect()
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3", "WinPixEventRuntime:1.0.220810001", "Microsoft.Direct3D.D3D12:1.608.2" }
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3", "WinPixEventRuntime:1.0.220810001", "Microsoft.Direct3D.D3D12:1.608.2", "python:3.13.2" }
prepare()
test.capture [[
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand All @@ -57,6 +57,7 @@ if http ~= nil and _OPTIONS["test-all"] then
<Error Condition="!Exists('packages\WinPixEventRuntime.1.0.220810001\build\WinPixEventRuntime.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\WinPixEventRuntime.1.0.220810001\build\WinPixEventRuntime.targets'))" />
<Error Condition="!Exists('packages\Microsoft.Direct3D.D3D12.1.608.2\build\native\Microsoft.Direct3D.D3D12.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Direct3D.D3D12.1.608.2\build\native\Microsoft.Direct3D.D3D12.props'))" />
<Error Condition="!Exists('packages\Microsoft.Direct3D.D3D12.1.608.2\build\native\Microsoft.Direct3D.D3D12.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Direct3D.D3D12.1.608.2\build\native\Microsoft.Direct3D.D3D12.targets'))" />
<Error Condition="!Exists('packages\python.3.13.2\build\native\python.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\python.3.13.2\build\native\python.props'))" />
</Target>
]]
end
Expand Down
3 changes: 2 additions & 1 deletion modules/vstudio/tests/vc2010/test_extension_settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@

if http ~= nil and _OPTIONS["test-all"] then
function suite.importOnlyNugetPackagesWithProps()
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3", "WinPixEventRuntime:1.0.220810001", "Microsoft.Direct3D.D3D12:1.608.2" }
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3", "WinPixEventRuntime:1.0.220810001", "Microsoft.Direct3D.D3D12:1.608.2", "python:3.13.2" }
prepare()
test.capture [[
<ImportGroup Label="ExtensionSettings">
<Import Project="packages\Microsoft.Direct3D.D3D12.1.608.2\build\native\Microsoft.Direct3D.D3D12.props" Condition="Exists('packages\Microsoft.Direct3D.D3D12.1.608.2\build\native\Microsoft.Direct3D.D3D12.props')" />
<Import Project="packages\python.3.13.2\build\native\python.props" Condition="Exists('packages\python.3.13.2\build\native\python.props')" />
</ImportGroup>
]]
end
Expand Down
2 changes: 1 addition & 1 deletion modules/vstudio/tests/vc2010/test_extension_targets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

if http ~= nil and _OPTIONS["test-all"] then
function suite.addsImport_onEachNuGetPackage()
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3", "WinPixEventRuntime:1.0.220810001", "Microsoft.Direct3D.D3D12:1.608.2" }
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3", "WinPixEventRuntime:1.0.220810001", "Microsoft.Direct3D.D3D12:1.608.2", "python:3.13.2" }
prepare()
test.capture [[
<ImportGroup Label="ExtensionTargets">
Expand Down
3 changes: 2 additions & 1 deletion modules/vstudio/tests/vc2010/test_nuget_packages_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
--

function suite.structureIsCorrect()
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3", "WinPixEventRuntime:1.0.220810001", "Microsoft.Direct3D.D3D12:1.608.2" }
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3", "WinPixEventRuntime:1.0.220810001", "Microsoft.Direct3D.D3D12:1.608.2", "python:3.13.2" }
prepare()
test.capture [[
<?xml version="1.0" encoding="utf-8"?>
Expand All @@ -54,6 +54,7 @@
<package id="sdl2.v140.redist" version="2.0.3" targetFramework="native" />
<package id="WinPixEventRuntime" version="1.0.220810001" targetFramework="native" />
<package id="Microsoft.Direct3D.D3D12" version="1.608.2" targetFramework="native" />
<package id="python" version="3.13.2" targetFramework="native" />
</packages>
]]
end
27 changes: 23 additions & 4 deletions modules/vstudio/vs2010_nuget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,30 @@

for _, page in ipairs(response.items) do
if not page.items or #page.items == 0 then
p.error("Failed to understand NuGet API response (got a page with no items for package '%s')", id)
end
local itemResponse, err, code = http.get(page["@id"])
if err ~= "OK" then
if code == 404 then
p.error("NuGet package '%s' for project '%s' couldn't be found in the repository", id, prj.name)
else
p.error("NuGet API error (%d)\n%s", code, err)
end
end

for _, item in ipairs(page.items) do
table.insert(items, item)
itemResponse, err = json.decode(itemResponse)
if not itemResponse then
p.error("Failed to decode NuGet API response (%s)", err)
end
if not itemResponse.items or #itemResponse.items == 0 then
p.error("Failed to understand NuGet API response (got a page with no items for package '%s')", id)
end

for _, item in ipairs(itemResponse.items) do
table.insert(items, item)
end
else
for _, item in ipairs(page.items) do
table.insert(items, item)
end
end
end

Expand Down

0 comments on commit 6385739

Please sign in to comment.