Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
SimpleWheelCache Class Reference
Inheritance diagram for SimpleWheelCache:
Collaboration diagram for SimpleWheelCache:

Public Member Functions

None __init__ (self, str cache_dir)
 
str get_path_for_link (self, Link link)
 
Link get (self, Link link, Optional[str] package_name, List[Tag] supported_tags)
 

Data Fields

 cache_dir
 
- Data Fields inherited from Cache
 cache_dir
 

Additional Inherited Members

- Protected Member Functions inherited from Cache
List[str] _get_cache_path_parts (self, Link link)
 
List[Any] _get_candidates (self, Link link, str canonical_package_name)
 

Detailed Description

A cache of wheels for future installs.

Definition at line 104 of file cache.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ (   self,
str  cache_dir 
)

Reimplemented from Cache.

Reimplemented in EphemWheelCache.

Definition at line 107 of file cache.py.

107 def __init__(self, cache_dir: str) -> None:
108 super().__init__(cache_dir)
109
for i

Referenced by Protocol.__init_subclass__().

Here is the caller graph for this function:

Member Function Documentation

◆ get()

Link get (   self,
Link  link,
Optional[str]  package_name,
List[Tag supported_tags 
)
Returns a link to a cached item if it exists, otherwise returns the
passed link.

Reimplemented from Cache.

Definition at line 130 of file cache.py.

135 ) -> Link:
136 candidates = []
137
138 if not package_name:
139 return link
140
141 canonical_package_name = canonicalize_name(package_name)
142 for wheel_name, wheel_dir in self._get_candidates(link, canonical_package_name):
143 try:
144 wheel = Wheel(wheel_name)
145 except InvalidWheelFilename:
146 continue
147 if canonicalize_name(wheel.name) != canonical_package_name:
149 "Ignoring cached wheel %s for %s as it "
150 "does not match the expected distribution name %s.",
151 wheel_name,
152 link,
153 package_name,
154 )
155 continue
156 if not wheel.supported(supported_tags):
157 # Built for a different python/arch/etc
158 continue
160 (
161 wheel.support_index_min(supported_tags),
162 wheel_name,
163 wheel_dir,
164 )
165 )
166
167 if not candidates:
168 return link
169
170 _, wheel_name, wheel_dir = min(candidates)
171 return Link(path_to_url(os.path.join(wheel_dir, wheel_name)))
172
173

Referenced by LegacyMetadata.__getitem__(), Layout.__getitem__(), LegacyMetadata.check(), ThemeStack.push_theme(), and LegacyMetadata.write_file().

Here is the caller graph for this function:

◆ get_path_for_link()

str get_path_for_link (   self,
Link  link 
)
Return a directory to store cached wheels for link

Because there are M wheels for any one sdist, we provide a directory
to cache them in, and then consult that directory when looking up
cache hits.

We only insert things into the cache if they have plausible version
numbers, so that we don't contaminate the cache with things that were
not unique. E.g. ./package might have dozens of installs done for it
and build a version of 0.0...and if we built and cached a wheel, we'd
end up using the same wheel even if the source has been edited.

:param link: The link of the sdist for which this will cache wheels.

Reimplemented from Cache.

Definition at line 110 of file cache.py.

110 def get_path_for_link(self, link: Link) -> str:
111 """Return a directory to store cached wheels for link
112
113 Because there are M wheels for any one sdist, we provide a directory
114 to cache them in, and then consult that directory when looking up
115 cache hits.
116
117 We only insert things into the cache if they have plausible version
118 numbers, so that we don't contaminate the cache with things that were
119 not unique. E.g. ./package might have dozens of installs done for it
120 and build a version of 0.0...and if we built and cached a wheel, we'd
121 end up using the same wheel even if the source has been edited.
122
123 :param link: The link of the sdist for which this will cache wheels.
124 """
125 parts = self._get_cache_path_parts(link)
126 assert self.cache_dir
127 # Store wheels within the root cache_dir
128 return os.path.join(self.cache_dir, "wheels", *parts)
129

Field Documentation

◆ cache_dir

cache_dir

Definition at line 128 of file cache.py.


The documentation for this class was generated from the following file: