Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
sage_bootstrap.package.Package.has_file: New, use it
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Nov 19, 2020
1 parent 69f7ea8 commit 40d6604
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions build/sage_bootstrap/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ def list_cls(self, *package_classes, **filters):
for pkg_name in pc.names:
if filenames:
pkg = Package(pkg_name)
if not all(os.path.exists(os.path.join(pkg.path, filename))
for filename in filenames):
if not all(pkg.has_file(filename) for filename in filenames):
continue
print(pkg_name)

Expand Down
8 changes: 7 additions & 1 deletion build/sage_bootstrap/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,13 @@ def path(self):
Return the package directory
"""
return os.path.join(SAGE_ROOT, 'build', 'pkgs', self.name)


def has_file(self, filename):
"""
Return whether the file exists in the package directory
"""
return os.path.exists(os.path.join(self.path, filename))

def _init_checksum(self):
"""
Load the checksums from the appropriate ``checksums.ini`` file
Expand Down

0 comments on commit 40d6604

Please sign in to comment.