Make maintenance scripts installable

Add wrappers for the maintenance scripts to the setuptools
configuration.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2016-10-17 15:20:29 +02:00
parent 85866796a4
commit 37188603b5
9 changed files with 9 additions and 0 deletions

View file

@ -1,26 +0,0 @@
#!/usr/bin/python3
import time
import aurweb.db
def main():
conn = aurweb.db.Connection()
conn.execute("UPDATE PackageBases SET NumVotes = (" +
"SELECT COUNT(*) FROM PackageVotes " +
"WHERE PackageVotes.PackageBaseID = PackageBases.ID)")
now = int(time.time())
conn.execute("UPDATE PackageBases SET Popularity = (" +
"SELECT COALESCE(SUM(POWER(0.98, (? - VoteTS) / 86400)), 0.0) " +
"FROM PackageVotes WHERE PackageVotes.PackageBaseID = " +
"PackageBases.ID AND NOT VoteTS IS NULL)", [now])
conn.commit()
conn.close()
if __name__ == '__main__':
main()