Skip to content

Commit c7d896f

Browse files
l0lawrenceCopilot
andcommitted
Fix batch Python phase to honor --generatedFolder override
run_batch.py was always passed PLUGIN_DIR as --generated-dir, so when the emitter-diff tool redirects output via --generatedFolder the batch phase looked in the wrong tree, found no .tsp-codegen config files, and wrote zero .py files (leaving the path-bearing config files behind as spurious diffs). Pass the parent of GENERATED_FOLDER instead; it equals PLUGIN_DIR in the default case so normal regeneration is unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent b996a66 commit c7d896f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/http-client-python/eng/scripts/ci/regenerate.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ const HTTP_SPECS = argv.values.httpSpecsDir
115115
const GENERATED_FOLDER = argv.values.generatedFolder
116116
? resolve(argv.values.generatedFolder)
117117
: resolve(PLUGIN_DIR, "generator");
118+
// Directory that contains `tests/generated/<flavor>/`. Defaults to PLUGIN_DIR (since the
119+
// default GENERATED_FOLDER is PLUGIN_DIR/generator), but tracks a custom --generatedFolder so
120+
// the batch Python phase reads the same output tree the TypeScript phase wrote to.
121+
const GENERATED_PARENT = resolve(GENERATED_FOLDER, "..");
118122
const EMITTER_NAME = argv.values.emitterName || "@typespec/http-client-python";
119123

120124
const ctx: RegenerateContext = {
@@ -168,7 +172,7 @@ function runBatchPythonProcessing(flavor: string, configCount: number, jobs: num
168172
try {
169173
// Pass directory and flavor instead of individual config files to avoid command line length limits on Windows
170174
execSync(
171-
`"${venvPath}" "${batchScript}" --generated-dir "${PLUGIN_DIR}" --flavor ${flavor} --jobs ${jobs}`,
175+
`"${venvPath}" "${batchScript}" --generated-dir "${GENERATED_PARENT}" --flavor ${flavor} --jobs ${jobs}`,
172176
{
173177
stdio: "inherit",
174178
cwd: PLUGIN_DIR,

0 commit comments

Comments
 (0)