@@ -100,13 +100,8 @@ class InWheel(InTemporaryDirectory):
100
100
On entering, you'll find yourself in the root tree of the wheel. If you've
101
101
asked for an output wheel, then on exit we'll rewrite the wheel record and
102
102
pack stuff up for you.
103
-
104
- If `out_wheel` is None, we assume the wheel won't be modified and we can
105
- cache the unpacked wheel for future use.
106
103
"""
107
104
108
- _whl_cache : ClassVar [dict [Path , TemporaryDirectory [Any ]]] = {}
109
-
110
105
def __init__ (self , in_wheel : Path , out_wheel : Path | None = None ) -> None :
111
106
"""Initialize in-wheel context manager
112
107
@@ -120,35 +115,9 @@ def __init__(self, in_wheel: Path, out_wheel: Path | None = None) -> None:
120
115
"""
121
116
self .in_wheel = in_wheel .absolute ()
122
117
self .out_wheel = None if out_wheel is None else out_wheel .absolute ()
123
- self .read_only = out_wheel is None
124
- self .use_cache = self .in_wheel in self ._whl_cache
125
- if self .use_cache and not Path (self ._whl_cache [self .in_wheel ].name ).exists ():
126
- self .use_cache = False
127
- logger .debug (
128
- "Wheel ctx %s for %s is no longer valid" ,
129
- self ._whl_cache .pop (self .in_wheel ),
130
- self .in_wheel ,
131
- )
132
-
133
- if self .use_cache :
134
- logger .debug (
135
- "Reuse %s for %s" , self ._whl_cache [self .in_wheel ], self .in_wheel
136
- )
137
- self ._tmpdir = self ._whl_cache [self .in_wheel ]
138
- if not self .read_only :
139
- self ._whl_cache .pop (self .in_wheel )
140
- else :
141
- super ().__init__ ()
142
- if self .read_only :
143
- self ._whl_cache [self .in_wheel ] = self ._tmpdir
118
+ super ().__init__ ()
144
119
145
120
def __enter__ (self ) -> Path :
146
- if self .use_cache or self .read_only :
147
- if not self .use_cache :
148
- zip2dir (self .in_wheel , self .name )
149
- self ._pwd = Path .cwd ()
150
- os .chdir (self .name )
151
- return Path (self .name )
152
121
zip2dir (self .in_wheel , self .name )
153
122
return super ().__enter__ ()
154
123
@@ -165,16 +134,6 @@ def __exit__(
165
134
if timestamp :
166
135
date_time = datetime .fromtimestamp (int (timestamp ), tz = timezone .utc )
167
136
dir2zip (self .name , self .out_wheel , date_time )
168
- if self .use_cache or self .read_only :
169
- logger .debug (
170
- "Exiting reused %s for %s" ,
171
- self ._whl_cache [self .in_wheel ],
172
- self .in_wheel ,
173
- )
174
- os .chdir (self ._pwd )
175
- if not self .read_only :
176
- super ().__exit__ (exc , value , tb )
177
- return None
178
137
return super ().__exit__ (exc , value , tb )
179
138
180
139
0 commit comments