Created
June 23, 2025 10:09
-
-
Save bennuttall/ec13e0541d998614ac18bdb286fd77ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pathlib import Path | |
| import csv | |
| import logging | |
| from piwheels_wheel import Wheel # requires new version currently in PR | |
| from piwheels.master.db import Database | |
| db = Database("postgresql:///piwheels") | |
| simple = Path("/home/piwheels/www/simple") | |
| csv_file = Path("/home/piwheels/pip_deps.csv") | |
| packages = db.get_all_packages() | |
| for package in packages: | |
| file_deps = [] | |
| package_dir = simple / package | |
| files = db.get_package_files(package) | |
| for file in files: | |
| file_path = package_dir / file | |
| if not file_path.exists(): | |
| logging.warning(f"File {file_path} does not exist, skipping") | |
| continue | |
| try: | |
| wheel = Wheel(file_path) | |
| except Exception as e: | |
| logging.warning(f"Error processing {file}: {e}") | |
| continue | |
| pip_deps = wheel.pip_dependencies | |
| if pip_deps: | |
| file_deps.append((file, pip_deps)) | |
| if file_deps: | |
| print(package) | |
| with csv_file.open("a", newline="\n") as f: | |
| writer = csv.writer(f) | |
| for file, deps in file_deps: | |
| for dep in deps: | |
| writer.writerow((file, "pip", dep)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment