# 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
# 
# Path: pisi/actionsapi/shelltools.py
# def can_access_file(filePath):
#     '''test the existence of file'''
#     return os.access(filePath, os.F_OK)
# 
# Path: pisi/actionsapi/shelltools.py
# 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))


import os
import gettext
import pisi.context as ctx
import pisi.actionsapi
import pisi.actionsapi.get as get
from pisi.actionsapi.shelltools import system
from pisi.actionsapi.shelltools import can_access_file
from pisi.actionsapi.shelltools import unlink
from pisi.actionsapi.libtools import gnuconfig_update
        self.value = value
        ctx.ui.error(value)

def configure(parameters = ''):
    '''configure source with given parameters = "--with-nls --with-libusb --with-something-usefull"'''

    if can_access_file('configure'):
        gnuconfig_update()

        args = './configure \
                --prefix=/%s \
                --build=%s \
                --mandir=/%s \
                --infodir=/%s \
                --datadir=/%s \
                --sysconfdir=/%s \
                --localstatedir=/%s \
                --libexecdir=/%s \
                %s' % (get.defaultprefixDIR(), \
                       get.HOST(), get.manDIR(), \
                       get.infoDIR(), get.dataDIR(), \
                       get.confDIR(), get.localstateDIR(), get.libexecDIR(), parameters)

        if system(args):
            raise ConfigureError(_('Configure failed.'))
    else:
        raise ConfigureError(_('No configure script found.'))

def rawConfigure(parameters = ''):
    '''configure source with given parameters = "--prefix=/usr --libdir=/usr/lib --with-nls"'''

# 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
# 
# Path: pisi/actionsapi/shelltools.py
# def can_access_file(filePath):
#     '''test the existence of file'''
#     return os.access(filePath, os.F_OK)
# 
# Path: pisi/actionsapi/shelltools.py
# 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))


# Path: pisi/actionsapi/autotools.py
import os
import gettext
import pisi.context as ctx
import pisi.actionsapi
import pisi.actionsapi.get as get
from pisi.actionsapi.shelltools import system
from pisi.actionsapi.shelltools import can_access_file
from pisi.actionsapi.shelltools import unlink
from pisi.actionsapi.libtools import gnuconfig_update

        self.value = value
        ctx.ui.error(value)

def configure(parameters = ''):
    '''configure source with given parameters = "--with-nls --with-libusb --with-something-usefull"'''

    if can_access_file('configure'):
        gnuconfig_update()

        args = './configure \
                --prefix=/%s \
                --build=%s \
                --mandir=/%s \
                --infodir=/%s \
                --datadir=/%s \
                --sysconfdir=/%s \
                --localstatedir=/%s \
                --libexecdir=/%s \
                %s' % (get.defaultprefixDIR(), \
                       get.HOST(), get.manDIR(), \
                       get.infoDIR(), get.dataDIR(), \
                       get.confDIR(), get.localstateDIR(), get.libexecDIR(), parameters)

        if system(args):
            raise ConfigureError(_('Configure failed.'))
    else:
        raise ConfigureError(_('No configure script found.'))

def rawConfigure(parameters = ''):
    '''configure source with given parameters = "--prefix=/usr --libdir=/usr/lib --with-nls"'''

    if can_access_file('configure'):