Commit 789c9ed9 authored by Kirill Smelkov's avatar Kirill Smelkov

go/neo/t/neotest: Use python -c 'print ...' in a way that works on both py2 and py3

Without parenthesis it was failing on py3:

	(neo) (py3.venv) (g.env) kirr@deca:~/src/neo/src/lab.nexedi.com/kirr/neo/go/neo/t$ ./neotest info-local
	date:   Wed, 18 May 2022 11:05:50 +0300
	xnode:  kirr@deca.navytux.spb.ru (2401:5180:0:af::1 192.168.0.3 (+ 1·ipv4))
	uname:  Linux deca 5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17) x86_64 GNU/Linux
	cpu:    Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz
	  File "<string>", line 1
	    print '%.2fGHz' % (400000 / 1E6)
	          ^
	SyntaxError: invalid syntax
parent 30329f5a
#!/bin/bash -e
# neotest: run tests and benchmarks against FileStorage, ZEO and various NEO/py and NEO/go clusters
# Copyright (C) 2017-2020 Nexedi SA and Contributors.
# Copyright (C) 2017-2022 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
......@@ -562,7 +562,7 @@ proginfo() {
# fkghz file - extract value from file (in KHz) and render it as GHz
fkghz() {
python -c "print '%.2fGHz' % (`cat $1` / 1E6)"
python -c "print('%.2fGHz' % (`cat $1` / 1E6))"
}
# lspci1 <pcidev> <field> - show <field> from lspci information about <pcidev>
......@@ -855,7 +855,7 @@ system_info() {
s+=", txqlen=`cat $nic/tx_queue_len`"
if test -e $nic/gro_flush_timeout ; then
tgroflush_ns=`cat $nic/gro_flush_timeout`
s+=", gro_flush_timeout=`python -c "print '%.3f' % ($tgroflush_ns / 1E3)"`µs"
s+=", gro_flush_timeout=`python -c "print('%.3f' % ($tgroflush_ns / 1E3))"`µs"
else
s+=", !gro_flush_timeout"
fi
......@@ -874,7 +874,7 @@ system_info() {
printf "%-20s" "sw/python:"; proginfo python --version 2>&1 # https://bugs.python.org/issue18338
printf "%-20s" "sw/go:"; proginfo go version
printf "%-20s" "sw/sqlite:"; proginfo python -c \
'import sqlite3 as s; print "sqlite %s (py mod %s)" % (s.sqlite_version, s.version)'
'import sqlite3 as s; print("sqlite %s (py mod %s)" % (s.sqlite_version, s.version))'
printf "%-20s" "sw/mysqld:"; proginfo mysqld --version
pyver neoppod neo
......@@ -1019,7 +1019,7 @@ Benchmark$1-avg 1 \\3 \\4/op\
# hostof <url> - return hostname part of <url>
hostof() {
url=$1
python -c "import urlparse as p; u=p.urlparse(\"scheme://$url\"); print u.hostname"
python -c "import urlparse as p; u=p.urlparse(\"scheme://$url\"); print(u.hostname)"
}
# bench_net <url> - benchmark network
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment