@@ -171,34 +171,21 @@ def can_skip_resolve():
171
171
return deps
172
172
173
173
174
- def _find_editable_deps_files (path ):
175
- # The editable .pth files appear to follow a pattern
176
- # `__editable.<pkg_name>-<pkg_version>.pth`.
177
- editable_pth_files = glob .glob (os .path .join (path , "__editable__.*.pth" ))
174
+ def _find_editable_deps_files ():
178
175
ans = []
179
- for editable_pth_file in editable_pth_files :
180
- # Extract the package name from the pth file name.
181
- bname = os .path .basename (editable_pth_file )
182
- m = re .match ("__editable__\\ .(.*)-" , bname )
183
- if m :
184
- pkg_name = m .group (1 )
185
- # Use the import finders to find the location of the editable package.
186
- for finder in sys .meta_path :
187
- try :
188
- module_spec = finder .find_spec (pkg_name )
189
- except TypeError :
176
+ for finder in sys .meta_path :
177
+ module_name = finder .__module__
178
+ if module_name .startswith ("__editable___" ):
179
+ m = sys .modules [module_name ]
180
+ paths = m .MAPPING .values ()
181
+ for path in paths :
182
+ if not os .path .isdir (path ):
190
183
continue
191
- if module_spec :
192
- for search_loc in module_spec .submodule_search_locations :
193
- fn = os .path .join (search_loc , "juliapkg.json" )
194
- ans .append (fn )
195
- # Thought about adding subdirectories, but that would
196
- # match possible `test` directories that might have
197
- # test-specific dependencies that wouldn't be
198
- # wanted/needed.
199
- # for subdir in os.listdir(search_loc):
200
- # fn = os.path.join(search_loc, subdir, "juliapkg.json")
201
- # ans.append(fn)
184
+ fn = os .path .join (path , "juliapkg.json" )
185
+ ans .append (fn )
186
+ for subdir in os .listdir (path ):
187
+ fn = os .path .join (path , subdir , "juliapkg.json" )
188
+ ans .append (fn )
202
189
203
190
return ans
204
191
@@ -219,7 +206,7 @@ def deps_files():
219
206
fn = os .path .join (path , subdir , "juliapkg.json" )
220
207
ans .append (fn )
221
208
222
- ans += _find_editable_deps_files (path )
209
+ ans += _find_editable_deps_files ()
223
210
224
211
return list (
225
212
set (
0 commit comments