Skip to content

Commit 6d530c1

Browse files
author
rdeioris
committed
honour PYTHONHOME in build procedure
1 parent f90e2e2 commit 6d530c1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Source/UnrealEnginePython/UnrealEnginePython.Build.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
using UnrealBuildTool;
44
using System.IO;
5+
using System.Collections.Generic;
56

67
public class UnrealEnginePython : ModuleRules
78
{
@@ -157,7 +158,13 @@ public UnrealEnginePython(TargetInfo Target)
157158

158159
private string DiscoverPythonPath(string[] knownPaths)
159160
{
160-
foreach (string path in knownPaths)
161+
// insert the PYTHONHOME content as the first known path
162+
List<string> paths = new List<string>(knownPaths);
163+
string environmentPath = System.Environment.GetEnvironmentVariable("PYTHONHOME");
164+
if (!string.IsNullOrEmpty(environmentPath))
165+
paths.Insert(0, environmentPath);
166+
167+
foreach (string path in paths)
161168
{
162169
string headerFile = Path.Combine(path, "include", "Python.h");
163170
if (File.Exists(headerFile))

0 commit comments

Comments
 (0)