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

Class CachedWheelsCommand

dis_causal_conv1d/setup.py:191–223  ·  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

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected