MCPcopy Create free account
hub / github.com/vercel/vercel / isInstalled

Function isInstalled

packages/python/src/install.ts:47–66  ·  view source on GitHub ↗
(
  pythonPath: string,
  dependency: string,
  cwd: string
)

Source from the content-addressed store, hash-verified

45`;
46
47export async function isInstalled(
48 pythonPath: string,
49 dependency: string,
50 cwd: string
51) {
52 try {
53 const { stdout } = await execa(
54 pythonPath,
55 ['-c', makeDependencyCheckCode(dependency)],
56 {
57 stdio: 'pipe',
58 cwd,
59 env: { ...process.env, PYTHONPATH: join(cwd, resolveVendorDir()) },
60 }
61 );
62 return stdout.startsWith(cwd);
63 } catch (_err) {
64 return false;
65 }
66}
67
68const makeRequirementsCheckCode = (requirementsPath: string) => `
69import distutils.text_file

Callers 1

installRequirementFunction · 0.70

Calls 3

execaFunction · 0.85
makeDependencyCheckCodeFunction · 0.85
resolveVendorDirFunction · 0.85

Tested by

no test coverage detected