~verzegnassi-stefano/+junk/ubuntu-terminal-app-uitk13

« back to all changes in this revision

Viewing changes to src/plugin/qmltermwidget/qtermwidget/pyqt4/config.py

  • Committer: Filippo Scognamiglio
  • Date: 2014-10-25 04:42:31 UTC
  • Revision ID: flscogna@gmail.com-20141025044231-javjhusbqa171127
Initial reboot commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# -*- coding: utf-8 -*-
 
3
 
 
4
# PyQt4 bindings for th QTermWidget project.
 
5
#
 
6
# Copyright (C) 2009 Piotr "Riklaunim" Maliński <riklaunim@gmail.com>,
 
7
#                    Alexander Slesarev <alex.slesarev@gmail.com>
 
8
#
 
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.
 
13
#
 
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.
 
18
#
 
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/>.
 
21
 
 
22
import os
 
23
import sipconfig
 
24
from PyQt4 import pyqtconfig
 
25
 
 
26
# The name of the SIP build file generated by SIP and used by the build
 
27
# system.
 
28
build_file = "qtermwidget.sbf"
 
29
 
 
30
# Get the PyQt configuration information.
 
31
config = pyqtconfig.Configuration()
 
32
 
 
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
 
35
# versioning system.
 
36
qt_sip_flags = config.pyqt_sip_flags
 
37
 
 
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"]))
 
42
 
 
43
# We are going to install the SIP specification file for this module and
 
44
# its configuration module.
 
45
installs = []
 
46
 
 
47
installs.append(["qtermwidget.sip", os.path.join(config.default_sip_dir,
 
48
                                                 "qtermwidget")])
 
49
 
 
50
installs.append(["qtermwidgetconfig.py", config.default_mod_dir])
 
51
 
 
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,
 
58
    installs = installs)
 
59
 
 
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"]
 
65
 
 
66
# Generate the Makefile itself.
 
67
makefile.generate()
 
68
 
 
69
# Now we create the configuration module.  This is done by merging a Python
 
70
# dictionary (whose values are normally determined dynamically) with a
 
71
# (static) template.
 
72
content = {
 
73
    # Publish where the SIP specifications for this module will be
 
74
    # installed.
 
75
    "qtermwidget_sip_dir": config.default_sip_dir,
 
76
 
 
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}
 
82
 
 
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)