summaryrefslogtreecommitdiffstats
path: root/scripts/mkpkglists.py
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-09-21 08:11:59 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-09-29 22:07:24 +0200
commitec5779c824f54f9bdc1303fb22e61b4d558ece39 (patch)
tree7de227f22ad604aa469e110eff9ae5e1fd01f2ba /scripts/mkpkglists.py
parentdd59eea368ec1683b492cf59b20c36477fa59c1a (diff)
downloadaur-ec5779c824f54f9bdc1303fb22e61b4d558ece39.tar.gz
aur-ec5779c824f54f9bdc1303fb22e61b4d558ece39.tar.xz
mkpkglists: Make output files configurable
Instead of writing the output to hardcoded files (relative to the document root), make the output paths of mkpkglists configurable. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'scripts/mkpkglists.py')
-rwxr-xr-xscripts/mkpkglists.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/mkpkglists.py b/scripts/mkpkglists.py
index 70cbd139..8a0f2e9d 100755
--- a/scripts/mkpkglists.py
+++ b/scripts/mkpkglists.py
@@ -2,11 +2,12 @@
import datetime
import gzip
-import os
+import aurweb.config
import aurweb.db
-docroot = os.path.dirname(os.path.realpath(__file__)) + "/../web/html/"
+packagesfile = aurweb.config.get('mkpkglists', 'packagesfile')
+pkgbasefile = aurweb.config.get('mkpkglists', 'pkgbasefile')
def main():
@@ -16,7 +17,7 @@ def main():
pkglist_header = "# AUR package list, generated on " + datestr
pkgbaselist_header = "# AUR package base list, generated on " + datestr
- with gzip.open(docroot + "packages.gz", "w") as f:
+ with gzip.open(packagesfile, "w") as f:
f.write(bytes(pkglist_header + "\n", "UTF-8"))
cur = conn.execute("SELECT Packages.Name FROM Packages " +
"INNER JOIN PackageBases " +
@@ -24,7 +25,7 @@ def main():
"WHERE PackageBases.PackagerUID IS NOT NULL")
f.writelines([bytes(x[0] + "\n", "UTF-8") for x in cur.fetchall()])
- with gzip.open(docroot + "pkgbase.gz", "w") as f:
+ with gzip.open(pkgbasefile, "w") as f:
f.write(bytes(pkgbaselist_header + "\n", "UTF-8"))
cur = conn.execute("SELECT Name FROM PackageBases " +
"WHERE PackagerUID IS NOT NULL")