def test_unsupported_qt_version(self):
        self.options.qt_version = 'qt3'
        with self.assertRaises(RuntimeError) as raised:
            qmake.QmakePlugin('test-part', self.options, self.project_options)

        self.assertEqual(str(raised.exception),
                         "Unsupported Qt version: 'qt3'")
Example #2
0
    def test_build_with_libs_and_includes_in_stagedir(self):
        plugin = qmake.QmakePlugin("test-part", self.options,
                                   self.project_options)
        os.makedirs(plugin.sourcedir)
        os.makedirs(os.path.join(plugin.project.stage_dir, "include"))
        os.makedirs(os.path.join(plugin.project.stage_dir, "lib"))
        plugin.build()

        self.run_mock.assert_has_calls([
            mock.call(
                [
                    "qmake",
                    'LIBS+="-L{}/lib"'.format(plugin.project.stage_dir),
                    'INCLUDEPATH+="{}/include"'.format(
                        plugin.project.stage_dir),
                ],
                cwd=plugin.builddir,
                env=mock.ANY,
            ),
            mock.call(["make", "-j2"], cwd=plugin.builddir, env=mock.ANY),
            mock.call(
                [
                    "make", "install", "INSTALL_ROOT={}".format(
                        plugin.installdir)
                ],
                cwd=plugin.builddir,
                env=mock.ANY,
            ),
        ])
Example #3
0
    def test_build_with_project_file_with_subdir(self):
        self.options.source_subdir = "subdir"
        self.options.project_files = ["project_file.pro"]

        plugin = qmake.QmakePlugin("test-part", self.options,
                                   self.project_options)
        os.makedirs(plugin.sourcedir)
        plugin.build()

        path_to_pro_file = os.path.join(plugin.sourcedir,
                                        plugin.options.source_subdir,
                                        "project_file.pro")
        self.run_mock.assert_has_calls([
            mock.call(["qmake", path_to_pro_file],
                      cwd=plugin.builddir,
                      env=mock.ANY),
            mock.call(["make", "-j2"], cwd=plugin.builddir, env=mock.ANY),
            mock.call(
                [
                    "make", "install", "INSTALL_ROOT={}".format(
                        plugin.installdir)
                ],
                cwd=plugin.builddir,
                env=mock.ANY,
            ),
        ])
Example #4
0
    def test_build_environment_qt5(self):
        self.options.qt_version = "qt5"
        plugin = qmake.QmakePlugin("test-part", self.options, self.project)
        os.makedirs(plugin.sourcedir)
        plugin.build()

        self.assert_expected_environment({"QT_SELECT": "qt5"})
Example #5
0
    def test_build_environment_qt5(self):
        self.options.qt_version = 'qt5'
        plugin = qmake.QmakePlugin('test-part', self.options,
                                   self.project_options)
        os.makedirs(plugin.sourcedir)
        plugin.build()

        self.assert_expected_environment({'QT_SELECT': 'qt5'})
Example #6
0
    def test_build_referencing_sourcedir_if_no_subdir(self):
        plugin = qmake.QmakePlugin('test-part', self.options,
                                   self.project_options)
        os.makedirs(plugin.sourcedir)
        plugin.build()

        self.run_mock.assert_has_calls([
            mock.call(['qmake'], cwd=plugin.builddir,
                      env=mock.ANY),
            mock.call(['make', '-j2'], cwd=plugin.builddir, env=mock.ANY),
            mock.call(['make', 'install',
                       'INSTALL_ROOT={}'.format(plugin.installdir)],
                      cwd=plugin.builddir, env=mock.ANY)])
Example #7
0
    def test_build_with_options(self):
        self.options.options = ['-foo']

        plugin = qmake.QmakePlugin('test-part', self.options,
                                   self.project_options)
        os.makedirs(plugin.sourcedir)
        plugin.build()

        self.run_mock.assert_has_calls([
            mock.call(['qmake', '-foo'], cwd=plugin.builddir,
                      env=mock.ANY),
            mock.call(['make', '-j2'], cwd=plugin.builddir, env=mock.ANY),
            mock.call(['make', 'install',
                       'INSTALL_ROOT={}'.format(plugin.installdir)],
                      cwd=plugin.builddir, env=mock.ANY)])
Example #8
0
    def test_build_with_libs_and_includes_in_installdir(self):
        plugin = qmake.QmakePlugin('test-part', self.options,
                                   self.project_options)
        os.makedirs(plugin.sourcedir)
        os.makedirs(os.path.join(plugin.installdir, 'include'))
        os.makedirs(os.path.join(plugin.installdir, 'lib'))
        plugin.build()

        self.run_mock.assert_has_calls([
            mock.call(['qmake', 'LIBS+="-L{}/lib"'.format(plugin.installdir),
                       'INCLUDEPATH+="{}/include"'.format(plugin.installdir)],
                      cwd=plugin.builddir, env=mock.ANY),
            mock.call(['make', '-j2'], cwd=plugin.builddir, env=mock.ANY),
            mock.call(['make', 'install',
                       'INSTALL_ROOT={}'.format(plugin.installdir)],
                      cwd=plugin.builddir, env=mock.ANY)])
Example #9
0
    def test_build_with_project_file(self):
        self.options.project_files = ['project_file.pro']

        plugin = qmake.QmakePlugin('test-part', self.options,
                                   self.project_options)
        os.makedirs(plugin.sourcedir)
        plugin.build()

        path_to_pro_file = os.path.join(plugin.sourcedir, 'project_file.pro')
        self.run_mock.assert_has_calls([
            mock.call(['qmake', path_to_pro_file], cwd=plugin.builddir,
                      env=mock.ANY),
            mock.call(['make', '-j2'], cwd=plugin.builddir, env=mock.ANY),
            mock.call(['make', 'install',
                       'INSTALL_ROOT={}'.format(plugin.installdir)],
                      cwd=plugin.builddir, env=mock.ANY)])
Example #10
0
    def test_build_referencing_sourcedir_if_no_subdir(self):
        plugin = qmake.QmakePlugin("test-part", self.options, self.project)
        os.makedirs(plugin.sourcedir)
        plugin.build()

        self.run_mock.assert_has_calls([
            mock.call(["qmake"], cwd=plugin.builddir, env=mock.ANY),
            mock.call(["make", "-j2"], cwd=plugin.builddir, env=mock.ANY),
            mock.call(
                [
                    "make", "install", "INSTALL_ROOT={}".format(
                        plugin.installdir)
                ],
                cwd=plugin.builddir,
                env=mock.ANY,
            ),
        ])
Example #11
0
    def test_build_with_options(self):
        self.options.options = ["-foo"]

        plugin = qmake.QmakePlugin("test-part", self.options, self.project)
        os.makedirs(plugin.sourcedir)
        plugin.build()

        self.run_mock.assert_has_calls([
            mock.call(["qmake", "-foo"], cwd=plugin.builddir, env=mock.ANY),
            mock.call(["make", "-j2"], cwd=plugin.builddir, env=mock.ANY),
            mock.call(
                [
                    "make", "install", "INSTALL_ROOT={}".format(
                        plugin.installdir)
                ],
                cwd=plugin.builddir,
                env=mock.ANY,
            ),
        ])