From f272772dcbcd113030130f61e454a769a3a6e2c8 Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Thu, 2 Jan 2014 13:09:48 -0500 Subject: [PATCH] Change the Python module's name back to rlgall. It is no longer an experimental variant. Using a database as a backend is a settled feature. --- README.txt | 2 +- py/cleandb.py | 2 +- py/recorder.py | 2 +- py/{rlgalldb.py => rlgall.py} | 2 +- py/setupdb.py | 2 +- py/stats.py | 10 ++++++---- web/archive.cgi | 2 +- web/recent.cgi | 2 +- web/scoring/players/index.cgi | 2 +- 9 files changed, 14 insertions(+), 12 deletions(-) rename py/{rlgalldb.py => rlgall.py} (99%) mode change 100644 => 100755 py/stats.py diff --git a/README.txt b/README.txt index c5a5e4f..9236399 100644 --- a/README.txt +++ b/README.txt @@ -12,7 +12,7 @@ py/ contains various Python scripts. py/recorder.py processes the log files and stores the data in a PostgreSQL database. It should be run periodically by cron. -py/rlgalldb.py is a module which recorder.py requires. It should be installed +py/rlgall.py is a module which recorder.py requires. It should be installed in /lib/python/site-packages or the equivalent location. web/ contains the static parts of the rlgallery.org website. Note that when diff --git a/py/cleandb.py b/py/cleandb.py index d589a17..2be90df 100755 --- a/py/cleandb.py +++ b/py/cleandb.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 # cleandb.py: empty the database in an orderly fashion -import rlgalldb as rlgall +import rlgall import psycopg2 dbconn = psycopg2.connect("dbname=rlg") diff --git a/py/recorder.py b/py/recorder.py index c72f31d..7c306df 100755 --- a/py/recorder.py +++ b/py/recorder.py @@ -2,7 +2,7 @@ import os import psycopg2 -import rlgalldb as rlgall +import rlgall # Contains a dir for everyone who registered everydir = "/var/dgl/dgldir/ttyrec/" diff --git a/py/rlgalldb.py b/py/rlgall.py similarity index 99% rename from py/rlgalldb.py rename to py/rlgall.py index 1130905..a671389 100644 --- a/py/rlgalldb.py +++ b/py/rlgall.py @@ -1,4 +1,4 @@ -# rlgalldb.py +# rlgall.py # Module for the Roguelike Gallery, using a postgres database # Requires Python 3.3 diff --git a/py/setupdb.py b/py/setupdb.py index 2df048a..b3a2986 100755 --- a/py/setupdb.py +++ b/py/setupdb.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 # setupdb.py: initializes the database tables used by the rlg system. -import rlgalldb as rlgall +import rlgall import psycopg2 webuser = "webserver" diff --git a/py/stats.py b/py/stats.py old mode 100644 new mode 100755 index 68d6683..fbdc054 --- a/py/stats.py +++ b/py/stats.py @@ -1,6 +1,8 @@ +#!/usr/bin/python3 + import math import psycopg2 -import rlgalldb as rlgall +import rlgall def makeExpPDF(lbd): def lpdf(x): @@ -22,13 +24,13 @@ for game in rlgall.gamelist: total = sum(scores) lbd = float(count) / total cdf = makeExpCDF(lbd) - print "{0}: {1} games, average {2}".format(game.name, count, int(1/lbd)) + print("{0}: {1} games, average {2}".format(game.name, count, int(1/lbd))) for i in range(0, 10000, 1000): actual = len([ s for s in scores if i <= s < i + 1000 ]) predicted = (cdf(i + 1000) - cdf(i)) * count - print "{0:5}: {1:4} {2}".format(i, actual, predicted) + print("{0:5}: {1:4} {2}".format(i, actual, predicted)) high = max(scores) - print "Max: {0} {1}\n".format(high, 1 - cdf(high)) + print("Max: {0} {1}\n".format(high, 1 - cdf(high))) cur.close() conn.close() diff --git a/web/archive.cgi b/web/archive.cgi index 9521cd5..53a15f8 100755 --- a/web/archive.cgi +++ b/web/archive.cgi @@ -7,7 +7,7 @@ import time import calendar from datetime import datetime import pytz -import rlgalldb as rlgall +import rlgall #import cgitb #cgitb.enable() diff --git a/web/recent.cgi b/web/recent.cgi index 1ee65d6..cc84107 100755 --- a/web/recent.cgi +++ b/web/recent.cgi @@ -3,7 +3,7 @@ import sys import time -import rlgalldb as rlgall +import rlgall # It is assumed that sys.stdout uses UTF-8 encoding. If this is not the case, # configure the Web server to set the LC_CTYPE environment variable to a UTF-8 diff --git a/web/scoring/players/index.cgi b/web/scoring/players/index.cgi index 730d19e..0b3320d 100755 --- a/web/scoring/players/index.cgi +++ b/web/scoring/players/index.cgi @@ -2,7 +2,7 @@ import os import sys -import rlgalldb as rlgall +import rlgall playerdir = "/var/www/lighttpd/scoring/players/" linkstr = '
  • {0}
  • \n'