| 1107 | } |
| 1108 | |
| 1109 | async function parsePythonRequirements(content: string, root: string, deps: string[]): Promise<void> { |
| 1110 | for (const line of content.split("\n")) { |
| 1111 | const trimmed = line.trim(); |
| 1112 | if (!trimmed || trimmed.startsWith("#")) continue; |
| 1113 | // Follow -r includes one level deep |
| 1114 | const includeMatch = trimmed.match(/^-r\s+(.+)/); |
| 1115 | if (includeMatch) { |
| 1116 | try { |
| 1117 | const included = await readFile(join(root, includeMatch[1].trim()), "utf-8"); |
| 1118 | for (const subLine of included.split("\n")) { |
| 1119 | const name = subLine.split(/[>=<\[#]/)[0].trim().toLowerCase().replace(/-/g, "-"); |
| 1120 | if (name && !name.startsWith("-") && !deps.includes(name)) deps.push(name); |
| 1121 | } |
| 1122 | } catch {} |
| 1123 | continue; |
| 1124 | } |
| 1125 | const name = trimmed.split(/[>=<\[#]/)[0].trim().toLowerCase(); |
| 1126 | if (name && !name.startsWith("-") && !deps.includes(name)) deps.push(name); |
| 1127 | } |
| 1128 | } |
| 1129 | |
| 1130 | async function getPythonDeps(root: string): Promise<string[]> { |
| 1131 | const deps: string[] = []; |