Files
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00

57 lines
1.5 KiB
TypeScript

import { logger } from '../../../../logger/index.ts';
import { findLocalSiblingOrParent } from '../../../../util/fs/index.ts';
import type {
PackageDependency,
UpdateArtifact,
UpdateArtifactsResult,
} from '../../types.ts';
import type { PyProject } from '../schema.ts';
import type { PyProjectProcessor } from './types.ts';
export abstract class BasePyProjectProcessor implements PyProjectProcessor {
// The name of the lockfiles to be searched for.
// This should be defined in the concrete processor classes.
// No lockfiles will be forwarded outside the manager implementation.
protected lockfileName: string | undefined;
abstract updateArtifacts(
updateArtifact: UpdateArtifact,
project: PyProject,
): Promise<UpdateArtifactsResult[] | null>;
abstract process(
project: PyProject,
deps: PackageDependency[],
): PackageDependency[];
abstract extractLockedVersions(
project: PyProject,
deps: PackageDependency[],
packageFile: string,
): Promise<PackageDependency[]>;
async getLockfiles(
_project: PyProject,
packageFile: string,
): Promise<string[]> {
if (!this.lockfileName) {
logger.trace(
{ packageFile },
`No lockfile name defined for ${this.constructor.name}`,
);
return [];
}
const lockfilePath = await findLocalSiblingOrParent(
packageFile,
this.lockfileName,
);
if (lockfilePath) {
return [lockfilePath];
}
logger.debug({ packageFile }, `No ${this.lockfileName} found`);
return [];
}
}