From patchwork Thu Aug 23 09:54:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mayeul Cantan X-Patchwork-Id: 10103 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp1911385jap; Thu, 23 Aug 2018 03:02:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbvyAFOnglT3/7jSho/oaZeRHwGsoW4NJpeaoxFebCmyclUk2GYQuYrGY6lsPod4XZuB7g4 X-Received: by 2002:a1c:a78c:: with SMTP id q134-v6mr4554041wme.42.1535018522591; Thu, 23 Aug 2018 03:02:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535018522; cv=none; d=google.com; s=arc-20160816; b=lrduHA/hbkvh+Yqf3+Lk5FNT89wswENY/XH52TePsjLDl//KnUSIT8Ni/TnUtSTUAq c84wsbwzAuzbWa2MIH768YL6llnwMJcot8NwtPPsNYZbFvF0RojIyQdpZyPmvELeQbTf MlGIr5TQ8m5/5/l1COGEJTc4UhhgrfJT3vSygfDTlYkpRjk4NV2Jk7seG4xIu252JpF+ 8MRu4VJiREzPQ55wuTS0BYp4ucfddd10p+elW9gA2avMLJDhK7cTbpxOyPSmZo2hhWIU M/2kQDoGpqieXiOxgHLU0ZXqPa0UvIYAdaIDiLJT5ox91HnMl1PrmjsqtdufBYgyt/rN X9mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:message-id:date:from:mime-version :dkim-signature:delivered-to:arc-authentication-results; bh=CGhaH4q2yyZwzJcZgoQ92ZSH7RZvy1llBY/gCQQJJ6Y=; b=qU3CQz7geRndayZ9nyQMQaxf0LqXgLQ44T0QeTN9bK/+K8x8broYJ3diM0lUWgLB8j sI+3C5dD5ei8KvDDtgjU8tWMGt0h86s36bmMzmidfeozbLsBgjzymZlqdVzNn5vZ/rLi 2Ev74F4sYuRLShzTuIptkU2lGI4L7gMq1uG87uVZE9kOV2mNldFGP0jHj/vbN93vd1+T ly1s54tyA7ZYvoHGdZQYCCtsMAHDfbG4CClYRDTX5Ne8DAzohr05hdFiF3XekT8U11mE 8XKNxU4LFgCwqkzO5x0OHd0+8Ol/DaWWyI2toUEUiyku+z+5OsFg8KtdkzvWJA2zzL5H Ms7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=DJGvYK3o; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q13-v6si2005454wmf.72.2018.08.23.03.02.01; Thu, 23 Aug 2018 03:02:02 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=DJGvYK3o; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 066BB689B10; Thu, 23 Aug 2018 13:01:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt0-f174.google.com (mail-qt0-f174.google.com [209.85.216.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B10AD680AF5 for ; Thu, 23 Aug 2018 13:01:51 +0300 (EEST) Received: by mail-qt0-f174.google.com with SMTP id n6-v6so5522468qtl.4 for ; Thu, 23 Aug 2018 03:01:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=l438hEP3KFoE+uIOY/LdVp3n0YdsDATvz4GQCJ3/nIQ=; b=DJGvYK3o8oXZIAxunZ1Ztc0s56LfRaC+2CDFf+Q3B435Zu5B869QrJm3J8G1UnjBLM P3XmZCnV6qcgmZb/+K5dJPn4BpoKkWZ8CnK+aFGLXdm8rrNEXYW/1D690wy/LeZ4oYkC Mq4kQeBgyNFv61LWpaooEhjNSVmKiUhEqg5yRnmIgHU7sJ66me0qu7P748bTEApjRo9w u+JeuK1KbQqas535e8xS9l27aiJPCAJLg/CkAwq3wdm+s5g42aTXe99fsOBzypBC/8Dr JbyEE4eo6im8BgxoA1S9DCSgo+WHakehHNQG2cMpsZcIvGF32X5X+oWeRXd+jIAk98jb RcRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=l438hEP3KFoE+uIOY/LdVp3n0YdsDATvz4GQCJ3/nIQ=; b=PLKLUTAwYkmWSLRf+oR3Ta/3t0Ap606ZlcUEpObqNEleWout6df+V72gosEWbaM/iu 0CU1dzadCO4EUthu4WXdTDGnZVB4Sm+/xHJcHgW1GXEBPNTJyPGWPnUwiCUZ8EpMk9pk jGMH0DS94HKQCYjqjK8YM0oWLuiuQLIKQu6yrxhUmT5cANH6YcmeNyXmoOTTiWeeVffj 7VFAgN/FzXP412ROHzHhTvYBqJaEikzs0S6Z+U5Q0/k8lfZrH8aSeb0xrnfC3XLICq+9 jaKEPTX6MgmU+OoFF7wqXz9sTgqEIAHAoo1Mmmnb3pBBMILY2BmtgRM4O6dKzmbpPo2H DQgw== X-Gm-Message-State: AOUpUlHOXDx7HT1+SfjWz1f84WvX8Ue6Ibcif2M/GNpz7oOeOc/v+iZX Xor3f3f3MRfUzIXScUqu2SXycIaCXhoFn8CMkxwEcSRc X-Received: by 2002:a0c:e9ce:: with SMTP id q14-v6mr56131782qvo.106.1535018105581; Thu, 23 Aug 2018 02:55:05 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac8:6656:0:0:0:0:0 with HTTP; Thu, 23 Aug 2018 02:54:25 -0700 (PDT) From: Mayeul Cantan Date: Thu, 23 Aug 2018 11:54:25 +0200 Message-ID: To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] Tools: drop hard dependency on python2 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Mayeul Cantan Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Some tools had an artificial dependency on python2: zmqshell.py and normalize.py This patch changes the requested environment to a generic "python", and add parenthesis to the "print" calls. 2to3 shows no other modifications are needed, so I expect this to be okay. Please note that this was untested. --- tools/normalize.py | 13 +++++++------ tools/zmqshell.py | 7 ++++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/normalize.py b/tools/normalize.py index 7d87c5e154..a550d06906 100755 --- a/tools/normalize.py +++ b/tools/normalize.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python +# This script is compatible both with python 2 and 3; please keep it so import sys, subprocess @@ -7,7 +8,7 @@ if len(sys.argv) > 2: encopt = sys.argv[2:-1] ofile = sys.argv[-1] else: - print 'usage: %s [encode_options] ' % sys.argv[0] + print('usage: %s [encode_options] ' % sys.argv[0]) sys.exit(1) analysis_cmd = 'ffprobe -v error -of compact=p=0:nk=1 ' @@ -15,7 +16,7 @@ analysis_cmd += '-show_entries frame_tags=lavfi.r128.I -f lavfi ' analysis_cmd += "amovie='%s',ebur128=metadata=1" % ifile try: probe_out = subprocess.check_output(analysis_cmd, shell=True) -except subprocess.CalledProcessError, e: +except subprocess.CalledProcessError as e: sys.exit(e.returncode) loudness = ref = -23 for line in probe_out.splitlines(): @@ -24,10 +25,10 @@ for line in probe_out.splitlines(): loudness = sline adjust = ref - float(loudness) if abs(adjust) < 0.0001: - print 'No normalization needed for ' + ifile + print('No normalization needed for ' + ifile) else: - print "Adjust %s by %.1fdB" % (ifile, adjust) + print("Adjust %s by %.1fdB" % (ifile, adjust)) norm_cmd = ['ffmpeg', '-i', ifile, '-af', 'volume=%fdB' % adjust] norm_cmd += encopt + [ofile] - print ' => %s' % ' '.join(norm_cmd) + print(' => %s' % ' '.join(norm_cmd)) subprocess.call(norm_cmd) diff --git a/tools/zmqshell.py b/tools/zmqshell.py index a7d1126006..ff229b29c9 100755 --- a/tools/zmqshell.py +++ b/tools/zmqshell.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python +# This script is compatible both with python 2 and 3; please keep it so import sys, zmq, cmd @@ -14,10 +15,10 @@ class LavfiCmd(cmd.Cmd): def onecmd(self, cmd): if cmd == 'EOF': sys.exit(0) - print 'Sending command:[%s]' % cmd + print('Sending command:[%s]' % cmd) self.requester.send(cmd) message = self.requester.recv() - print 'Received reply:[%s]' % message + print('Received reply:[%s]' % message) try: bind_address = sys.argv[1] if len(sys.argv) > 1 else "tcp://localhost:5555"