File tree Expand file tree Collapse file tree 4 files changed +42
-1
lines changed
Expand file tree Collapse file tree 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):
534534 paths = (
535535 (subdir / name )
536536 .resolve ()
537- .relative_to (self .locate_file ('' ).resolve ())
537+ .relative_to (self .locate_file ('' ).resolve (), walk_up = True )
538538 .as_posix ()
539539 for name in text .splitlines ()
540540 )
Original file line number Diff line number Diff line change @@ -245,6 +245,44 @@ def setUp(self):
245245 build_files (EggInfoPkgPipInstalledNoToplevel .files , prefix = self .site_dir )
246246
247247
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+
248286class EggInfoPkgPipInstalledNoModules (OnSysPath , SiteDir ):
249287 files : FilesSpec = {
250288 "egg_with_no_modules_pkg.egg-info" : {
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class APITests(
2929 fixtures .EggInfoPkg ,
3030 fixtures .EggInfoPkgPipInstalledNoToplevel ,
3131 fixtures .EggInfoPkgPipInstalledNoModules ,
32+ fixtures .EggInfoPkgPipInstalledExternalDataFiles ,
3233 fixtures .EggInfoPkgSourcesFallback ,
3334 fixtures .DistInfoPkg ,
3435 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