Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/virtualenv/seed/wheels/bundle.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
1 from __future__ import absolute_import, unicode_literals | |
2 | |
3 from ..wheels.embed import get_embed_wheel | |
4 from .periodic_update import periodic_update | |
5 from .util import Version, Wheel, discover_wheels | |
6 | |
7 | |
8 def from_bundle(distribution, version, for_py_version, search_dirs, app_data, do_periodic_update, env): | |
9 """ | |
10 Load the bundled wheel to a cache directory. | |
11 """ | |
12 of_version = Version.of_version(version) | |
13 wheel = load_embed_wheel(app_data, distribution, for_py_version, of_version) | |
14 | |
15 if version != Version.embed: | |
16 # 2. check if we have upgraded embed | |
17 if app_data.can_update: | |
18 wheel = periodic_update(distribution, for_py_version, wheel, search_dirs, app_data, do_periodic_update, env) | |
19 | |
20 # 3. acquire from extra search dir | |
21 found_wheel = from_dir(distribution, of_version, for_py_version, search_dirs) | |
22 if found_wheel is not None: | |
23 if wheel is None: | |
24 wheel = found_wheel | |
25 elif found_wheel.version_tuple > wheel.version_tuple: | |
26 wheel = found_wheel | |
27 return wheel | |
28 | |
29 | |
30 def load_embed_wheel(app_data, distribution, for_py_version, version): | |
31 wheel = get_embed_wheel(distribution, for_py_version) | |
32 if wheel is not None: | |
33 version_match = version == wheel.version | |
34 if version is None or version_match: | |
35 with app_data.ensure_extracted(wheel.path, lambda: app_data.house) as wheel_path: | |
36 wheel = Wheel(wheel_path) | |
37 else: # if version does not match ignore | |
38 wheel = None | |
39 return wheel | |
40 | |
41 | |
42 def from_dir(distribution, version, for_py_version, directories): | |
43 """ | |
44 Load a compatible wheel from a given folder. | |
45 """ | |
46 for folder in directories: | |
47 for wheel in discover_wheels(folder, distribution, version, for_py_version): | |
48 return wheel | |
49 return None |