Download to --dest THIRDPARTY_DIR the PyPI wheels, source distributions, and their ABOUT metadata, license and notices files. Download the PyPI packages listed in the combination of: - the pip requirements --requirements REQUIREMENT-FILE(s), - the pip name==version --specifier
(
requirements_files,
specifiers,
latest_version,
dest_dir,
python_versions,
operating_systems,
wheels,
sdists,
index_urls,
use_cached_index,
sdist_only,
wheel_only,
no_dist,
)
| 150 | ) |
| 151 | @click.help_option("-h", "--help") |
| 152 | def fetch_thirdparty( |
| 153 | requirements_files, |
| 154 | specifiers, |
| 155 | latest_version, |
| 156 | dest_dir, |
| 157 | python_versions, |
| 158 | operating_systems, |
| 159 | wheels, |
| 160 | sdists, |
| 161 | index_urls, |
| 162 | use_cached_index, |
| 163 | sdist_only, |
| 164 | wheel_only, |
| 165 | no_dist, |
| 166 | ): |
| 167 | """ |
| 168 | Download to --dest THIRDPARTY_DIR the PyPI wheels, source distributions, |
| 169 | and their ABOUT metadata, license and notices files. |
| 170 | |
| 171 | Download the PyPI packages listed in the combination of: |
| 172 | - the pip requirements --requirements REQUIREMENT-FILE(s), |
| 173 | - the pip name==version --specifier SPECIFIER(s) |
| 174 | - any pre-existing wheels or sdsists found in --dest-dir THIRDPARTY_DIR. |
| 175 | |
| 176 | Download wheels with the --wheels option for the ``--python-version`` |
| 177 | PYVER(s) and ``--operating_system`` OS(s) combinations defaulting to all |
| 178 | supported combinations. |
| 179 | |
| 180 | Download sdists tarballs with the --sdists option. |
| 181 | |
| 182 | Generate or Download .ABOUT, .LICENSE and .NOTICE files for all the wheels |
| 183 | and sources fetched. |
| 184 | |
| 185 | Download from the provided PyPI simple --index-url INDEX(s) URLs. |
| 186 | """ |
| 187 | if not (wheels or sdists): |
| 188 | print("Error: one or both of --wheels and --sdists is required.") |
| 189 | sys.exit(1) |
| 190 | |
| 191 | print(f"COLLECTING REQUIRED NAMES & VERSIONS FROM {dest_dir}") |
| 192 | |
| 193 | existing_packages_by_nv = { |
| 194 | (package.name, package.version): package |
| 195 | for package in utils_thirdparty.get_local_packages(directory=dest_dir) |
| 196 | } |
| 197 | |
| 198 | required_name_versions = set(existing_packages_by_nv.keys()) |
| 199 | |
| 200 | for req_file in requirements_files: |
| 201 | nvs = utils_requirements.load_requirements( |
| 202 | requirements_file=req_file, |
| 203 | with_unpinned=latest_version, |
| 204 | ) |
| 205 | required_name_versions.update(nvs) |
| 206 | |
| 207 | for specifier in specifiers: |
| 208 | nv = utils_requirements.get_required_name_version( |
| 209 | requirement=specifier, |
no test coverage detected