-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathProgram.cs
More file actions
53 lines (48 loc) · 1.62 KB
/
Copy pathProgram.cs
File metadata and controls
53 lines (48 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using PythonNetStubGenerator;
namespace PythonNetStubTool
{
static class Program
{
/// <summary>
/// Creates stubs for Python.Net
/// </summary>
/// <param name="destPath">Path to save the subs to.</param>
/// <param name="searchPaths">Path to search for referenced assemblies</param>
/// <param name="targetDlls">Target DLLs</param>
static int Main(
DirectoryInfo destPath,
string targetDlls,
DirectoryInfo[]? searchPaths = null
)
{
if (searchPaths != null)
{
foreach (var searchPath in searchPaths)
Console.WriteLine($"search path {searchPath}");
}
var infos = new List<FileInfo>();
foreach (var pathStr in targetDlls.Split(','))
{
var assemblyPath = new FileInfo(pathStr);
if (!assemblyPath.Exists)
{
Console.WriteLine($"error: can not find {assemblyPath}");
return -1;
}
infos.Add(assemblyPath);
}
Console.WriteLine($"building stubs...");
try
{
var dest = StubBuilder.BuildAssemblyStubs(destPath, infos.ToArray(), searchPaths);
Console.WriteLine($"stubs saved to {dest}");
return 0;
}
catch (Exception sgEx)
{
Console.WriteLine($"error: failed generating stubs | {sgEx.Message}");
throw;
}
}
}
}