entropy.*: general code error check passed

This commit is contained in:
Fabio Erculiani
2009-03-30 17:19:15 +02:00
parent 9979f52b6c
commit 21cd91f2ac
19 changed files with 48 additions and 21 deletions
@@ -24,6 +24,7 @@ import os
from entropy.const import *
from entropy.exceptions import *
from entropy.output import red, darkred, darkgreen
from entropy.i18n import _
class Cache:
+1 -1
View File
@@ -24,7 +24,7 @@ from entropy.misc import Lifo
from entropy.const import *
from entropy.exceptions import *
from entropy.output import bold, darkgreen, darkred, blue, red
from entropy.i18n import _
class Calculators:
@@ -27,6 +27,7 @@ from entropy.client.interfaces.client import Client
from entropy.const import *
from entropy.exceptions import *
from entropy.output import *
from entropy.i18n import _
class Trigger:
+1
View File
@@ -28,6 +28,7 @@ from entropy.exceptions import *
from entropy.const import etpConst, etpCache
from entropy.output import darkred, darkgreen, red, brown, blue
from entropy.tools import getstatusoutput
from entropy.i18n import _
class FileUpdates:
@@ -24,6 +24,7 @@ import time
from entropy.exceptions import *
from entropy.i18n import _
from entropy.misc import TimeScheduled
from entropy.i18n import _
class Client:
@@ -20,6 +20,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
from __future__ import with_statement
from entropy.i18n import _
class Base:
+1
View File
@@ -24,6 +24,7 @@ import os
from entropy.const import etpConst
from entropy.output import blue, darkgreen, red, darkred, bold, purple, brown
from entropy.exceptions import *
from entropy.i18n import _
class QAInterface:
+9 -4
View File
@@ -25,9 +25,12 @@ import os
import shutil
from entropy.core import Singleton
from entropy.exceptions import *
from entropy.const import etpConst, etpSys, const_setup_perms, const_create_working_dirs, const_read_srv_settings
from entropy.output import TextInterface, purple, red, darkgreen, bold, brown, blue, darkred, darkblue
from entropy.const import etpConst, etpSys, const_setup_perms, \
const_create_working_dirs, const_read_srv_settings
from entropy.output import TextInterface, purple, red, darkgreen, \
bold, brown, blue, darkred, darkblue
from entropy.server.interfaces.mirrors import Server as MirrorsServer
from entropy.i18n import _
class Server(Singleton,TextInterface):
@@ -177,8 +180,10 @@ class Server(Singleton,TextInterface):
def setup_services(self):
self.setup_entropy_settings()
if hasattr(self,'ClientService'):
self.ClientService.destroy()
cs_name = 'ClientService'
if hasattr(self,cs_name):
obj = getattr(self,cs_name)
obj.destroy()
from entropy.client.interfaces import Client
self.ClientService = Client(
indexing = self.indexing,
@@ -25,8 +25,10 @@ import os
import shutil
import time
from entropy.exceptions import *
from entropy.output import TextInterface, purple, green, red, darkgreen, bold, brown, blue, darkred, darkblue
from entropy.output import TextInterface, purple, green, red, darkgreen, bold, \
brown, blue, darkred, darkblue
from entropy.const import etpConst, etpSys
from entropy.i18n import _
class Server:
@@ -27,6 +27,7 @@ import random
from entropy.services.skel import Authenticator, RemoteDatabase
from entropy.exceptions import *
from entropy.const import etpConst
from entropy.i18n import _
class phpBB3Auth(Authenticator,RemoteDatabase):
+18 -6
View File
@@ -24,9 +24,11 @@ from __future__ import with_statement
import os
import shutil
import time
from entropy.const import etpConst, ETP_LOGLEVEL_NORMAL, ETP_LOGPRI_INFO
from entropy.const import etpConst, ETP_LOGLEVEL_NORMAL, ETP_LOGPRI_INFO, \
const_setup_perms
from entropy.exceptions import *
from entropy.services.skel import SocketAuthenticator, SocketCommands
from entropy.i18n import _
class SocketHost:
@@ -211,6 +213,10 @@ class SocketHost:
self.SSL = self.HostInterface.SSL
self.real_sock = None
self.ssl_authorized_clients_only = authorized_clients_only
# declare undeclared attributes
self.address_family = None
self.socket_type = None
self.RequestHandlerClass = RequestHandlerClass
if self.SSL:
self.SocketServer.BaseServer.__init__(self, server_address, RequestHandlerClass)
@@ -245,7 +251,6 @@ class SocketHost:
def make_ssl_connection_alive(self):
self.real_sock = self.socket_mod.socket(self.address_family, self.socket_type)
self.socket = self.ConnWrapper(self.SSL['m'].Connection(self.context, self.real_sock))
self.server_bind()
self.server_activate()
@@ -387,7 +392,13 @@ class SocketHost:
timed_out = False
def __init__(self, request, client_address, server):
self.SocketServer.BaseRequestHandler.__init__(self, request, client_address, server)
# pre-init attribues
self.server = None
self.request = None
self.client_address = None
self.SocketServer.BaseRequestHandler.__init__(self, request,
client_address, server)
def data_receiver(self):
@@ -395,7 +406,8 @@ class SocketHost:
return True
self.timed_out = True
try:
ready_to_read, ready_to_write, in_error = self.select.select([self.request], [], [], self.default_timeout)
ready_to_read, ready_to_write, in_error = self.select.select(
[self.request], [], [], self.default_timeout)
except KeyboardInterrupt:
self.timed_out = True
return True
@@ -740,7 +752,7 @@ class SocketHost:
)
tb = self.entropyTools.get_traceback()
print tb
self.server.processor.HostInterface.socketLog.write(tb)
self.HostInterface.socketLog.write(tb)
return "close"
except Exception, e:
self.HostInterface.updateProgress(
@@ -751,7 +763,7 @@ class SocketHost:
)
tb = self.entropyTools.get_traceback()
print tb
self.server.processor.HostInterface.socketLog.write(tb)
self.HostInterface.socketLog.write(tb)
return "close"
p_args = args
@@ -26,6 +26,7 @@ from entropy.services.interfaces import SocketHost
from entropy.output import TextInterface, blue, brown
from entropy.const import etpConst, etpCache
from entropy.misc import TimeScheduled
from entropy.i18n import _
class Server(SocketHost):
+1
View File
@@ -21,6 +21,7 @@
'''
from entropy.exceptions import *
from entropy.i18n import _
class SocketCommands:
@@ -25,7 +25,7 @@ import sys
import subprocess
from entropy.const import etpConst
from entropy.output import blue, red
from entropy.i18n import _
class Base:
@@ -23,6 +23,7 @@ from __future__ import with_statement
import time
import os
import random
import subprocess
from entropy.services.interfaces import SocketHost
from entropy.const import etpConst, const_setup_perms
from entropy.output import TextInterface
@@ -29,6 +29,7 @@ from entropy.services.skel import RemoteDatabase
from entropy.exceptions import *
from entropy.const import etpConst, etpUi, etpCache, const_setup_perms, const_set_chmod, const_setup_file
from entropy.output import brown, bold, blue
from entropy.i18n import _
class Server(RemoteDatabase):
+3 -6
View File
@@ -25,6 +25,7 @@ import shutil
from entropy.const import etpConst, etpUi
from entropy.exceptions import *
from entropy.output import darkred, darkgreen, brown, darkblue, purple, red, bold
from entropy.i18n import _
class Spm:
@@ -121,12 +122,8 @@ class PortagePlugin:
self.EAPI = portage_const.EAPI
self.portage_const = portage_const
try:
from portage.versions import best
self.portage_best = best
except ImportError:
from portage_versions import best
self.portage_best = best
from portage.versions import best
self.portage_best = best
try:
import portage.util as portage_util
+1 -1
View File
@@ -421,7 +421,7 @@ def get_random_number():
random.seed()
return random.randint(10000,99999)
def countdown(secs=5,what="Counting...", back = False):
def countdown(secs=5, what="Counting...", back = False):
if secs:
if back:
try:
+1 -1
View File
@@ -350,7 +350,7 @@ class urlFetcher:
def handle_statistics(self, th_id, downloaded_size, total_size,
average, old_average, update_step, show_speed, data_transfer,
time_remaining, time_remaining_secs):
pass
return
def updateProgress(self):