Skip to content
This repository was archived by the owner on Jan 6, 2021. It is now read-only.

Commit b67f7aa

Browse files
committed
minor name change in self-distributing module
1 parent 36e81ae commit b67f7aa

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

Component/PythonEnvironment.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ namespace GhPython.Component
1010
{
1111
public class PythonEnvironment
1212
{
13+
internal const string GHPYTHONLIB_NAME = "ghpythonlib";
14+
1315
internal PythonEnvironment(GH_Component component, PythonScript script)
1416
{
1517
Component = component;
@@ -105,9 +107,19 @@ public void AddGhPythonPackage()
105107
IList list = GetIntellisenseList();
106108
if (list == null) return;
107109

108-
// add gh_python package
109-
if (!list.Contains("gh_python"))
110-
list.Add("gh_python");
110+
bool contained = false;
111+
for (int i = 0; i < list.Count; i++)
112+
{
113+
var itemString = list[i] as string;
114+
if (itemString == null) continue;
115+
116+
if (itemString.Equals(GHPYTHONLIB_NAME, StringComparison.InvariantCulture))
117+
contained = true;
118+
}
119+
120+
// adds package
121+
if (!contained)
122+
list.Add(GHPYTHONLIB_NAME);
111123
}
112124

113125
private IList GetIntellisenseList()

Component/ScriptingAncestorComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private static void UnpackScriptResources()
8282
// if we get to here, we need to unpack the resources
8383
if (!Directory.Exists(settings_directory))
8484
Directory.CreateDirectory(settings_directory);
85-
string ghpython_package_dir = Path.Combine(settings_directory, "lib", "gh_python");
85+
string ghpython_package_dir = Path.Combine(settings_directory, "lib", PythonEnvironment.GHPYTHONLIB_NAME);
8686
if (Directory.Exists(ghpython_package_dir))
8787
Directory.Delete(ghpython_package_dir, true);
8888
Directory.CreateDirectory(ghpython_package_dir);

package/components.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def function_description(description, params):
9090
return '\n'.join(rc)
9191

9292
import sys, types, re
93-
core_module = sys.modules['gh_python.components']
93+
core_module = sys.modules['ghpythonlib.components']
9494
translate_from = u"|+-*\u2070\u00B9\u00B2\u00B3\u2074\u2075\u2076\u2077\u2078\u2079"
9595
translate_to = "X__x0123456789"
9696
transl = dict(zip(translate_from, translate_to))

0 commit comments

Comments
 (0)