summaryrefslogtreecommitdiffstats
path: root/configure.py
diff options
context:
space:
mode:
Diffstat (limited to 'configure.py')
-rw-r--r--configure.py49
1 files changed, 29 insertions, 20 deletions
diff --git a/configure.py b/configure.py
index a34b71d..b5c4221 100644
--- a/configure.py
+++ b/configure.py
@@ -85,6 +85,7 @@ opt_split = 1
opt_tracing = 0
opt_verbose = 0
opt_keepfeatures = 0
+opt_accept_license = 0
opt_vendorcheck = 0
opt_vendincdir = sipcfg.py_inc_dir
@@ -126,6 +127,7 @@ def usage(rcode = 2):
sys.stdout.write(" -v dir where the PyTQt .sip files will be installed [default %s]\n" % opt_pyqtsipdir)
sys.stdout.write(" -w don't suppress compiler output during configuration\n")
sys.stdout.write(" -y lib explicitly specify the type of TQt library, either qt, qt-mt, qte, qte-mt, qtmt, tqt, tqt-mt, tqte, tqte-mt or tqtmt\n")
+ sys.stdout.write(" -z accept the license terms without prompting\n")
sys.exit(rcode)
@@ -391,10 +393,10 @@ def inform_user():
sip_tqt_config.inform("TQt v%s %sis being used." % (sip_tqt_config.version_to_string(qt_version), edstr))
sip_tqt_config.inform("SIP-TQt %s is being used." % sipcfg.sip_version_str)
- sip_tqt_config.inform("These PyTQt modules will be built: %s." % string.join(pyqt_modules))
+ sip_tqt_config.inform("These PyTQt modules will be built: %s." % ' '.join(pyqt_modules))
if disabled_classes:
- sip_tqt_config.inform("Support for these TQt classes has been disabled: %s." % string.join(disabled_classes))
+ sip_tqt_config.inform("Support for these TQt classes has been disabled: %s." % ' '.join(disabled_classes))
sip_tqt_config.inform("The PyTQt modules will be installed in %s." % opt_pyqtmoddir)
sip_tqt_config.inform("The PyTQt .sip files will be installed in %s." % opt_pyqtsipdir)
@@ -579,7 +581,7 @@ def check_qscintilla():
# If we find a snapshot then set a negative version number as a
# special case.
- if string.find(sciversstr, "snapshot") >= 0:
+ if sciversstr.find("snapshot") >= 0:
qsci_version = -1
else:
sip_tqt_config.inform("The TQScintilla library could not be found in %s and so the qtext module will not be built. If TQScintilla is installed then use the -o argument to explicitly specify the correct directory." % opt_qscilibdir)
@@ -801,7 +803,7 @@ def get_feature_flags():
line = ff.readline()
while line:
- flags.extend(string.split(line))
+ flags.extend(line.split())
line = ff.readline()
if sipcfg.sip_version >= 0x040702:
@@ -929,9 +931,9 @@ def generate_code(mname, extra_cflags=None, extra_cxxflags=None, extra_define=No
argv.append(os.path.join(src_dir, "sip"))
# SIP-TQt assumes POSIX style path separators.
- argv.append(string.join([src_dir, "sip", mname, mname + "mod.sip"], "/"))
+ argv.append('/'.join([src_dir, "sip", mname, mname + "mod.sip"]))
- os.system(string.join(argv))
+ os.system(' '.join(argv))
# Check the result.
if not os.access(buildfile, os.F_OK):
@@ -1005,7 +1007,7 @@ def check_license():
lname = "GNU General Public License"
lfile = None
- sip_tqt_config.inform("This is the %s version of PyTQt %s (licensed under the %s) for Python %s on %s." % (ltype, pyqt_version_str, lname, string.split(sys.version)[0], sys.platform))
+ sip_tqt_config.inform("This is the %s version of PyTQt %s (licensed under the %s) for Python %s on %s." % (ltype, pyqt_version_str, lname, sys.version[0].split(), sys.platform))
# Common checks.
if ltype == "GPL" and sys.platform == "win32":
@@ -1029,12 +1031,17 @@ Type 'no' to decline the terms of the license.
""")
while 1:
+ sys.stdout.write("Do you accept the terms of the license? ")
+ sys.stdout.flush()
+
try:
- resp = raw_input("Do you accept the terms of the license? ")
+ resp = sys.stdin.readline()
+ except KeyboardInterrupt:
+ raise SystemExit
except:
resp = ""
- resp = string.lower(string.strip(resp))
+ resp = resp.strip().lower()
if resp == "yes":
break
@@ -1060,7 +1067,7 @@ def get_build_macros(overrides):
overrides is a list of macros overrides from the user.
"""
# Get the name of the qmake configuration file to take the macros from.
- if "QMAKESPEC" in os.environ.keys():
+ if "QMAKESPEC" in list(os.environ.keys()):
fname = os.path.join(qt_dir, "mkspecs", os.environ["QMAKESPEC"], "qmake.conf")
else:
fname = os.path.join(qt_dir, "mkspecs", "default", "qmake.conf")
@@ -1069,7 +1076,7 @@ def get_build_macros(overrides):
sip_tqt_config.error("Unable to find the default configuration file %s. You can use the QMAKESPEC environment variable to specify the correct platform instead of \"default\"." % fname)
# Add the TQt specific macros to the default.
- names = sipcfg.build_macros().keys()
+ names = list(sipcfg.build_macros().keys())
names.append("INCDIR_TQT")
names.append("LIBDIR_TQT")
names.append("MOC")
@@ -1163,7 +1170,7 @@ def check_qt_installation(macros):
l = f.readline()
while l:
- wl = string.split(l)
+ wl = l.split()
if len(wl) == 3 and wl[0] == "#define" and wl[1] == "QT_PRODUCT_LICENSE":
qt_edition = wl[2][4:-1]
break
@@ -1193,7 +1200,7 @@ def check_qt_installation(macros):
cfg = f.readline()
f.close()
- val = string.find(cfg, "=")
+ val = cfg.find("=")
if val >= 0:
qt_winconfig = string.strip(cfg[val + 1:])
@@ -1292,7 +1299,7 @@ def resolve_qt3_library(generator):
sip_tqt_config.error("No TQt libraries could be found in %s." % qt_libdir)
if len(names) > 1:
- sip_tqt_config.error("These TQt libraries were found: %s. Use the -y argument to explicitly specify which you want to use." % string.join(names))
+ sip_tqt_config.error("These TQt libraries were found: %s. Use the -y argument to explicitly specify which you want to use." % ' '.join(names))
def is_qt_library(generator, lib):
@@ -1320,10 +1327,6 @@ def main(argv):
argv is the list of command line arguments.
"""
- # Check Python isn't too new.
- if sipcfg.py_version >= 0x030000:
- sip_tqt_config.error("PyTQt v3.x does not support Python v3.x")
-
# Check SIP-TQt is new enough.
if sipcfg.sip_version_str[:8] != "snapshot":
if sipcfg.sip_version < sip_min_version:
@@ -1331,7 +1334,7 @@ def main(argv):
# Parse the command line.
try:
- optlist, args = getopt.getopt(argv[1:], "ha:b:cd:e:fg:ij:kl:m:n:o:q:rsuv:wy:")
+ optlist, args = getopt.getopt(argv[1:], "ha:b:cd:e:fg:ij:kl:m:n:o:q:rsuv:wy:z")
except getopt.GetoptError:
usage()
@@ -1342,6 +1345,7 @@ def main(argv):
global opt_qsciincdir, opt_qscilibdir, qsci_define
global opt_vendorcheck, opt_vendincdir, opt_vendlibdir
global opt_libpython
+ global opt_accept_license
opt_libpython = None
@@ -1396,6 +1400,8 @@ def main(argv):
opt_tqtlib = arg
else:
usage()
+ elif opt == "-z":
+ opt_accept_license = 1
# Check that we know the name of the TQt root directory.
if not qt_dir:
@@ -1418,7 +1424,10 @@ def main(argv):
check_qt_installation(macros)
# Check the licenses are compatible.
- check_license()
+ if opt_accept_license == 1:
+ print("License accepted by command line option.")
+ else:
+ check_license()
# Check for TQScintilla.
check_qscintilla()