8000 fixed package installation · SciSharp/pythonnet@14633c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 14633c7

Browse files
committed
fixed package installation
1 parent 54f763a commit 14633c7

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/Python.Included/Installer.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ await Task.Run(() =>
2626
var zip = Path.Combine(appdata, $"{EMBEDDED_PYTHON}.zip");
2727
var resource_name = EMBEDDED_PYTHON;
2828
CopyEmbeddedResourceToFile(assembly, resource_name, zip, force);
29-
ZipFile.ExtractToDirectory(zip, zip.Replace(".zip", ""));
29+
try {
30+
ZipFile.ExtractToDirectory(zip, zip.Replace(".zip", ""));
31+
}
32+
catch (Exception e) {
33+
// todo log
34+
}
3035
});
3136
}
3237

@@ -70,11 +75,16 @@ public async Task InstallWheel(Assembly assembly, string resource_name, bool for
7075
await Task.Run(() =>
7176
{
7277
CopyEmbeddedResourceToFile(assembly, key, wheelPath, force);
73-
ZipFile.ExtractToDirectory(wheelPath, lib);
78+
try {
79+
ZipFile.ExtractToDirectory(wheelPath, lib);
80+
}
81+
catch (Exception e) {
82+
// todo
83+
}
7484
// modify _pth file
75-
var pth = Path.Combine(EmbeddedPythonHome, PYTHON_VERSION + ".pth");
85+
var pth = Path.Combine(EmbeddedPythonHome, PYTHON_VERSION + "._pth");
7686
if (!File.ReadAllLines(pth).Contains("./Lib"))
77-
File.AppendAllLines(pth, new[] { "./ Lib" });
87+
File.AppendAllLines(pth, new[] { "./Lib" });
7888
});
7989
}
8090

0 commit comments

Comments
 (0)
0