@@ -100,13 +100,8 @@ class InWheel(InTemporaryDirectory):
100100 On entering, you'll find yourself in the root tree of the wheel. If you've
101101 asked for an output wheel, then on exit we'll rewrite the wheel record and
102102 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.
106103 """
107104
108- _whl_cache : ClassVar [dict [Path , TemporaryDirectory [Any ]]] = {}
109-
110105 def __init__ (self , in_wheel : Path , out_wheel : Path | None = None ) -> None :
111106 """Initialize in-wheel context manager
112107
@@ -120,35 +115,9 @@ def __init__(self, in_wheel: Path, out_wheel: Path | None = None) -> None:
120115 """
121116 self .in_wheel = in_wheel .absolute ()
122117 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__ ()
144119
145120 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 )
152121 zip2dir (self .in_wheel , self .name )
153122 return super ().__enter__ ()
154123
@@ -165,16 +134,6 @@ def __exit__(
165134 if timestamp :
166135 date_time = datetime .fromtimestamp (int (timestamp ), tz = timezone .utc )
167136 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
178137 return super ().__exit__ (exc , value , tb )
179138
180139
0 commit comments