diff options
author | Patrik Teivonen <patrik.teivonen@qt.io> | 2022-03-30 11:40:30 +0300 |
---|---|---|
committer | Patrik Teivonen <patrik.teivonen@qt.io> | 2022-04-08 08:25:31 +0000 |
commit | 1bed01376393f7f5fb8780ec82b91b886229a79b (patch) | |
tree | 1f5c1bf1f34178884a1c927c764bb4b18ac3a109 /packaging-tools/threadedwork.py | |
parent | 095ee09dabe1a9bf072848c687faed0d3fef0f7d (diff) |
Port build_wrapper.py to Python 3.6
Initial port for build_wrapper.py and related scripts
Change-Id: Icdf24193462e1a4746868782bd2ff95cd347b1ad
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'packaging-tools/threadedwork.py')
-rw-r--r-- | packaging-tools/threadedwork.py | 59 |
1 files changed, 18 insertions, 41 deletions
diff --git a/packaging-tools/threadedwork.py b/packaging-tools/threadedwork.py index bfba8c35f..6aeeed361 100644 --- a/packaging-tools/threadedwork.py +++ b/packaging-tools/threadedwork.py @@ -1,48 +1,33 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + ############################################################################# ## -## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -## Contact: http://www.qt-project.org/legal +## Copyright (C) 2022 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ ## ## This file is part of the release tools of the Qt Toolkit. ## -## $QT_BEGIN_LICENSE:LGPL$ +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ ## Commercial License Usage ## Licensees holding valid commercial Qt licenses may use this file in ## accordance with the commercial license agreement provided with the ## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and Digia. For licensing terms and -## conditions see http://qt.digia.com/licensing. For further information -## use the contact form at http://qt.digia.com/contact-us. -## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 2.1 as published by the Free Software -## Foundation and appearing in the file LICENSE.LGPL included in the -## packaging of this file. Please review the following information to -## ensure the GNU Lesser General Public License version 2.1 requirements -## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## In addition, as a special exception, Digia gives you certain additional -## rights. These rights are described in the Digia Qt LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. ## ## GNU General Public License Usage ## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3.0 as published by the Free Software -## Foundation and appearing in the file LICENSE.GPL included in the -## packaging of this file. Please review the following information to -## ensure the GNU General Public License version 3.0 requirements will be -## met: http://www.gnu.org/copyleft/gpl.html. -## +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. ## ## $QT_END_LICENSE$ ## ############################################################################# - -# import the print function which is used in python 3.x -from __future__ import print_function - import itertools # to get the cpu number import multiprocessing @@ -51,16 +36,8 @@ import threading import traceback import time import sys - -try: - import queue #python2 -except ImportError: - import Queue as queue #python3 - -try: - import __builtin__ #python2 -except ImportError: - import builtins as __builtin__#python3 +import queue +import builtins as __builtin__ # we are using RLock, because threadedPrint is using the same lock outputLock = threading.RLock() @@ -109,7 +86,7 @@ class StdErrHook: # builtin print() isn't threadsafe, lets make it threadsafe def threadedPrint(*a, **b): with outputLock: - org_print(*a, **b) + __builtin__.org_print(*a, **b) # this is really a HACK or better only useful in this complicate situation __builtin__.org_print = __builtin__.print @@ -219,7 +196,7 @@ class ThreadedWork(): # block until everything is done for consumer in listOfConsumers: - while consumer.isAlive(): + while consumer.is_alive(): try: #wait 1 second, then go back and ask if thread is still alive time.sleep(1) |