File tree 4 files changed +38
-1
lines changed
test/test_importlib/metadata
4 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -567,7 +567,7 @@ def _read_files_egginfo_installed(self):
567
567
paths = (
568
568
(subdir / name )
569
569
.resolve ()
570
- .relative_to (self .locate_file ('' ).resolve ())
570
+ .relative_to (self .locate_file ('' ).resolve (), walk_up = True )
571
571
.as_posix ()
572
572
for name in text .splitlines ()
573
573
)
Original file line number Diff line number Diff line change @@ -234,6 +234,40 @@ def main():
234
234
}
235
235
236
236
237
+ class EggInfoPkgPipInstalledExternalDataFiles (OnSysPath , SiteBuilder ):
238
+ files : FilesSpec = {
239
+ "egg_with_module_pkg.egg-info" : {
240
+ "PKG-INFO" : "Name: egg_with_module-pkg" ,
241
+ # SOURCES.txt is made from the source archive, and contains files
242
+ # (setup.py) that are not present after installation.
243
+ "SOURCES.txt" : """
244
+ egg_with_module.py
245
+ setup.py
246
+ egg_with_module.json
247
+ egg_with_module_pkg.egg-info/PKG-INFO
248
+ egg_with_module_pkg.egg-info/SOURCES.txt
249
+ egg_with_module_pkg.egg-info/top_level.txt
250
+ """ ,
251
+ # installed-files.txt is written by pip, and is a strictly more
252
+ # accurate source than SOURCES.txt as to the installed contents of
253
+ # the package.
254
+ "installed-files.txt" : """
255
+ ../../../etc/jupyter/jupyter_notebook_config.d/relative.json
256
+ /etc/jupyter/jupyter_notebook_config.d/absolute.json
257
+ ../egg_with_module.py
258
+ PKG-INFO
259
+ SOURCES.txt
260
+ top_level.txt
261
+ """ ,
262
+ # missing top_level.txt (to trigger fallback to installed-files.txt)
263
+ },
264
+ "egg_with_module.py" : """
265
+ def main():
266
+ print("hello world")
267
+ """ ,
268
+ }
269
+
270
+
237
271
class EggInfoPkgPipInstalledNoModules (OnSysPath , SiteBuilder ):
238
272
files : FilesSpec = {
239
273
"egg_with_no_modules_pkg.egg-info" : {
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class APITests(
29
29
fixtures .EggInfoPkg ,
30
30
fixtures .EggInfoPkgPipInstalledNoToplevel ,
31
31
fixtures .EggInfoPkgPipInstalledNoModules ,
32
+ fixtures .EggInfoPkgPipInstalledExternalDataFiles ,
32
33
fixtures .EggInfoPkgSourcesFallback ,
33
34
fixtures .DistInfoPkg ,
34
35
fixtures .DistInfoPkgWithDot ,
Original file line number Diff line number Diff line change
1
+ When reading installed files from an egg, use ``relative_to(walk_up=True) ``
2
+ to honor files installed outside of the installation root.
You can’t perform that action at this time.
0 commit comments