MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / get_installed_reqs

Function get_installed_reqs

etc/scripts/utils_requirements.py:113–123  ·  view source on GitHub ↗

Return the installed pip requirements as text found in `site_packages_dir` as a text.

(site_packages_dir)

Source from the content-addressed store, hash-verified

111
112
113def get_installed_reqs(site_packages_dir):
114 """
115 Return the installed pip requirements as text found in `site_packages_dir`
116 as a text.
117 """
118 if not os.path.exists(site_packages_dir):
119 raise Exception(f"site_packages directory: {site_packages_dir!r} does not exists")
120 # Also include these packages in the output with --all: wheel, distribute,
121 # setuptools, pip
122 args = ["pip", "freeze", "--exclude-editable", "--all", "--path", site_packages_dir]
123 return subprocess.check_output(args, encoding="utf-8") # noqa: S603
124
125
126comparators = (

Callers 2

lock_requirementsFunction · 0.85
lock_dev_requirementsFunction · 0.85

Calls 1

existsMethod · 0.45

Tested by

no test coverage detected