You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e9c9557
Browse filesBrowse the repository at this point in the historyBrowse files
* This file is part of the Buildings and Habitats object Model (BHoM)
3
+
* Copyright (c) 2015 - 2026, the respective contributors. All rights reserved.
4
+
*
5
+
* Each contributor holds copyright over their respective contributions.
6
+
* The project versioning (Git) records all such contribution source information.
7
+
*
8
+
*
9
+
* The BHoM is free software: you can redistribute it and/or modify
10
+
* it under the terms of the GNU Lesser General Public License as published by
11
+
* the Free Software Foundation, either version 3.0 of the License, or
12
+
* (at your option) any later version.
13
+
*
14
+
* The BHoM is distributed in the hope that it will be useful,
15
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+
* GNU Lesser General Public License for more details.
18
+
*
19
+
* You should have received a copy of the GNU Lesser General Public License
20
+
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
21
+
*/
22
+
23
+
usingBH.oM.Base;
24
+
usingBH.oM.Base.Attributes;
25
+
usingBH.oM.Python;
26
+
usingBH.oM.Python.Enums;
27
+
usingSystem;
28
+
usingSystem.Collections.Generic;
29
+
usingSystem.ComponentModel;
30
+
usingSystem.Diagnostics;
31
+
usingSystem.IO;
32
+
usingSystem.Linq;
33
+
usingSystem.Text;
34
+
35
+
namespaceBH.Engine.Python
36
+
{
37
+
publicstaticpartialclassCompute
38
+
{
39
+
[Description("Using the environment name (and version if the environment name is the base python environment), directly install/update missing BHoM packages.")]
40
+
[Input("environmentName","The name of the environment to update.")]
41
+
[Input("version","If the environment name is the name of the base python environment, the version that needs updating.")]
//construct the expected PythonEnvironment and pass to UpdateBHoMPackages
45
+
PythonEnvironmentenv=newPythonEnvironment()
46
+
{
47
+
Name=environmentName,
48
+
};
49
+
50
+
//python version is only used if the environment name is this toolkits name.
51
+
if(environmentName==Query.ToolkitName())
52
+
{
53
+
if(version==PythonVersion.Undefined)
54
+
{
55
+
BH.Engine.Base.Compute.RecordError("The version must be specified when updating BHoM packages for a base python environment. No updates have occurred.");
BH.Engine.Base.Compute.RecordError($"Given environment or base install {environment.Executable} does not exist.");
76
+
return;
77
+
}
78
+
79
+
//`python -m pip list -e --format json` lists all environment packages that are editable installs.
80
+
//As all BHoM packages are editable installs, this handily lists all the packages that should be updated if necessary.
81
+
//side effect of updating other editable installs if they have changed, but I suspect this won't be a problem as anyone who has these would update packages manually instead.
0 commit comments