[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] Patch: Make build timeout adjustable
From: Kyle Altendorf <sda () fstab ! net>
Date: 2016-02-13 17:34:50
Message-ID: 07264ba422672942b397b61065169d83 () eumx ! net
[Download RAW message or body]
I'm not sure about the etiquette for patch submission but my changes are
available inline below as well as in the attached file.
When using the pyqtdeploy GUI I often end up with timeouts in the make
stage due to the default 30 second timeout of
QProcess::waitForFinished(). This patch adds a timeout spinbox below
the resource files spinbox to allow the user to select a custom timeout
value. I don't know if this should be saved to the .pdy file or not but
I did not implement that yet.
Is this of interest to anybody else? Phil?
Cheers,
-kyle
diff -r ccfb10c212ea pyqtdeploy/builder/builder.py
--- a/pyqtdeploy/builder/builder.py Sun Feb 07 17:35:19 2016 +0000
+++ b/pyqtdeploy/builder/builder.py Sat Feb 13 12:26:46 2016 -0500
@@ -1252,7 +1252,7 @@
self.run(argv, "Unable to freeze files")
- def run(self, argv, error_message, in_build_dir=False):
+ def run(self, argv, error_message, in_build_dir=False,
timeout=30000):
""" Execute a command and capture the output. """
if in_build_dir:
@@ -1284,7 +1284,7 @@
lambda:
stderr_output.append(process.readAllStandardError()))
process.start(argv[0], argv[1:])
- finished = process.waitForFinished()
+ finished = process.waitForFinished(timeout)
if saved_cwd is not None:
os.chdir(saved_cwd)
diff -r ccfb10c212ea pyqtdeploy/gui/build_page.py
--- a/pyqtdeploy/gui/build_page.py Sun Feb 07 17:35:19 2016 +0000
+++ b/pyqtdeploy/gui/build_page.py Sat Feb 13 12:26:46 2016 -0500
@@ -106,6 +106,12 @@
"memory.",
minimum=1)
options_layout.addWidget(self._resources_edit, 2, 1)
+ options_layout.addWidget(QLabel("Timeout"), 3, 0)
+ self._timeout_edit = QSpinBox(
+ whatsThis="The number of seconds to wait for processes
to time out.",
+ minimum=10)
+ self._timeout_edit.setValue(30)
+ options_layout.addWidget(self._timeout_edit, 3, 1)
options.setLayout(options_layout)
layout.addWidget(options, 2, 1)
@@ -188,7 +194,8 @@
logger.status_message("Running qmake...")
try:
- builder.run([qmake], "qmake failed.",
in_build_dir=True)
+ builder.run([qmake], "qmake failed.",
in_build_dir=True,
+ timeout=self._timeout_edit.value() * 1000)
except UserException as e:
logger.user_exception(e)
handle_user_exception(e, self.label, self)
@@ -203,7 +210,8 @@
try:
builder.run([make], "{0} failed.".format(make),
- in_build_dir=True)
+ in_build_dir=True,
+ timeout=self._timeout_edit.value() * 1000)
except UserException as e:
logger.user_exception(e)
handle_user_exception(e, self.label, self)
["adjustable_timeout.patch" (text/plain)]
diff -r ccfb10c212ea pyqtdeploy/builder/builder.py
--- a/pyqtdeploy/builder/builder.py Sun Feb 07 17:35:19 2016 +0000
+++ b/pyqtdeploy/builder/builder.py Sat Feb 13 12:26:46 2016 -0500
@@ -1252,7 +1252,7 @@
self.run(argv, "Unable to freeze files")
- def run(self, argv, error_message, in_build_dir=False):
+ def run(self, argv, error_message, in_build_dir=False, timeout=30000):
""" Execute a command and capture the output. """
if in_build_dir:
@@ -1284,7 +1284,7 @@
lambda: stderr_output.append(process.readAllStandardError()))
process.start(argv[0], argv[1:])
- finished = process.waitForFinished()
+ finished = process.waitForFinished(timeout)
if saved_cwd is not None:
os.chdir(saved_cwd)
diff -r ccfb10c212ea pyqtdeploy/gui/build_page.py
--- a/pyqtdeploy/gui/build_page.py Sun Feb 07 17:35:19 2016 +0000
+++ b/pyqtdeploy/gui/build_page.py Sat Feb 13 12:26:46 2016 -0500
@@ -106,6 +106,12 @@
"memory.",
minimum=1)
options_layout.addWidget(self._resources_edit, 2, 1)
+ options_layout.addWidget(QLabel("Timeout"), 3, 0)
+ self._timeout_edit = QSpinBox(
+ whatsThis="The number of seconds to wait for processes to time out.",
+ minimum=10)
+ self._timeout_edit.setValue(30)
+ options_layout.addWidget(self._timeout_edit, 3, 1)
options.setLayout(options_layout)
layout.addWidget(options, 2, 1)
@@ -188,7 +194,8 @@
logger.status_message("Running qmake...")
try:
- builder.run([qmake], "qmake failed.", in_build_dir=True)
+ builder.run([qmake], "qmake failed.", in_build_dir=True,
+ timeout=self._timeout_edit.value() * 1000)
except UserException as e:
logger.user_exception(e)
handle_user_exception(e, self.label, self)
@@ -203,7 +210,8 @@
try:
builder.run([make], "{0} failed.".format(make),
- in_build_dir=True)
+ in_build_dir=True,
+ timeout=self._timeout_edit.value() * 1000)
except UserException as e:
logger.user_exception(e)
handle_user_exception(e, self.label, self)
[Attachment #4 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic