summaryrefslogtreecommitdiff
path: root/devel/management/commands
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-09 16:17:42 -0500
committerDan McGee <dan@archlinux.org>2011-06-09 16:17:42 -0500
commit5fe626c6cc8444603cf7ae5199271b69d38ff255 (patch)
tree8793ac0b30f8863eb4d1d7028ef97291e9279804 /devel/management/commands
parent1840416b9e8892a685202f30b4079fd04607151f (diff)
Management command cleanup
Now that we aren't seeing odd segfaults and hung tasks, we can remove the traceback stuff from the scripts. Also use the 'io' module only, it has been long enough. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'devel/management/commands')
-rw-r--r--devel/management/commands/reporead.py27
1 files changed, 5 insertions, 22 deletions
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py
index a8875c7e..1adc359e 100644
--- a/devel/management/commands/reporead.py
+++ b/devel/management/commands/reporead.py
@@ -18,7 +18,7 @@ from django.contrib.auth.models import User
from django.db import transaction
from django.db.models import Q
-import codecs
+import io
import os
import re
import sys
@@ -27,14 +27,6 @@ import logging
from datetime import datetime
from optparse import make_option
-# New in 2.6, but fast (C implementation) in 2.7. We will use it over codecs if
-# available. Eventually remove the codecs import completely.
-io = None
-try:
- import io
-except ImportError:
- pass
-
from main.models import Arch, Package, PackageDepend, PackageFile, Repo
from packages.models import Conflict, Provision, Replacement
@@ -74,11 +66,6 @@ class Command(BaseCommand):
elif v == 2:
logger.level = logging.DEBUG
- import signal, traceback
- handler = lambda sig, stack: traceback.print_stack(stack)
- signal.signal(signal.SIGQUIT, handler)
- signal.signal(signal.SIGUSR1, handler)
-
return read_repo(arch, filename, options)
@@ -101,8 +88,7 @@ class Pkg(object):
setattr(self, k, None)
for k in self.collections:
setattr(self, k, ())
- # So we can tell the diffence between a package with no files, and a DB
- # without files entries
+ self.files = None
self.has_files = False
def populate(self, values):
@@ -461,16 +447,13 @@ def parse_repo(repopath):
if fname not in dbfiles:
continue
data_file = repodb.extractfile(tarinfo)
- if io is None:
- data_file = codecs.EncodedFile(data_file, 'utf-8')
- else:
- data_file = io.TextIOWrapper(io.BytesIO(data_file.read()),
- encoding='utf=8')
+ data_file = io.TextIOWrapper(io.BytesIO(data_file.read()),
+ encoding='utf=8')
try:
data = parse_info(data_file)
p = pkgs.setdefault(pkgid, Pkg(reponame))
p.populate(data)
- except UnicodeDecodeError, e:
+ except UnicodeDecodeError:
logger.warn("Could not correctly decode %s, skipping file",
tarinfo.name)
data_file.close()