Commit a68a414f3ebe272b4a75a405d08796f5638f26fe
1 parent
b0bf07b9
Exists in
master
and in
1 other branch
Moved the definition of class PackageXapianIndex() to data.py module.
Showing
1 changed file
with
0 additions
and
37 deletions
Show diff stats
src/tests/pxi.py
| ... | ... | @@ -1,37 +0,0 @@ |
| 1 | -#!/usr/bin/env python | |
| 2 | -""" | |
| 3 | - userTests - User class test case | |
| 4 | -""" | |
| 5 | -__author__ = "Tassia Camoes Araujo <tassia@gmail.com>" | |
| 6 | -__copyright__ = "Copyright (C) 2011 Tassia Camoes Araujo" | |
| 7 | -__license__ = """ | |
| 8 | - This program is free software: you can redistribute it and/or modify | |
| 9 | - it under the terms of the GNU General Public License as published by | |
| 10 | - the Free Software Foundation, either version 3 of the License, or | |
| 11 | - (at your option) any later version. | |
| 12 | - | |
| 13 | - This program is distributed in the hope that it will be useful, | |
| 14 | - but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | - GNU General Public License for more details. | |
| 17 | - | |
| 18 | - You should have received a copy of the GNU General Public License | |
| 19 | - along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 20 | -""" | |
| 21 | - | |
| 22 | -import xapian | |
| 23 | -import sys | |
| 24 | -sys.path.insert(0,'../') | |
| 25 | - | |
| 26 | -class PkgXapianIndex(xapian.WritableDatabase): | |
| 27 | - def __init__(self): | |
| 28 | - xapian.WritableDatabase.__init__(self,".pxi",xapian.DB_CREATE_OR_OVERWRITE) | |
| 29 | - pxi_file = open("package-xapian-index") | |
| 30 | - for line in pxi_file: | |
| 31 | - doc = xapian.Document() | |
| 32 | - package_name = line.split()[0].rstrip(":") | |
| 33 | - doc.add_term("XP"+package_name) | |
| 34 | - package_tags = [tag.rstrip(",") for tag in line.split()[1:]] | |
| 35 | - for tag in package_tags: | |
| 36 | - doc.add_term("XT"+tag) | |
| 37 | - self.add_document(doc) |