From ec6ed68f6a5318d7cbddffd99f6d1ac0cc4773ea Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 18 Jul 2017 10:40:07 +0000 Subject: [PATCH] #1550 / #1568: python3: use strings, integer division, etc git-svn-id: https://xpra.org/svn/Xpra/trunk@16401 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/codecs/cuda_common/cuda_context.py | 4 ++-- src/xpra/codecs/nv_util.py | 5 +++-- src/xpra/codecs/nvenc/encoder.pyx | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/xpra/codecs/cuda_common/cuda_context.py b/src/xpra/codecs/cuda_common/cuda_context.py index 12275ce289..f6396aad71 100755 --- a/src/xpra/codecs/cuda_common/cuda_context.py +++ b/src/xpra/codecs/cuda_common/cuda_context.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # This file is part of Xpra. -# Copyright (C) 2013, 2014 Antoine Martin +# Copyright (C) 2013-2017 Antoine Martin # Xpra is released under the terms of the GNU GPL v2, or, at your option, any # later version. See the file COPYING for details. @@ -159,7 +159,7 @@ def init_all_devices(): log(" created context=%s", context) log(" api version=%s", context.get_api_version()) free, total = driver.mem_get_info() - log(" memory: free=%sMB, total=%sMB", int(free/1024/1024), int(total/1024/1024)) + log(" memory: free=%sMB, total=%sMB", int(free//1024//1024), int(total//1024//1024)) log(" multi-processors: %s, clock rate: %s", device.get_attribute(da.MULTIPROCESSOR_COUNT), device.get_attribute(da.CLOCK_RATE)) log(" max block sizes: (%s, %s, %s)", device.get_attribute(da.MAX_BLOCK_DIM_X), device.get_attribute(da.MAX_BLOCK_DIM_Y), device.get_attribute(da.MAX_BLOCK_DIM_Z)) log(" max grid sizes: (%s, %s, %s)", device.get_attribute(da.MAX_GRID_DIM_X), device.get_attribute(da.MAX_GRID_DIM_Y), device.get_attribute(da.MAX_GRID_DIM_Z)) diff --git a/src/xpra/codecs/nv_util.py b/src/xpra/codecs/nv_util.py index 097e133c95..1a9d0e6a4e 100644 --- a/src/xpra/codecs/nv_util.py +++ b/src/xpra/codecs/nv_util.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # This file is part of Xpra. -# Copyright (C) 2013, 2014 Antoine Martin +# Copyright (C) 2013-2017 Antoine Martin # Xpra is released under the terms of the GNU GPL v2, or, at your option, any # later version. See the file COPYING for details. @@ -9,6 +9,7 @@ from xpra.log import Logger log = Logger("encoder", "nvenc") from xpra.util import pver, print_nested_dict, engs, envbool +from xpra.os_util import bytestostr MAX_TESTED = 384 @@ -19,7 +20,7 @@ def get_nvml_driver_version(): try: nvmlInit() v = nvmlSystemGetDriverVersion() - log("nvmlSystemGetDriverVersion=%s", v) + log("nvmlSystemGetDriverVersion=%s", bytestostr(v)) return v.split(b".") except Exception as e: log("get_nvml_driver_version() pynvml error", exc_info=True) diff --git a/src/xpra/codecs/nvenc/encoder.pyx b/src/xpra/codecs/nvenc/encoder.pyx index a07423202d..24d224e543 100644 --- a/src/xpra/codecs/nvenc/encoder.pyx +++ b/src/xpra/codecs/nvenc/encoder.pyx @@ -1050,7 +1050,7 @@ cdef guidstr(GUID guid): parts.append(array.array('B', (guid.get("Data4")[2:8])).tostring()) s = b"-".join(binascii.hexlify(b).upper() for b in parts) #log.info("guidstr(%s)=%s", guid, s) - return s + return bytestostr(s) cdef GUID c_parseguid(src) except *: #just as ugly as above - shoot me now @@ -1094,7 +1094,7 @@ def parseguid(s): return c_parseguid(s) def test_parse(): - sample_guid = b"CE788D20-AAA9-4318-92BB-AC7E858C8D36" + sample_guid = u"CE788D20-AAA9-4318-92BB-AC7E858C8D36" x = c_parseguid(sample_guid) v = guidstr(x) assert v==sample_guid, "expected %s but got %s" % (sample_guid, v) @@ -2439,7 +2439,7 @@ cdef class Encoder: else: presets[preset_name] = guidstr(preset_GUID) if len(unknowns)>0: - log.warn("nvenc: found some unknown presets: %s", b", ".join(unknowns)) + log.warn("Warning: found some unknown NVENC presets: %s", b", ".join(unknowns)) finally: free(preset_GUIDs) if DEBUG_API: