( workPath: string, candidates: string[] )
| 317 | } |
| 318 | |
| 319 | async function findValidEntrypoint( |
| 320 | workPath: string, |
| 321 | candidates: string[] |
| 322 | ): Promise<FindResult> { |
| 323 | const existingWithoutEntrypoint: string[] = []; |
| 324 | for (const candidate of candidates) { |
| 325 | const absPath = join(workPath, candidate); |
| 326 | if (!(await fileExists(absPath))) continue; |
| 327 | const content = await fs.promises.readFile(absPath, 'utf-8'); |
| 328 | const varName = await findAppOrHandler(content); |
| 329 | if (varName) { |
| 330 | debug(`Detected Python entrypoint: ${candidate} (variable: ${varName})`); |
| 331 | return { |
| 332 | entrypoint: { entrypoint: candidate, variableName: varName }, |
| 333 | existingWithoutEntrypoint, |
| 334 | }; |
| 335 | } |
| 336 | existingWithoutEntrypoint.push(candidate); |
| 337 | } |
| 338 | return { entrypoint: null, existingWithoutEntrypoint }; |
| 339 | } |
| 340 | |
| 341 | /** |
| 342 | * Check if manage.py exists in workPath and references DJANGO_SETTINGS_MODULE. |
no test coverage detected