MCPcopy Create free account
hub / github.com/CompVis/zigma / CachedWheelsCommand

Class CachedWheelsCommand

dis_mamba/setup.py:199–231  ·  view source on GitHub ↗

The CachedWheelsCommand plugs into the default bdist wheel, which is ran by pip when it cannot find an existing wheel (which is currently the case for all installs). We use the environment parameters to detect whether there is already a pre-built version of a compatible wheel availa

Source from the content-addressed store, hash-verified

197
198
199class CachedWheelsCommand(_bdist_wheel):
200 """
201 The CachedWheelsCommand plugs into the default bdist wheel, which is ran by pip when it cannot
202 find an existing wheel (which is currently the case for all installs). We use
203 the environment parameters to detect whether there is already a pre-built version of a compatible
204 wheel available and short-circuits the standard full build pipeline.
205 """
206
207 def run(self):
208 if FORCE_BUILD:
209 return super().run()
210
211 wheel_url, wheel_filename = get_wheel_url()
212 print("Guessing wheel URL: ", wheel_url)
213 try:
214 urllib.request.urlretrieve(wheel_url, wheel_filename)
215
216 # Make the archive
217 # Lifted from the root wheel processing command
218 # https://github.com/pypa/wheel/blob/cf71108ff9f6ffc36978069acb28824b44ae028e/src/wheel/bdist_wheel.py#LL381C9-L381C85
219 if not os.path.exists(self.dist_dir):
220 os.makedirs(self.dist_dir)
221
222 impl_tag, abi_tag, plat_tag = self.get_tag()
223 archive_basename = f"{self.wheel_dist_name}-{impl_tag}-{abi_tag}-{plat_tag}"
224
225 wheel_path = os.path.join(self.dist_dir, archive_basename + ".whl")
226 print("Raw wheel path", wheel_path)
227 shutil.move(wheel_filename, wheel_path)
228 except urllib.error.HTTPError:
229 print("Precompiled wheel not found. Building from source...")
230 # If the wheel could not be downloaded, build from source
231 super().run()
232
233
234setup(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected