Skip to content

Commit 6d0d1fc

Browse files
authored
8.1 Deployment (#173)
2 parents 11fed04 + 084c7b0 commit 6d0d1fc

28 files changed

+95
-45
lines changed

.ci/BHoMBot/Nuget/BHoM.Interop.Python.nuspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
<dependency id="NETStandard.Library" version="2.0.3" />
2020
</group>
2121
</dependencies>
22+
<contentFiles>
23+
<files include="any\any\PythonEnvironment\**\*" buildAction="Content" copyToOutput="true" flatten="false"/>
24+
</contentFiles>
2225
</metadata>
2326
<files>
24-
<file src="C:\ProgramData\BHoM\Extensions\PythonCode\Python_Toolkit\src\python_toolkit\bhom\wrapped\**\*.*" exclude="**\__pycache__\*;**\docs\**\*" target="contentFiles\any\any\PythonCode\Python_Toolkit\src\python_toolkit\bhom\wrapped"/>
2527
<file src="C:\ProgramData\BHoM\Extensions\PythonCode\Python_Toolkit\src\**\*.*" exclude="**\__pycache__\*;**\docs\**\*" target="contentFiles\any\any\PythonEnvironment\Lib\site-packages" />
2628
<file src="licence/licence.txt" target="" />
2729
<file src="images/icon.png" target="" />

Python_Engine/Compute/BasePythonEnvironment.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of the Buildings and Habitats object Model (BHoM)
3-
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
3+
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
44
*
55
* Each contributor holds copyright over their respective contributions.
66
* The project versioning (Git) records all such contribution source information.
@@ -33,7 +33,6 @@ namespace BH.Engine.Python
3333
{
3434
public static partial class Compute
3535
{
36-
[PreviousVersion("8.0", "BH.Engine.Python.Compute.BasePythonEnvironment(System.Boolean, System.Boolean)")]
3736
[Description("Retrieve or reinstall the base Python Environment for BHoM workflows.")]
3837
[Input("version", "The target version of python to be installed or retrieved.")]
3938
[Input("reload", "Reload the base Python environment rather than recreating it, if it already exists.")]
@@ -79,3 +78,4 @@ public static PythonEnvironment BasePythonEnvironment(
7978
}
8079
}
8180

81+

Python_Engine/Compute/Download.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of the Buildings and Habitats object Model (BHoM)
3-
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
3+
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
44
*
55
* Each contributor holds copyright over their respective contributions.
66
* The project versioning (Git) records all such contribution source information.
@@ -89,7 +89,6 @@ public static string DownloadFile(
8989

9090
/******************************************************/
9191

92-
[PreviousVersion("8.0", "BH.Engine.Python.Compute.DownloadPython(BH.oM.Python.Enums.PythonVersion, System.String)")]
9392
[Description("Download and install a specified version of python, and return the executable for it.")]
9493
[Input("version", "The version of python to download.")]
9594
[Output("pythonExecutable", "The executable (python.exe) for the python version that was installed")]
@@ -133,8 +132,19 @@ public static string DownloadPythonVersion(this PythonVersion version)
133132
}
134133
}
135134

136-
return Path.Combine(basePath, "python.exe");
135+
string pythonExePath = Path.Combine(basePath, "python.exe");
136+
137+
// It is possible for the installer to exit with ExitCode==0 without installing Python in the requested location. This can happen if the same version of Python appears to be installed elsewhere on the system. It can also happen if there was a 'dodgy' uninstall of a previous version. We've been unable to figure out where the installer is actually looking for existing installs. To fix dodgy uninstalls, run the installer again for the target version of Python (download links within EmbeddableURL.cs) and run a combination of 'repair' and 'uninstall' until it's gone. Installing the py launcher (via 'modify' in the installer) before attempting to uninstall could also help.
138+
139+
if (!File.Exists(pythonExePath))
140+
{
141+
BH.Engine.Base.Compute.RecordError($"The Python installer appears to have completed successfully, but \n{pythonExePath} does not exist. \nThis usually means that Python {version} already exists on your machine, but in a different location. \nThis toolkit is therefore unable to run any Python commands right now. \nTry uninstalling Python {version} from your system before running this BHoM method again.");
142+
return null;
143+
}
144+
145+
return pythonExePath;
137146
}
138147
}
139148
}
140149

150+

Python_Engine/Compute/InstallPackage.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of the Buildings and Habitats object Model (BHoM)
3-
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
3+
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
44
*
55
* Each contributor holds copyright over their respective contributions.
66
* The project versioning (Git) records all such contribution source information.
@@ -177,3 +177,4 @@ string packageDirectory
177177
}
178178
}
179179

180+

Python_Engine/Compute/Remove.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of the Buildings and Habitats object Model (BHoM)
3-
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
3+
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
44
*
55
* Each contributor holds copyright over their respective contributions.
66
* The project versioning (Git) records all such contribution source information.
@@ -81,7 +81,6 @@ public static void RemoveAllVirtualEnvironments()
8181
}
8282
}
8383

84-
[PreviousVersion("8.0", "BH.Engine.Python.Compute.RemoveBaseEnvironment()")]
8584
[Description("Remove the base install for the python version specified.")]
8685
[Input("version", "The base python version to remove.")]
8786
public static void RemoveBaseVersion(PythonVersion version = PythonVersion.v3_10)
@@ -139,3 +138,4 @@ public static void RemoveEverything()
139138
}
140139
}
141140

141+

Python_Engine/Compute/RequirementsTxt.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of the Buildings and Habitats object Model (BHoM)
3-
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
3+
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
44
*
55
* Each contributor holds copyright over their respective contributions.
66
* The project versioning (Git) records all such contribution source information.
@@ -85,3 +85,4 @@ public static string RequirementsTxt(
8585
}
8686
}
8787

88+

Python_Engine/Compute/Run.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of the Buildings and Habitats object Model (BHoM)
3-
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
3+
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
44
*
55
* Each contributor holds copyright over their respective contributions.
66
* The project versioning (Git) records all such contribution source information.
@@ -99,3 +99,4 @@ public static string RunPythonString(this oM.Python.PythonEnvironment env, strin
9999
}
100100
}
101101

102+

Python_Engine/Compute/UnzipFile.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of the Buildings and Habitats object Model (BHoM)
3-
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
3+
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
44
*
55
* Each contributor holds copyright over their respective contributions.
66
* The project versioning (Git) records all such contribution source information.
@@ -82,3 +82,4 @@ public static void UnzipFile(
8282
}
8383
}
8484

85+

Python_Engine/Compute/VirtualEnvironment.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of the Buildings and Habitats object Model (BHoM)
3-
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
3+
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
44
*
55
* Each contributor holds copyright over their respective contributions.
66
* The project versioning (Git) records all such contribution source information.
@@ -127,3 +127,4 @@ public static PythonEnvironment VirtualEnvironment(this PythonVersion version, s
127127
}
128128
}
129129

130+

Python_Engine/Convert/ToPython.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/*
1+
/*
22
* This file is part of the Buildings and Habitats object Model (BHoM)
3-
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
3+
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
44
*
55
* Each contributor holds copyright over their respective contributions.
66
* The project versioning (Git) records all such contribution source information.
@@ -38,4 +38,4 @@ public static bool ToPython<T>(this T[,] input)
3838
return false;
3939
}
4040
}
41-
}
41+
}

0 commit comments

Comments
 (0)