Skip to content

Commit 7c85e20

Browse files
authored
nuget python 打包 Windows embeddable package (Tencent#2269)
* nuget 设置 Python 为 3.14 * nuget python 打包 Windows embeddable package * test * fix
1 parent 9632fa8 commit 7c85e20

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.github/workflows/build_nuget.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ jobs:
2929

3030
steps:
3131
- uses: actions/checkout@v4
32-
32+
- uses: actions/setup-python@v6
33+
with:
34+
python-version: '3.14'
35+
3336
- name: Install libc++-dev (Linux only)
3437
if: runner.os == 'Linux'
3538
run: |
@@ -115,17 +118,15 @@ jobs:
115118
if ("${{ matrix.platform }}" -eq "osx" -and (Test-Path "unity/upms/nodejs/Plugins/macOS")) {
116119
Move-Item -Path "unity/native/papi-nodejs/.backends/papi-nodejs/lib/macOS/libnode.93.dylib" -Destination "unity/upms/nodejs/Plugins/macOS/libnode.93.dylib" -Force
117120
}
118-
# Remove python's PuertsCore.dll on Windows
119121
if ("${{ matrix.platform }}" -eq "win") {
122+
# Remove python's PuertsCore.dll on Windows
120123
$puertsCorePath = "unity/native/papi-python/build_win_x64_papi-python/Release/PuertsCore.dll"
121124
if (Test-Path $puertsCorePath) {
122125
Remove-Item $puertsCorePath -Force
123126
Write-Host "Removed $puertsCorePath to avoid duplicate PuertsCore.dll."
124127
}
125128
}
126129
shell: pwsh
127-
128-
129130

130131
- name: Upload all native artifacts
131132
uses: actions/upload-artifact@v4
@@ -173,6 +174,14 @@ jobs:
173174
ls unity/nuget/downloaded_natives
174175
tree unity/nuget/downloaded_natives /F
175176
shell: pwsh
177+
- name: Download Python
178+
run: |
179+
$destPath = "unity\nuget\downloaded_natives\natives-win-x64\native\papi-python\build_win_x64_papi-python\Release"
180+
$downloadedEmbedZip = "$env:TEMP\python-3.14.2-embed-amd64.zip"
181+
$downloadUrl = "https://www.python.org/ftp/python/3.14.2/python-3.14.2-embed-amd64.zip"
182+
Invoke-WebRequest -Uri $downloadUrl -OutFile $downloadedEmbedZip
183+
Expand-Archive -Path $downloadedEmbedZip -DestinationPath $destPath -Force
184+
shell: pwsh
176185
- name: Run NuGet Packaging and Publishing
177186
if: ${{ github.event.inputs.publish == 'true' }}
178187
run: |

unity/nuget/Puerts.Python.NativeAssets.Win32/Puerts.Python.NativeAssets.Win32.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Import Project="..\NoAssemblyOutputs.Common.props" />
99

1010
<ItemGroup>
11-
<None Include="lib\**\*.dll" Pack="True" PackagePath="runtimes\" />
11+
<None Include="lib\**\*.*" Pack="True" PackagePath="runtimes\" />
1212
</ItemGroup>
1313

1414
</Project>

unity/nuget/build/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,10 @@ public override void Run(BuildContext context)
8080
// Transform
8181
var nativeAssetsDirectory = context.NativeAssetsDirectory;
8282

83+
// Handle macOS natives
8384
foreach (var projectItem in WellKnownProjects.NativeAssetsProjects)
8485
{
85-
if (projectItem.CmakeRid != "osx" && projectItem.CmakeRid != "osx-arm64")
86+
if (!projectItem.CmakeRid.Contains("osx"))
8687
{
8788
continue;
8889
}

0 commit comments

Comments
 (0)