summaryrefslogtreecommitdiffstats
path: root/feed/sse_feed
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-11-21 16:39:26 +0000
committerLennart Poettering <lennart@poettering.net>2005-11-21 16:39:26 +0000
commit86b5e7777f80fdd8f2556105e6b9c3126316dfd3 (patch)
treee1caecc52703d4d93714f8c16e88a2a0c66fe195 /feed/sse_feed
parent118623476f8609c40425d751f56e44d720e3d6ff (diff)
change dashes to underscores
git-svn-id: file:///home/lennart/svn/public/sse/trunk@12 5fbabb74-0606-0410-a5e4-b5cc6a42724e
Diffstat (limited to 'feed/sse_feed')
-rwxr-xr-xfeed/sse_feed81
1 files changed, 0 insertions, 81 deletions
diff --git a/feed/sse_feed b/feed/sse_feed
deleted file mode 100755
index c6f0de9..0000000
--- a/feed/sse_feed
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/python
-
-import sys, os, MySQLdb, stat
-from popen2 import Popen3
-
-supported = [".c", ".h"]
-
-def supported_source(fn):
-
- for e in supported:
- if fn.endswith(e):
- return True
-
- return False
-
-def last_insert_id(cursor):
- cursor.execute("SELECT LAST_INSERT_ID()");
- return cursor.fetchone()[0]
-
-def process_file(package_id, root, path):
- global cursor
- print "Processing %s" % path
-
- cursor.execute("INSERT INTO file (package_id, path, language_id) VALUES (%i, '%s', '0')" % (package_id, path));
-
- file_id = last_insert_id(cursor);
-
- p = Popen3("lex-c %s" % (os.path.join(root, path)))
-
- for identifier in p.fromchild:
- text = identifier.strip()
-
- cursor.execute("INSERT IGNORE INTO word (text, type, file_id) VALUES ('%s', 'word', '%i')" % (text, file_id))
- cursor.execute("UPDATE word SET cnt=cnt+1 WHERE text='%s' AND type='word' AND file_id=%i" % (text, file_id))
-
- if p.wait() != 0:
- print "WARNING: Subprocess failed!"
-
- del p
-
-def handle_file(package_id, root, path, filename):
-
- t = sys.lstat(os.path.join(path, filename))
-
- if stat.F_ISREG(t.st_mode):
-
- extension = filename.split(".")[-1]
-
- if extension in ("c", "h"):
- process_file(package_id, root, os.path.join(path, filename))
- return
-
- os.unlink(os.path.join(root, path, filename))
-
-def handle_tree(path, name, url, md):
- global cursor
-
- cursor.execute("INSERT INTO package (path, name, url, timestamp, md) VALUES ('%s', '%s', '%s', NOW(), '%s')" % (path + "/%s", name, url, md));
- package_id = last_insert_id(cursor);
-
- path = os.path.realpath(path)
-
- for dirpath, dirs, files in os.walk(path):
- for f in files:
- assert path + "/" == (dirpath + "/") [:len(path)+1]
-
- handle_file(package_id, path, dirpath[len(path)+1:], f)
-
-if __name__ == "__main__":
- db = MySQLdb.connect(host = "localhost", user = "sse_web", passwd = "ece6Yoli", db = "sse")
- cursor = db.cursor();
- cursor.execute("SET AUTOCOMMIT=0")
- cursor.execute("START TRANSACTION")
-
- assert len(sys.argv) == 5
-
- handle_tree(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
-
- cursor.execute("COMMIT")
- cursor.close()
- db.close()