summaryrefslogtreecommitdiffstats
path: root/git-interface/git-serve.py
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-09-20 20:18:24 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-09-29 22:07:06 +0200
commitdc3fd60715a5b17b9542ec888c6eaeb14c284e2b (patch)
tree18d9f17b8d582409f0db55ee32fc5efa674aaa2e /git-interface/git-serve.py
parent1946486a67d6085318e00c753d341ab05d12904c (diff)
downloadaur-dc3fd60715a5b17b9542ec888c6eaeb14c284e2b.tar.gz
aur-dc3fd60715a5b17b9542ec888c6eaeb14c284e2b.tar.xz
Use setuptools to install Python modules
Instead of using relative imports, add support for installing the config and db Python modules to a proper location using setuptools. Change all git-interface scripts to access those modules from the search path. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'git-interface/git-serve.py')
-rwxr-xr-xgit-interface/git-serve.py40
1 files changed, 20 insertions, 20 deletions
diff --git a/git-interface/git-serve.py b/git-interface/git-serve.py
index 8bcecd27..5f3b26dd 100755
--- a/git-interface/git-serve.py
+++ b/git-interface/git-serve.py
@@ -7,23 +7,23 @@ import subprocess
import sys
import time
-import config
-import db
+import aurweb.config
+import aurweb.db
-notify_cmd = config.get('notifications', 'notify-cmd')
+notify_cmd = aurweb.config.get('notifications', 'notify-cmd')
-repo_path = config.get('serve', 'repo-path')
-repo_regex = config.get('serve', 'repo-regex')
-git_shell_cmd = config.get('serve', 'git-shell-cmd')
-git_update_cmd = config.get('serve', 'git-update-cmd')
-ssh_cmdline = config.get('serve', 'ssh-cmdline')
+repo_path = aurweb.config.get('serve', 'repo-path')
+repo_regex = aurweb.config.get('serve', 'repo-regex')
+git_shell_cmd = aurweb.config.get('serve', 'git-shell-cmd')
+git_update_cmd = aurweb.config.get('serve', 'git-update-cmd')
+ssh_cmdline = aurweb.config.get('serve', 'ssh-cmdline')
-enable_maintenance = config.getboolean('options', 'enable-maintenance')
-maintenance_exc = config.get('options', 'maintenance-exceptions').split()
+enable_maintenance = aurweb.config.getboolean('options', 'enable-maintenance')
+maintenance_exc = aurweb.config.get('options', 'maintenance-exceptions').split()
def pkgbase_from_name(pkgbase):
- conn = db.Connection()
+ conn = aurweb.db.Connection()
cur = conn.execute("SELECT ID FROM PackageBases WHERE Name = ?", [pkgbase])
row = cur.fetchone()
@@ -35,7 +35,7 @@ def pkgbase_exists(pkgbase):
def list_repos(user):
- conn = db.Connection()
+ conn = aurweb.db.Connection()
cur = conn.execute("SELECT ID FROM Users WHERE Username = ?", [user])
userid = cur.fetchone()[0]
@@ -55,7 +55,7 @@ def create_pkgbase(pkgbase, user):
if pkgbase_exists(pkgbase):
die('{:s}: package base already exists: {:s}'.format(action, pkgbase))
- conn = db.Connection()
+ conn = aurweb.db.Connection()
cur = conn.execute("SELECT ID FROM Users WHERE Username = ?", [user])
userid = cur.fetchone()[0]
@@ -81,7 +81,7 @@ def pkgbase_adopt(pkgbase, user, privileged):
if not pkgbase_id:
die('{:s}: package base not found: {:s}'.format(action, pkgbase))
- conn = db.Connection()
+ conn = aurweb.db.Connection()
cur = conn.execute("SELECT ID FROM PackageBases WHERE ID = ? AND " +
"MaintainerUID IS NULL", [pkgbase_id])
@@ -111,7 +111,7 @@ def pkgbase_adopt(pkgbase, user, privileged):
def pkgbase_get_comaintainers(pkgbase):
- conn = db.Connection()
+ conn = aurweb.db.Connection()
cur = conn.execute("SELECT UserName FROM PackageComaintainers " +
"INNER JOIN Users " +
@@ -132,7 +132,7 @@ def pkgbase_set_comaintainers(pkgbase, userlist, user, privileged):
if not privileged and not pkgbase_has_full_access(pkgbase, user):
die('{:s}: permission denied: {:s}'.format(action, user))
- conn = db.Connection()
+ conn = aurweb.db.Connection()
userlist_old = set(pkgbase_get_comaintainers(pkgbase))
@@ -198,7 +198,7 @@ def pkgbase_disown(pkgbase, user, privileged):
comaintainers = []
new_maintainer_userid = None
- conn = db.Connection()
+ conn = aurweb.db.Connection()
# Make the first co-maintainer the new maintainer, unless the action was
# enforced by a Trusted User.
@@ -232,7 +232,7 @@ def pkgbase_set_keywords(pkgbase, keywords):
if not pkgbase_id:
die('{:s}: package base not found: {:s}'.format(action, pkgbase))
- conn = db.Connection()
+ conn = aurweb.db.Connection()
conn.execute("DELETE FROM PackageKeywords WHERE PackageBaseID = ?",
[pkgbase_id])
@@ -245,7 +245,7 @@ def pkgbase_set_keywords(pkgbase, keywords):
def pkgbase_has_write_access(pkgbase, user):
- conn = db.Connection()
+ conn = aurweb.db.Connection()
cur = conn.execute("SELECT COUNT(*) FROM PackageBases " +
"LEFT JOIN PackageComaintainers " +
@@ -259,7 +259,7 @@ def pkgbase_has_write_access(pkgbase, user):
def pkgbase_has_full_access(pkgbase, user):
- conn = db.Connection()
+ conn = aurweb.db.Connection()
cur = conn.execute("SELECT COUNT(*) FROM PackageBases " +
"INNER JOIN Users " +