From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web08.2022.1627070557609634135 for ; Fri, 23 Jul 2021 13:02:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NFK5Izhe; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: crobinso@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627070556; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9E3k8I+e/mEgrqgB7ImQHr+WPzvUWXRGqZjnB5nBc+g=; b=NFK5Izhe/Afsb7SCIjJknLW+CD2B8uHUjycXtmrSn4MRFg5ljH+FkR6MtMGMuMAHdRrzyw NCLGrGMT9ni8oNhttyhocTi2ESdyYflxDr3rbswFbjf6xGST/Tvzpp/jX2BxcGK3tTFxzc Ui2LlMswtXkXkxfT+HHt183lUmSaUhM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-240-SY8UmVpbMN6A0g-pUOeN9g-1; Fri, 23 Jul 2021 16:02:34 -0400 X-MC-Unique: SY8UmVpbMN6A0g-pUOeN9g-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFCEF801A92 for ; Fri, 23 Jul 2021 20:02:33 +0000 (UTC) Received: from worklaptop.redhat.com (unknown [10.22.18.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BAA9100238C; Fri, 23 Jul 2021 20:02:33 +0000 (UTC) From: "Cole" To: devel@edk2.groups.io Cc: Cole Robinson Subject: [PATCH 1/3] build: Fix python3.10 threading DeprecationWarnings Date: Fri, 23 Jul 2021 16:02:26 -0400 Message-Id: <13a83729943f5e9d75228ddac3ae1d5e94afa948.1627070203.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=crobinso@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="US-ASCII" threading camelCase functions have preferred alternatives since python2.6. python3.10 has started emitting DeprecationWarnings for them Signed-off-by: Cole Robinson --- BaseTools/Source/Python/build/build.py | 48 +++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index 3e4d83409f..02b4898924 100755 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -197,7 +197,7 @@ def ReadMessage(From, To, ExitFlag,MemTo=3DNone): To(LineStr)=0D else:=0D break=0D - if ExitFlag.isSet():=0D + if ExitFlag.is_set():=0D break=0D =20=0D class MakeSubProc(Popen):=0D @@ -241,8 +241,8 @@ def LaunchCommand(Command, WorkingDir,ModuleAuto =3D No= ne): EndOfProcedure.clear()=0D if Proc.stdout:=0D StdOutThread =3D Thread(target=3DReadMessage, args=3D(Proc.std= out, EdkLogger.info, EndOfProcedure,Proc.ProcOut))=0D - StdOutThread.setName("STDOUT-Redirector")=0D - StdOutThread.setDaemon(False)=0D + StdOutThread.name =3D "STDOUT-Redirector"=0D + StdOutThread.daemon =3D False=0D StdOutThread.start()=0D =20=0D =20=0D @@ -433,8 +433,8 @@ class BuildTask: @staticmethod=0D def StartScheduler(MaxThreadNumber, ExitFlag):=0D SchedulerThread =3D Thread(target=3DBuildTask.Scheduler, args=3D(M= axThreadNumber, ExitFlag))=0D - SchedulerThread.setName("Build-Task-Scheduler")=0D - SchedulerThread.setDaemon(False)=0D + SchedulerThread.name =3D "Build-Task-Scheduler"=0D + SchedulerThread.daemon =3D False=0D SchedulerThread.start()=0D # wait for the scheduler to be started, especially useful in Linux= =0D while not BuildTask.IsOnGoing():=0D @@ -456,7 +456,7 @@ class BuildTask: # indicated to do so, or there's error in running thread=0D #=0D while (len(BuildTask._PendingQueue) > 0 or len(BuildTask._Read= yQueue) > 0 \=0D - or not ExitFlag.isSet()) and not BuildTask._ErrorFlag.i= sSet():=0D + or not ExitFlag.is_set()) and not BuildTask._ErrorFlag.= is_set():=0D EdkLogger.debug(EdkLogger.DEBUG_8, "Pending Queue (%d), Re= ady Queue (%d)"=0D % (len(BuildTask._PendingQueue), len(Build= Task._ReadyQueue)))=0D =20=0D @@ -474,7 +474,7 @@ class BuildTask: BuildTask._PendingQueueLock.release()=0D =20=0D # launch build thread until the maximum number of threads = is reached=0D - while not BuildTask._ErrorFlag.isSet():=0D + while not BuildTask._ErrorFlag.is_set():=0D # empty ready queue, do nothing further=0D if len(BuildTask._ReadyQueue) =3D=3D 0:=0D break=0D @@ -498,12 +498,12 @@ class BuildTask: time.sleep(0.01)=0D =20=0D # wait for all running threads exit=0D - if BuildTask._ErrorFlag.isSet():=0D + if BuildTask._ErrorFlag.is_set():=0D EdkLogger.quiet("\nWaiting for all build threads exit...")= =0D - # while not BuildTask._ErrorFlag.isSet() and \=0D + # while not BuildTask._ErrorFlag.is_set() and \=0D while len(BuildTask._RunningQueue) > 0:=0D EdkLogger.verbose("Waiting for thread ending...(%d)" % len= (BuildTask._RunningQueue))=0D - EdkLogger.debug(EdkLogger.DEBUG_8, "Threads [%s]" % ", ".j= oin(Th.getName() for Th in threading.enumerate()))=0D + EdkLogger.debug(EdkLogger.DEBUG_8, "Threads [%s]" % ", ".j= oin(Th.name for Th in threading.enumerate()))=0D # avoid tense loop=0D time.sleep(0.1)=0D except BaseException as X:=0D @@ -531,7 +531,7 @@ class BuildTask: #=0D @staticmethod=0D def IsOnGoing():=0D - return not BuildTask._SchedulerStopped.isSet()=0D + return not BuildTask._SchedulerStopped.is_set()=0D =20=0D ## Abort the build=0D @staticmethod=0D @@ -547,7 +547,7 @@ class BuildTask: #=0D @staticmethod=0D def HasError():=0D - return BuildTask._ErrorFlag.isSet()=0D + return BuildTask._ErrorFlag.is_set()=0D =20=0D ## Get error message in running thread=0D #=0D @@ -644,7 +644,7 @@ class BuildTask: # TRICK: hide the output of threads left running, so that the = user can=0D # catch the error message easily=0D #=0D - if not BuildTask._ErrorFlag.isSet():=0D + if not BuildTask._ErrorFlag.is_set():=0D GlobalData.gBuildingModule =3D "%s [%s, %s, %s]" % (str(se= lf.BuildItem.BuildObject),=0D self.Bui= ldItem.BuildObject.Arch,=0D self.Bui= ldItem.BuildObject.ToolChain,=0D @@ -653,7 +653,7 @@ class BuildTask: EdkLogger.SetLevel(EdkLogger.ERROR)=0D BuildTask._ErrorFlag.set()=0D BuildTask._ErrorMessage =3D "%s broken\n %s [%s]" % \=0D - (threading.currentThread().getName()= , Command, WorkingDir)=0D + (threading.current_thread().name, Co= mmand, WorkingDir)=0D =20=0D # indicate there's a thread is available for another build task=0D BuildTask._RunningQueueLock.acquire()=0D @@ -667,8 +667,8 @@ class BuildTask: EdkLogger.quiet("Building ... %s" % repr(self.BuildItem))=0D Command =3D self.BuildItem.BuildCommand + [self.BuildItem.Target]= =0D self.BuildTread =3D Thread(target=3Dself._CommandThread, args=3D(C= ommand, self.BuildItem.WorkingDir))=0D - self.BuildTread.setName("build thread")=0D - self.BuildTread.setDaemon(False)=0D + self.BuildTread.name =3D "build thread"=0D + self.BuildTread.daemon =3D False=0D self.BuildTread.start()=0D =20=0D ## The class contains the information related to EFI image=0D @@ -1177,14 +1177,14 @@ class Build(): EndOfProcedure.clear()=0D if Process.stdout:=0D StdOutThread =3D Thread(target=3DReadMessage, args=3D(Proc= ess.stdout, EdkLogger.info, EndOfProcedure))=0D - StdOutThread.setName("STDOUT-Redirector")=0D - StdOutThread.setDaemon(False)=0D + StdOutThread.name =3D "STDOUT-Redirector"=0D + StdOutThread.daemon =3D False=0D StdOutThread.start()=0D =20=0D if Process.stderr:=0D StdErrThread =3D Thread(target=3DReadMessage, args=3D(Proc= ess.stderr, EdkLogger.quiet, EndOfProcedure))=0D - StdErrThread.setName("STDERR-Redirector")=0D - StdErrThread.setDaemon(False)=0D + StdErrThread.name =3D "STDERR-Redirector"=0D + StdErrThread.daemon =3D False=0D StdErrThread.start()=0D # waiting for program exit=0D Process.wait()=0D @@ -1217,14 +1217,14 @@ class Build(): EndOfProcedure.clear()=0D if Process.stdout:=0D StdOutThread =3D Thread(target=3DReadMessage, args=3D(Proc= ess.stdout, EdkLogger.info, EndOfProcedure))=0D - StdOutThread.setName("STDOUT-Redirector")=0D - StdOutThread.setDaemon(False)=0D + StdOutThread.name =3D "STDOUT-Redirector"=0D + StdOutThread.daemon =3D False=0D StdOutThread.start()=0D =20=0D if Process.stderr:=0D StdErrThread =3D Thread(target=3DReadMessage, args=3D(Proc= ess.stderr, EdkLogger.quiet, EndOfProcedure))=0D - StdErrThread.setName("STDERR-Redirector")=0D - StdErrThread.setDaemon(False)=0D + StdErrThread.name =3D "STDERR-Redirector"=0D + StdErrThread.daemon =3D False=0D StdErrThread.start()=0D # waiting for program exit=0D Process.wait()=0D --=20 2.31.1