2
# -*- coding: utf-8 -*-
4
# PyQt4 bindings for th QTermWidget project.
6
# Copyright (C) 2009 Piotr "Riklaunim" Maliński <riklaunim@gmail.com>,
7
# Alexander Slesarev <alex.slesarev@gmail.com>
9
# This program is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation, either version 3 of the License, or
12
# (at your option) any later version.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License
20
# along with this program. If not, see <http://www.gnu.org/licenses/>.
24
from PyQt4 import pyqtconfig
26
# The name of the SIP build file generated by SIP and used by the build
28
build_file = "qtermwidget.sbf"
30
# Get the PyQt configuration information.
31
config = pyqtconfig.Configuration()
33
# Get the extra SIP flags needed by the imported qt module. Note that
34
# this normally only includes those flags (-x and -t) that relate to SIP's
36
qt_sip_flags = config.pyqt_sip_flags
38
# Run SIP to generate the code. Note that we tell SIP where to find the qt
39
# module's specification files using the -I flag.
40
os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, "-I",
41
config.pyqt_sip_dir, qt_sip_flags, "qtermwidget.sip"]))
43
# We are going to install the SIP specification file for this module and
44
# its configuration module.
47
installs.append(["qtermwidget.sip", os.path.join(config.default_sip_dir,
50
installs.append(["qtermwidgetconfig.py", config.default_mod_dir])
52
# Create the Makefile. The QtModuleMakefile class provided by the
53
# pyqtconfig module takes care of all the extra preprocessor, compiler and
54
# linker flags needed by the Qt library.
55
makefile = pyqtconfig.QtGuiModuleMakefile(
56
configuration = config,
57
build_file = build_file,
60
# Add the library we are wrapping. The name doesn't include any platform
61
# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
62
# ".dll" extension on Windows).
63
makefile.extra_lib_dirs.append("..")
64
makefile.extra_libs = ["qtermwidget"]
66
# Generate the Makefile itself.
69
# Now we create the configuration module. This is done by merging a Python
70
# dictionary (whose values are normally determined dynamically) with a
73
# Publish where the SIP specifications for this module will be
75
"qtermwidget_sip_dir": config.default_sip_dir,
77
# Publish the set of SIP flags needed by this module. As these are the
78
# same flags needed by the qt module we could leave it out, but this
79
# allows us to change the flags at a later date without breaking
80
# scripts that import the configuration module.
81
"qtermwidget_sip_flags": qt_sip_flags}
83
# This creates the qtermwidgetconfig.py module from the qtermwidgetconfig.py.in
84
# template and the dictionary.
85
sipconfig.create_config_module("qtermwidgetconfig.py", "config.py.in", content)