**diff options**

author | Release Manager <release@sagemath.org> | 2015-08-05 20:41:53 +0200 |
---|---|---|

committer | Volker Braun <vbraun.name@gmail.com> | 2015-08-05 20:41:53 +0200 |

commit | d585e9cdf232971320bbdc8194cc07aa00942ffa (patch) | |

tree | 99adf7ab6f84c8fc62b3d79c224f35f1d00bcb40 | |

parent | Trac #18991: Remove useful doctest (diff) | |

parent | Ignore files in spkg directory (diff) |

Trac #18993: sage-list-packages should ignore files in build/pkgs/

At the moment, {{{sage-list-packages}}} does not ignore files in
{{{build/pkgs}}}, which can lead to errors if, say, your browser has
automatically created a file after viewing this folder:
{{{
jkeitel@pcl337b:~/sage/sage_optional> ./sage -optional
Traceback (most recent call last):
File "/home/pcl337b/jkeitel/sage/sage_optional/src/bin/sage-list-
packages", line 57, in <module>
with open(os.path.join(SAGE_PKGS, p, "package-version.txt")) as f:
IOError: [Errno 20] Not a directory:
'/home/pcl337b/jkeitel/sage/sage_optional/build/pkgs/.directory/package-
version.txt'
}}}
I am attaching a simple patch that ignores files and only checks
folders.
URL: http://trac.sagemath.org/18993
Reported by: jkeitel
Ticket author(s): Jan Keitel
Reviewer(s): Volker Braun

-rwxr-xr-x | src/bin/sage-list-packages | 2 |

1 files changed, 2 insertions, 0 deletions

diff --git a/src/bin/sage-list-packages b/src/bin/sage-list-packages index 88f0f55..e809e40 100755 --- a/src/bin/sage-list-packages +++ b/src/bin/sage-list-packages @@ -52,6 +52,8 @@ installed = dict(pkgname_split(pkgname) SAGE_PKGS = os.path.join(SAGE_ROOT, "build", "pkgs") local = {} for p in os.listdir(SAGE_PKGS): + if not os.path.isdir(os.path.join(SAGE_PKGS, p)): + continue with open(os.path.join(SAGE_PKGS, p, "package-version.txt")) as f: version = f.read().strip() with open(os.path.join(SAGE_PKGS, p, "type")) as f: |