Return the installed pip requirements as text found in `site_packages_dir` as a text.
(site_packages_dir)
| 111 | |
| 112 | |
| 113 | def 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 | |
| 126 | comparators = ( |
no test coverage detected