# Path: pisi/actionsapi/shelltools.py
# def system(command):
#     command = string.join(string.split(command))
#     retValue = run_logged(command)
# 
#     #if return value is different than 0, it means error, raise exception
#     if retValue != 0:
#         error(_("Command \"%s\" failed, return value was %d.") % (command, retValue))
# 
#     return retValue
# 
# def can_access_file(filePath):
#     '''test the existence of file'''
#     return os.access(filePath, os.F_OK)
# 
# def unlink(pattern):
#     '''remove the file path'''
#     filePathGlob = glob.glob(pattern)
#     if len(filePathGlob) == 0:
#         ctx.ui.error(_("No file matched pattern \"%s\". Remove operation failed.") % pattern)
#         return
# 
#     for filePath in filePathGlob:
#         if isFile(filePath) or isLink(filePath):
#             try:
#                 os.unlink(filePath)
#             except OSError:
#                 ctx.ui.error(_('ActionsAPI [unlink]: Permission denied: %s.') % (filePath))
#         elif isDirectory(filePath):
#             ctx.ui.warning(_('ActionsAPI [unlink]: %s is not a file, use \'unlinkDir\' or \'removeDir\' to remove directories.') % filePath)
#         else:
#             ctx.ui.error(_('ActionsAPI [unlink]: File %s doesn\'t exists.') % (filePath))
# 
# def isEmpty(filePath):
#     '''Return True if filePath is an empty file'''
#     return os.path.getsize(filePath) == 0


import os
import glob
import gettext
import pisi.context as ctx
import pisi.actionsapi
import pisi.actionsapi.get as get
from pisi.actionsapi.shelltools import system, can_access_file, unlink, isEmpty
from pisi.actionsapi.pisitools import dodoc
    def __init__(self, value=''):
        pisi.actionsapi.Error.__init__(self, value)
        self.value = value
        ctx.ui.error(value)

class InstallError(pisi.actionsapi.Error):
    def __init__(self, value=''):
        pisi.actionsapi.Error.__init__(self, value)
        self.value = value
        ctx.ui.error(value)

class RunTimeError(pisi.actionsapi.Error):
    def __init__(self, value=''):
        pisi.actionsapi.Error.__init__(self, value)
        self.value = value
        ctx.ui.error(value)

def configure(parameters = ''):
    '''does python setup.py configure'''
    if system('python setup.py configure %s' % (parameters)):
        raise ConfigureError, _('Configuration failed.')


def compile(parameters = ''):
    '''compile source with given parameters.'''
    if system('python setup.py build %s' % (parameters)):
        raise CompileError, _('Make failed.')

def install(parameters = ''):
    '''does python setup.py install'''

# Path: pisi/actionsapi/shelltools.py
# def system(command):
#     command = string.join(string.split(command))
#     retValue = run_logged(command)
# 
#     #if return value is different than 0, it means error, raise exception
#     if retValue != 0:
#         error(_("Command \"%s\" failed, return value was %d.") % (command, retValue))
# 
#     return retValue
# 
# def can_access_file(filePath):
#     '''test the existence of file'''
#     return os.access(filePath, os.F_OK)
# 
# def unlink(pattern):
#     '''remove the file path'''
#     filePathGlob = glob.glob(pattern)
#     if len(filePathGlob) == 0:
#         ctx.ui.error(_("No file matched pattern \"%s\". Remove operation failed.") % pattern)
#         return
# 
#     for filePath in filePathGlob:
#         if isFile(filePath) or isLink(filePath):
#             try:
#                 os.unlink(filePath)
#             except OSError:
#                 ctx.ui.error(_('ActionsAPI [unlink]: Permission denied: %s.') % (filePath))
#         elif isDirectory(filePath):
#             ctx.ui.warning(_('ActionsAPI [unlink]: %s is not a file, use \'unlinkDir\' or \'removeDir\' to remove directories.') % filePath)
#         else:
#             ctx.ui.error(_('ActionsAPI [unlink]: File %s doesn\'t exists.') % (filePath))
# 
# def isEmpty(filePath):
#     '''Return True if filePath is an empty file'''
#     return os.path.getsize(filePath) == 0


# Path: pisi/actionsapi/pythonmodules.py
import os
import glob
import gettext
import pisi.context as ctx
import pisi.actionsapi
import pisi.actionsapi.get as get
from pisi.actionsapi.shelltools import system, can_access_file, unlink, isEmpty
from pisi.actionsapi.pisitools import dodoc

    def __init__(self, value=''):
        pisi.actionsapi.Error.__init__(self, value)
        self.value = value
        ctx.ui.error(value)

class InstallError(pisi.actionsapi.Error):
    def __init__(self, value=''):
        pisi.actionsapi.Error.__init__(self, value)
        self.value = value
        ctx.ui.error(value)

class RunTimeError(pisi.actionsapi.Error):
    def __init__(self, value=''):
        pisi.actionsapi.Error.__init__(self, value)
        self.value = value
        ctx.ui.error(value)

def configure(parameters = ''):
    '''does python setup.py configure'''
    if system('python setup.py configure %s' % (parameters)):
        raise ConfigureError, _('Configuration failed.')


def compile(parameters = ''):
    '''compile source with given parameters.'''
    if system('python setup.py build %s' % (parameters)):
        raise CompileError, _('Make failed.')

def install(parameters = ''):
    '''does python setup.py install'''

    if system('python setup.py install --root=%s --no-compile -O0 %s' % (get.installDIR(), parameters)):