Example #1
0
 def do_configure(self, buildscript):
     buildscript.set_action(_('Configuring'), self)
     srcdir = self.get_srcdir(buildscript)
     builddir = self.get_builddir(buildscript)
     if os.path.exists(builddir):
         try:
             # Clear CMake files so we get a clean configure.
             os.unlink(os.path.join(builddir, 'CMakeCache.txt'))
             shutil.rmtree(os.path.join(builddir, 'CMakeFiles'))
         except EnvironmentError:
             pass
     else:
         os.makedirs(builddir)
     prefix = os.path.expanduser(buildscript.config.prefix)
     if not inpath('cmake', os.environ['PATH'].split(os.pathsep)):
         raise CommandError(_('%s not found') % 'cmake')
     baseargs = '-DCMAKE_INSTALL_PREFIX=%s -DCMAKE_INSTALL_LIBDIR=lib' % prefix
     cmakeargs = self.get_cmakeargs()
     if self.use_ninja:
         baseargs += ' -G Ninja'
     # CMake on Windows generates VS projects or NMake makefiles by default.
     # When using MSYS "MSYS Makefiles" is the best guess. "Unix Makefiles"
     # and "MinGW Makefiles" could also work (each is a bit different).
     if os.name == 'nt' and os.getenv("MSYSCON") and '-G' not in cmakeargs:
         baseargs += ' -G "MSYS Makefiles"'
     cmakedir = os.path.join(srcdir,
                             self.cmakedir) if self.cmakedir else srcdir
     cmd = 'cmake %s %s %s' % (baseargs, cmakeargs, cmakedir)
     buildscript.execute(cmd, cwd=builddir, extra_env=self.extra_env)
Example #2
0
 def do_configure(self, buildscript):
     buildscript.set_action(_('Configuring'), self)
     srcdir = self.get_srcdir(buildscript)
     builddir = self.get_builddir(buildscript)
     # meson does not allow configuring if the builddir already exists,
     # so we'll need to get rid of it and start over to configure again.
     if os.path.exists(builddir):
         shutil.rmtree(builddir)
     os.makedirs(builddir)
     prefix = os.path.expanduser(buildscript.config.prefix)
     if not inpath('meson', os.environ['PATH'].split(os.pathsep)):
         raise CommandError(_('%s not found') % 'meson')
     baseargs = '--prefix %s --libdir %s' % (prefix, self.get_libdir())
     mesonargs = self.get_mesonargs()
     cmd = 'meson %s %s %s' % (baseargs, mesonargs, srcdir)
     buildscript.execute(cmd, cwd=builddir, extra_env=self.extra_env)
Example #3
0
    def check_m4(self):
        try:
            not_in_path = []
            path = get_aclocal_path()

            macros = ['libtool.m4', 'gettext.m4', 'pkg.m4']
            for macro in macros:
                if not inpath(macro, path):
                    uprint(
                        _("aclocal can't see %s macros") %
                        (macro.split('.m4')[0]))
                    if not_in_path.count(macro) == 0:
                        not_in_path.append(macro)

            if len(not_in_path) > 0:
                uprint(_("Please copy the lacking macros (%(macros)s) in one of the following paths: %(path)s") % \
                       {'macros': ', '.join(not_in_path), 'path': ', '.join(path)})

        except CommandError as exc:
            uprint(str(exc))
Example #4
0
 def checkout(self, buildscript):
     if not inpath('darcs', os.environ['PATH'].split(os.pathsep)):
         raise CommandError(_('%s not found') % 'darcs')
     Branch.checkout(self, buildscript)
     self._fix_permissions()
