Browse Source

remove duplicate dist dirs

master
dave 1 year ago
parent
commit
0f86483a4c
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      repobot/pypiprovider.py

+ 9
- 1
repobot/pypiprovider.py View File

@@ -266,12 +266,20 @@ class PipWeb(object):

yield self.tpl.get_template("pypi/repo.html") \
.render(repo=repo,
dists=db().query(PipPackage).filter(PipPackage.repo == repo).order_by(PipPackage.dist).all())
dists=self._get_dists(repo))
return

yield self.tpl.get_template("pypi/root.html") \
.render(repos=db().query(PipRepo).order_by(PipRepo.name).all())

def _get_dists(self, repo):
lastdist = None
for dist in db().query(PipPackage).filter(PipPackage.repo == repo).order_by(PipPackage.dist).all():
if lastdist and dist.dist == lastdist:
continue
yield dist
lastdist = dist.dist

def handle_download(self, reponame, distname, filename):
repo = get_repo(db(), reponame, create_ok=False)
pkg = db().query(PipPackage).filter(PipPackage.repo == repo, PipPackage.fname == filename).first()


Loading…
Cancel
Save