File tree 4 files changed +42
-1
lines changed
4 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -534,7 +534,7 @@ def _read_files_egginfo_installed(self):
534
534
paths = (
535
535
(subdir / name )
536
536
.resolve ()
537
- .relative_to (self .locate_file ('' ).resolve ())
537
+ .relative_to (self .locate_file ('' ).resolve (), walk_up = True )
538
538
.as_posix ()
539
539
for name in text .splitlines ()
540
540
)
Original file line number Diff line number Diff line change @@ -245,6 +245,44 @@ def setUp(self):
245
245
build_files (EggInfoPkgPipInstalledNoToplevel .files , prefix = self .site_dir )
246
246
247
247
248
+ class EggInfoPkgPipInstalledExternalDataFiles (OnSysPath , SiteDir ):
249
+ files : FilesSpec = {
250
+ "egg_with_module_pkg.egg-info" : {
251
+ "PKG-INFO" : "Name: egg_with_module-pkg" ,
252
+ # SOURCES.txt is made from the source archive, and contains files
253
+ # (setup.py) that are not present after installation.
254
+ "SOURCES.txt" : """
255
+ egg_with_module.py
256
+ setup.py
257
+ egg_with_module.json
258
+ egg_with_module_pkg.egg-info/PKG-INFO
259
+ egg_with_module_pkg.egg-info/SOURCES.txt
260
+ egg_with_module_pkg.egg-info/top_level.txt
261
+ """ ,
262
+ # installed-files.txt is written by pip, and is a strictly more
263
+ # accurate source than SOURCES.txt as to the installed contents of
264
+ # the package.
265
+ "installed-files.txt" : """
266
+ ../../../etc/jupyter/jupyter_notebook_config.d/relative.json
267
+ /etc/jupyter/jupyter_notebook_config.d/absolute.json
268
+ ../egg_with_module.py
269
+ PKG-INFO
270
+ SOURCES.txt
271
+ top_level.txt
272
+ """ ,
273
+ # missing top_level.txt (to trigger fallback to installed-files.txt)
274
+ },
275
+ "egg_with_module.py" : """
276
+ def main():
277
+ print("hello world")
278
+ """ ,
279
+ }
280
+
281
+ def setUp (self ):
282
+ super ().setUp ()
283
+ build_files (EggInfoPkgPipInstalledExternalDataFiles .files , prefix = self .site_dir )
284
+
285
+
248
286
class EggInfoPkgPipInstalledNoModules (OnSysPath , SiteDir ):
249
287
files : FilesSpec = {
250
288
"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