Example #5
0
    def run(self, config, options, args, help=None):
        if args:
            raise UsageError(_('no extra arguments expected'))

        # try creating jhbuild directories before checking they are accessible.
        try:
            os.makedirs(config.checkoutroot)
            os.makedirs(config.prefix)
        except OSError:
            pass

        # check whether the checkout root and install prefix are writable
        if not (os.path.isdir(config.checkoutroot) and os.access(
                config.checkoutroot, os.R_OK | os.W_OK | os.X_OK)):
            uprint(
                _('checkout root (%s) is not writable') % config.checkoutroot)
        if not (os.path.isdir(config.prefix)
                and os.access(config.prefix, os.R_OK | os.W_OK | os.X_OK)):
            uprint(_('install prefix (%s) is not writable') % config.prefix)

        autoconf = True

        # check whether various tools are installed
        if not check_version(['libtoolize', '--version'],
                             r'libtoolize \([^)]*\) ([\d.]+)', '1.5'):
            uprint(_('%s not found') % 'libtool >= 1.5')
        if not check_version(['gettext', '--version'],
                             r'gettext \([^)]*\) ([\d.]+)', '0.10.40'):
            uprint(_('%s not found') % 'gettext >= 0.10.40')
        if not check_version(['pkg-config', '--version'], r'^([\d.]+)',
                             '0.14.0'):
            uprint(_('%s not found') % 'pkg-config >= 0.14.0')
        if not check_version(['autoconf', '--version'],
                             r'autoconf \([^)]*\) ([\d.]+)', '2.53'):
            autoconf = False
            uprint(_('%s not found') % 'autoconf >= 2.53')
        if not check_version(['automake', '--version'],
                             r'automake \([^)]*\) ([\d.]+)', '1.10'):
            uprint(_('%s not found') % 'automake >= 1.10')

        if (autoconf):
            self.check_m4()

        # XML catalog sanity checks
        xmlcatalog = True
        try:
            get_output(['which', 'xmlcatalog'])
        except CommandError:
            xmlcatalog = False
            uprint(
                _('Could not find XML catalog (usually part of the package \'libxml2-utils\')'
                  ))

        if (xmlcatalog):
            for (item, name) in [
                ('-//OASIS//DTD DocBook XML V4.1.2//EN',
                 'DocBook XML DTD V4.1.2'),
                ('http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl',
                 'DocBook XSL Stylesheets')
            ]:
                try:
                    get_output(['xmlcatalog', '/etc/xml/catalog', item])
                except CommandError:
                    uprint(
                        _('Could not find %s in XML catalog (usually part of package \'docbook-xsl\')'
                          ) % name)

        # Perl module used by tools such as intltool:
        perlmod = 'XML::Parser'
        try:
            get_output(['perl', '-M%s' % perlmod, '-e', 'exit'])
        except CommandError:
            uprint(
                _('Could not find the Perl module %s (usually part of package \'libxml-parser-perl\' or \'perl-XML-Parser\')'
                  ) % perlmod)

        # check for a downloading util:
        if not (inpath('curl', os.environ['PATH'].split(os.pathsep))
                or inpath('wget', os.environ['PATH'].split(os.pathsep))):
            uprint(_('curl or wget not found'))

        # check for git:
        if not inpath('git', os.environ['PATH'].split(os.pathsep)):
            uprint(_('%s not found') % 'git')
        else:
            try:
                git_help = os.popen('git --help', 'r').read()
                if 'clone' not in git_help:
                    uprint(_('Installed git program is not the right git'))
                else:
                    if not check_version(['git', '--version'],
                                         r'git version ([\d.]+)', '1.5.6'):
                        uprint(_('%s not found') % 'git >= 1.5.6')
            except EnvironmentError:
                uprint(_('Could not check git program'))

        # check for flex/bison:
        if not inpath('flex', os.environ['PATH'].split(os.pathsep)):
            uprint(_('%s not found') % 'flex')
        if not inpath('bison', os.environ['PATH'].split(os.pathsep)):
            uprint(_('%s not found') % 'bison')
        if not inpath('xzcat', os.environ['PATH'].split(os.pathsep)):
            uprint(_('%s not found') % 'xzcat')

        # check for "sysdeps --install" deps:
        try:
            from gi.repository import GLib
            GLib
        except ImportError:
            uprint(_('%s not found') % 'python-gobject')
        try:
            import dbus.glib
            dbus.glib
        except ImportError:
            uprint(_('%s not found') % 'dbus-python')