def install(args=''): """Autobuilder install""" if can_access_file("autogen.sh"): autotools.install(args) if can_access_file("Makefile"): autotools.install(args) if can_access_file("meson.build"): mesontools.install(args) if can_access_file("CmakeLists.txt"): cmaketools.install(args)
def rawInstall(parameters='', argument='install'): """install source into install directory with given parameters = PREFIX=get.installDIR()""" if can_access_file('makefile') or can_access_file( 'Makefile') or can_access_file('GNUmakefile'): if system('make {0} {1} '.format(parameters, argument)): raise InstallError(_('Install failed.')) else: fixInfoDir() else: raise InstallError(_('No Makefile found.'))
def configure(args=''): """Autobuilder setup""" if can_access_file("autogen.sh"): autotools.autogen(args) if can_access_file("configure"): autotools.configure(args) if can_access_file("meson.build"): mesontools.configure(args) if can_access_file("CmakeLists.txt"): cmaketools.configure(args)
def configure(parameters=''): """configure source with given parameters.""" export('PERL_MM_USE_DEFAULT', '1') if can_access_file('Build.PL'): if system('perl{0} Build.PL installdirs=vendor destdir={1}'.format(get.curPERL(), get.installDIR())): raise ConfigureError(_('Configure failed.')) elif can_access_file('Makefile.PL'): if system('perl{0} Makefile.PL {1} PREFIX=/usr INSTALLDIRS=vendor DESTDIR={2}'.format(get.curPERL(), parameters, get.installDIR())): raise ConfigureError(_('Configure failed.')) else: raise ConfigureError(_('No configure script found. (\"{}\" file not found.)'.format("Build.PL/Makefile.PL")))
def configure(parameters='', installPrefix='/{}'.format(get.defaultprefixDIR()), sourceDir='.'): """configure source with given cmake parameters = "-DCMAKE_BUILD_TYPE -DCMAKE_CXX_FLAGS ... " """ if can_access_file(join_path(sourceDir, 'CMakeLists.txt')): args = 'cmake -DCMAKE_INSTALL_PREFIX={0} \ -DCMAKE_INSTALL_LIBDIR={1} \ -DCMAKE_BUILD_TYPE=RelWithDebInfo {2} {3}'.format( installPrefix, "/usr/lib32 " if get.buildTYPE() == "emul32" else "/usr/lib", parameters, sourceDir) if get.CFLAGS(): args += ' -DCMAKE_C_FLAGS="{0} {1}"'.format( get.CFLAGS(), "-m32" if get.buildTYPE() == "emul32" else "-m64") if get.CXXFLAGS(): args += ' -DCMAKE_CXX_FLAGS="{0} {1}"'.format( get.CXXFLAGS(), "-m32" if get.buildTYPE() == "emul32" else "-m64") if get.LDFLAGS(): args += ' -DCMAKE_LD_FLAGS="{0}"'.format(get.LDFLAGS()) if system(args): raise ConfigureError(_('Configure failed.')) else: raise ConfigureError( _('No configure script found. (\"{}\" file not found.)'.format( "CMakeLists.txt")))
def install(parameters='', argument='install'): """install source into install directory with given parameters""" # You can't squeeze unix paths with things like 'bindir', 'datadir', etc with CMake # http://public.kitware.com/pipermail/cmake/2006-August/010748.html args = 'make DESTDIR="{0}" \ {1} \ {2}'.format(get.installDIR(), parameters, argument) if can_access_file('makefile') or can_access_file( 'Makefile') or can_access_file('GNUmakefile'): if system('make {0} {1} '.format(parameters, argument)): raise InstallError(_('Install failed.')) else: fixInfoDir() else: raise InstallError(_('No Makefile found.'))
def configure(parameters=''): """configure source with given parameters = "--with-nls --with-libusb --with-something-usefull""" if can_access_file('configure'): gnuconfig_update() prefix = get.emul32prefixDIR() if get.buildTYPE( ) == "emul32" else get.defaultprefixDIR() args = './configure \ --prefix=/{0} \ --build={1} \ --mandir=/{2} \ --infodir=/{3} \ --datadir=/{4} \ --sysconfdir=/{5} \ --localstatedir=/{6} \ --libexecdir=/{7} \ {8}{9}'.format( prefix, get.HOST(), get.manDIR(), get.infoDIR(), get.dataDIR(), get.confDIR(), get.localstateDIR(), get.libexecDIR(), "--libdir=/usr/lib32 " if get.buildTYPE() == "emul32" else "", parameters) if system(args): raise ConfigureError(_('Configure failed.')) else: raise ConfigureError( _('No configure script found. (\"{}\" file not found.)'.format( "configure")))
def __init__(self, value=''): inary.actionsapi.Error.__init__(self, value) self.value = value ctx.ui.error("[AutoTools]: " + value) if can_access_file('config.log'): ctx.ui.error( _('Please attach the config.log to your bug report:\n{}/config.log').format(os.getcwd()))
def make(parameters=''): """make source with given parameters.""" if can_access_file('Makefile'): if system('make {}'.format(parameters)): raise MakeError(_('Make failed.')) else: if system('perl{0} Build {1}'.format(get.curPERL(), parameters)): raise MakeError(_('\'perl build\' failed.'))
def fixCompiledPy(lookInto='/usr/lib/{}/'.format(get.curPYTHON())): """ cleans *.py[co] from packages """ for root, dirs, files in os.walk('{0}/{1}'.format(get.installDIR(), lookInto)): for compiledFile in files: if compiledFile.endswith('.pyc') or compiledFile.endswith('.pyo'): if can_access_file('{0}/{1}'.format(root, compiledFile)): unlink('{0}/{1}'.format(root, compiledFile))
def removePodfiles(path='usr/lib/perl5/'): """ cleans *.pod files from perl packages """ full_path = '{0}/{1}'.format(get.installDIR(), path) for root, dirs, files in os.walk(full_path): for packFile in files: if packFile.endswith(".pod"): if can_access_file('{0}/{1}'.format(root, packFile)): unlink('{0}/{1}'.format(root, packFile)) removeEmptydirs(root)
def removePacklist(path='usr/lib/perl5/'): """ cleans .packlist file from perl packages """ full_path = '{0}/{1}'.format(get.installDIR(), path) for root, dirs, files in os.walk(full_path): for packFile in files: if packFile == ".packlist": if can_access_file('{0}/{1}'.format(root, packFile)): unlink('{0}/{1}'.format(root, packFile)) removeEmptydirs(root)
def rawConfigure(parameters=''): """configure source with given parameters = --prefix=/usr --libdir=/usr/lib --with-nls """ if can_access_file('configure'): gnuconfig_update() if system('./configure {}'.format(parameters)): raise ConfigureError(_('Configure failed.')) else: raise ConfigureError( _('No configure script found. (\"{}\" file not found.)'.format("configure")))
def install(parameters='install'): """install source with given parameters.""" if can_access_file('Makefile'): if system('make {}'.format(parameters)): raise InstallError(_('Install failed.')) else: if system('perl{} Build install'.format(get.curPERL())): raise MakeError(_('\'perl install\' failed.')) removePacklist() removePodfiles()
def configure(projectfile='', parameters='', installPrefix=prefix): if projectfile != '' and not shelltools.can_access_file(projectfile): raise ConfigureError( _("Project file \"{}\" not found.").format(projectfile)) profiles = glob.glob("*.pro") if len(profiles) > 1 and projectfile == '': raise ConfigureError( _("It seems there are more than one .pro file, you must specify one. (Possible .pro files: \"{}\")" ).format(", ".join(profiles))) shelltools.system( "{0} -makefile {1} PREFIX='{2}' QMAKE_CFLAGS+='{3}' QMAKE_CXXFLAGS+='{4}' {5}" .format(qmake, projectfile, installPrefix, get.CFLAGS(), get.CXXFLAGS(), parameters))
def install(): for tool in alsa_tools: shelltools.cd(tool) autotools.rawInstall("DESTDIR=\"%s\"" % get.installDIR()) for doc in [d for d in docs if shelltools.can_access_file(d)]: if tool in gui_tools: srctag = "alsa-tools-gui" else: srctag = get.srcNAME() inarytools.insinto("/usr/share/doc/%s/%s" % (srctag, tool), doc) shelltools.cd("..") inarytools.remove("/usr/share/applications/hdspmixer.desktop") inarytools.remove("/usr/share/applications/hdspconf.desktop")
def meson_configure(parameters=""): if can_access_file('meson.build'): prefix = get.defaultprefixDIR() args = "meson \ --prefix=/{0} \ --buildtype=plain \ --libdir=/{0}/lib{1} \ --libexecdir=/{2} \ --sysconfdir=/{3} \ --localstatedir=/{4} \ {5} inaryPackageBuild".format( prefix, "32 " if get.buildTYPE() == "emul32" else "", get.libexecDIR(), get.confDIR(), get.localstateDIR(), parameters) if system(args): raise MesonError(_('Configure failed.')) else: raise ConfigureError( _('No configure script found. (\"{}\" file not found.)'.format( "meson.build")))
def cmake_configure(parameters=""): makedirs("inaryPackageBuild") cd("inaryPackageBuild") if can_access_file(util.join_path("..", 'CMakeLists.txt')): args = 'cmake -DCMAKE_INSTALL_PREFIX=/{0} \ -DCMAKE_INSTALL_LIBDIR={1} \ -DCMAKE_C_FLAGS="{6} {2}" \ -DCMAKE_CXX_FLAGS="{6} {3}" \ -DCMAKE_LD_FLAGS="{4}" \ -DCMAKE_BUILD_TYPE=RelWithDebInfo {5} -G Ninja ..'.format( get.defaultprefixDIR(), "/usr/lib32 " if get.buildTYPE() == "emul32" else "/usr/lib", get.CFLAGS(), get.CXXFLAGS(), get.LDFLAGS(), parameters, "-m32" if get.buildTYPE() == "emul32" else "-m64") if system(args): raise ConfigureError(_('CMake configure failed.')) else: raise ConfigureError( _('No configure script found. (\"{}\" file not found.)'.format( "CMakeLists.txt")))
def configure(parameters='', installPrefix='', sourceDir='.'): """configure source with given Go parameters = "-DGo_BUILD_TYPE -DGo_CXX_FLAGS ... " """ if not can_access_file(join_path(sourceDir, 'main.go')): raise ConfigureError(_('{} not found'.format("main.go")))
def fixInfoDir(): infoDir = '{}/usr/share/info/dir'.format(get.installDIR()) if can_access_file(infoDir): unlink(infoDir)
def testCanAccessFile(self): from inary.actionsapi.shelltools import can_access_file self.assertTrue(can_access_file(__file__)) self.assertFalse(can_access_file('actionsapi/set.py'))