예제 #1
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"})
예제 #2
0
    def test_build_with_libs_and_includes_in_stagedir(self):
        plugin = qmake.QmakePlugin("test-part", self.options, self.project)
        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,
            ),
        ])
예제 #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)
        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,
            ),
        ])
예제 #4
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,
            ),
        ])
예제 #5
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,
            ),
        ])