| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -228,6 +228,7 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true, | |||
| 228 | 228 | Assembly assembly = Assembly.GetExecutingAssembly(); | |
| 229 | 229 | // add the contents of clr.py to the module | |
| 230 | 230 | string clr_py = assembly.ReadStringResource("clr.py"); | |
| 231 | + | ||
| 231 | 232 | Exec(clr_py, module_globals, locals.Reference); | |
| 232 | 233 | ||
| 233 | 234 | LoadSubmodule(module_globals, "clr.interop", "interop.py"); | |
@@ -237,14 +238,22 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true, | |||
| 237 | 238 | // add the imported module to the clr module, and copy the API functions | |
| 238 | 239 | // and decorators into the main clr module. | |
| 239 | 240 | Runtime.PyDict_SetItemString(clr_dict, "_extras", module); | |
| 241 | + | ||
| 242 | + // append version | ||
| 243 | + var version = typeof(PythonEngine) | ||
| 244 | + .Assembly | ||
| 245 | + .GetCustomAttribute<AssemblyInformationalVersionAttribute>() | ||
| 246 | + .InformationalVersion; | ||
| 247 | + using var versionObj = Runtime.PyString_FromString(version); | ||
| 248 | + Runtime.PyDict_SetItemString(clr_dict, "__version__", versionObj.Borrow()); | ||
| 249 | + | ||
| 240 | 250 | using var keys = locals.Keys(); | |
| 241 | 251 | foreach (PyObject key in keys) | |
| 242 | 252 | { | |
| 243 | - if (!key.ToString()!.StartsWith("_") || key.ToString()!.Equals("__version__")) | ||
| 253 | + if (!key.ToString()!.StartsWith("_")) | ||
| 244 | 254 | { | |
| 245 | - PyObject value = locals[key]; | ||
| 255 | + using PyObject value = locals[key]; | ||
| 246 | 256 | Runtime.PyDict_SetItem(clr_dict, key.Reference, value.Reference); | |
| 247 | - value.Dispose(); | ||
| 248 | 257 | } | |
| 249 | 258 | key.Dispose(); | |
| 250 | 259 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,8 +2,6 @@ | |||
| 2 | 2 | Code in this module gets loaded into the main clr module. | |
| 3 | 3 | """ | |
| 4 | 4 | ||
| 5 | - __version__ = "3.0.0dev" | ||
| 6 | - | ||
| 7 | 5 | ||
| 8 | 6 | class clrproperty(object): | |
| 9 | 7 | """ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments