@workos/oagen 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1203,6 +1203,18 @@ function walkPythonFiles(dir) {
1203
1203
  return results.sort();
1204
1204
  }
1205
1205
  /** Find the Python source root (prefers `src/`, falls back to top-level package). */
1206
+ /** True if a directory looks like a Python package (has __init__.py or .py files). */
1207
+ function isPythonPackageDir(dir) {
1208
+ try {
1209
+ statSync(join(dir, "__init__.py"));
1210
+ return true;
1211
+ } catch {}
1212
+ try {
1213
+ return readdirSync(dir).some((e) => e.endsWith(".py"));
1214
+ } catch {
1215
+ return false;
1216
+ }
1217
+ }
1206
1218
  function findPythonSourceRoot(sdkPath) {
1207
1219
  const srcDir = join(sdkPath, "src");
1208
1220
  try {
@@ -1211,13 +1223,7 @@ function findPythonSourceRoot(sdkPath) {
1211
1223
  for (const entry of entries) {
1212
1224
  const pkgDir = join(srcDir, entry);
1213
1225
  try {
1214
- if (statSync(pkgDir).isDirectory()) {
1215
- const initFile = join(pkgDir, "__init__.py");
1216
- try {
1217
- statSync(initFile);
1218
- return srcDir;
1219
- } catch {}
1220
- }
1226
+ if (statSync(pkgDir).isDirectory() && isPythonPackageDir(pkgDir)) return srcDir;
1221
1227
  } catch {
1222
1228
  continue;
1223
1229
  }
@@ -1230,13 +1236,7 @@ function findPythonSourceRoot(sdkPath) {
1230
1236
  if (entry.startsWith(".") || entry === "tests" || entry === "test" || entry === "node_modules") continue;
1231
1237
  const pkgDir = join(sdkPath, entry);
1232
1238
  try {
1233
- if (statSync(pkgDir).isDirectory()) {
1234
- const initFile = join(pkgDir, "__init__.py");
1235
- try {
1236
- statSync(initFile);
1237
- return sdkPath;
1238
- } catch {}
1239
- }
1239
+ if (statSync(pkgDir).isDirectory() && isPythonPackageDir(pkgDir)) return sdkPath;
1240
1240
  } catch {
1241
1241
  continue;
1242
1242
  }