From 6e97fe51c6c985e95e3712a06ebcb0d0c273fc82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Tue, 20 Sep 2005 13:34:52 +0000 Subject: [PATCH] --- pisi/build.py | 8 +-- pisi/comariface.py | 120 ------------------------------------------ pisi/xmlfile.py | 4 +- tests/xmlfiletests.py | 5 +- 4 files changed, 9 insertions(+), 128 deletions(-) delete mode 100644 pisi/comariface.py diff --git a/pisi/build.py b/pisi/build.py index 3b012fd8..84f614f3 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -191,17 +191,17 @@ class PisiBuild: def run_setup_action(self): # Run configure, build and install phase - ctx.ui.action(_("Setting up source...\n")) + ctx.ui.action(_("Setting up source...")) self.run_action_function(ctx.const.setup_func) self.set_state("setupaction") def run_build_action(self): - ctx.ui.action(_("Building source...\n")) + ctx.ui.action(_("Building source...")) self.run_action_function(ctx.const.build_func) self.set_state("buildaction") def run_install_action(self): - ctx.ui.action(_("Installing...\n")) + ctx.ui.action(_("Installing...")) # Before install make sure install_dir is clean if os.path.exists(self.bctx.pkg_install_dir()): @@ -284,7 +284,7 @@ class PisiBuild: compressType=patch.compressionType, targetDir=ctx.config.tmp_dir()) - ctx.ui.action(_("* Applying patch: %s\n") % patch.filename) + ctx.ui.action(_("* Applying patch: %s") % patch.filename) util.do_patch(self.srcDir, patchFile, level=patch.level, target=patch.target) def gen_metadata_xml(self, package): diff --git a/pisi/comariface.py b/pisi/comariface.py deleted file mode 100644 index 89397ad2..00000000 --- a/pisi/comariface.py +++ /dev/null @@ -1,120 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2005, TUBITAK/UEKAE -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# Please read the COPYING file. -# - -import socket -import struct - -import pisi - -class ComarError(pisi.Error): - pass - -class ComarIface: - """A class for communicating with comard.""" - RESULT = 0 - FAIL = 1 - RESULT_START = 2 - RESULT_END = 3 - NOTIFY = 4 - __LOCALIZE = 5 - __REGISTER = 6 - __REMOVE = 7 - __CALL = 8 - - def __init__(self): - try: - self.sock = socket.socket(socket.AF_UNIX,socket.SOCK_STREAM) - self.sock.connect("/tmp/comar") - except: - # should raise an exception here - raise ComarError, 'Cannot connect to COMAR daemon' - - def __pack(self, cmd, id, args): - size = 0 - args2 = [] - # NOTE: COMAR RPC is using network byte order (big endian) - fmt = "!ii" - for a in args: - a = str(a) # damn unicode - fmt += "h%dsB" % (len(a)) - size += 2 + len(a) + 1 - args2.append(len(a)) - args2.append(a.encode("utf-8")) - args2.append(0) - pak = struct.pack(fmt, (cmd << 24) | size, id, *args2) - return pak - - def read_reply(self): - pass - - def localize(self, localename): - """Sets the language for translated replies. - - Since comard has no way to detect caller's locale, this command - is used for sending user's language to the comard. Afterwards, - all the jobs started with API calls uses translated messages in - their replies. - - You can get the localename parameter from setlocale(NULL) call. - """ - pass - - def register(self, classname, packagename, cslfile, id = 0): - """Registers a package script on the system model. - """ - pak = self.__pack(self.__REGISTER, id, - [ classname, packagename, cslfile ] - ) - self.sock.send(pak) - - def remove(self, packagename, id = 0): - """Remove package's all scripts from system. - """ - pak = self.__pack(self.__REMOVE, id, [ packagename ]) - self.sock.send(pak) - - def call(self, methodname, args, id = 0): - """Makes a configuration call on the system model. - """ - a = [ methodname ] - a.extend(args) - pak =self.__pack(self.__CALL, id, a) - self.sock.send(pak) - - def call_package(self, methodname, packagename, args, id = 0): - """Makes a configuration call directed to a package. - """ - pass - - def call_instance(self, methodname, packagename, instancename, args, id = 0): - # not yet decided - pass - - def get_packages(self, classname, id = 0): - """Returns registered packages for a given system model class. - """ - pass - - def ask_notify(self, notifyname, id = 0): - """Asks for a notification event to be delivered. - """ - pass - -comard = None - -def init(): - comard = ComarIface() - -def finalize(): - if comard: - del comard - diff --git a/pisi/xmlfile.py b/pisi/xmlfile.py index cffc227b..75382b65 100644 --- a/pisi/xmlfile.py +++ b/pisi/xmlfile.py @@ -35,6 +35,7 @@ import xml.dom.minidom as mdom from xml.parsers.expat import ExpatError import codecs +import types # PiSi import pisi @@ -45,8 +46,7 @@ import pisi.context as ctx class Error(pisi.Error): pass -import types - + mandatory, optional = range(2) # poor man's enum # basic types diff --git a/tests/xmlfiletests.py b/tests/xmlfiletests.py index 7953ba89..c563d2b8 100644 --- a/tests/xmlfiletests.py +++ b/tests/xmlfiletests.py @@ -14,6 +14,8 @@ import xml.dom.minidom as mdom from xml.parsers.expat import ExpatError import types +import pisi +import pisi.api from pisi import xmlfile from pisi.config import config import pisi.util as util @@ -21,8 +23,7 @@ from pisi.xmlext import * class XmlFileTestCase(unittest.TestCase): def setUp(self): -# impl = mdom.getDOMImplementation() - pass + pisi.api.init(False) def testMetaClass(self): class A: