remove duplicate dist dirs
This commit is contained in:
parent
a91d0c85c5
commit
0f86483a4c
|
@ -266,12 +266,20 @@ class PipWeb(object):
|
||||||
|
|
||||||
yield self.tpl.get_template("pypi/repo.html") \
|
yield self.tpl.get_template("pypi/repo.html") \
|
||||||
.render(repo=repo,
|
.render(repo=repo,
|
||||||
dists=db().query(PipPackage).filter(PipPackage.repo == repo).order_by(PipPackage.dist).all())
|
dists=self._get_dists(repo))
|
||||||
return
|
return
|
||||||
|
|
||||||
yield self.tpl.get_template("pypi/root.html") \
|
yield self.tpl.get_template("pypi/root.html") \
|
||||||
.render(repos=db().query(PipRepo).order_by(PipRepo.name).all())
|
.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):
|
def handle_download(self, reponame, distname, filename):
|
||||||
repo = get_repo(db(), reponame, create_ok=False)
|
repo = get_repo(db(), reponame, create_ok=False)
|
||||||
pkg = db().query(PipPackage).filter(PipPackage.repo == repo, PipPackage.fname == filename).first()
|
pkg = db().query(PipPackage).filter(PipPackage.repo == repo, PipPackage.fname == filename).first()
|
||||||
|
|
Loading…
Reference in New Issue