Skip to content

Commit

Permalink
#1550 / #1568: python3: use strings, integer division, etc
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@16401 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 18, 2017
1 parent 9506c91 commit ec6ed68
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/xpra/codecs/cuda_common/cuda_context.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# This file is part of Xpra.
# Copyright (C) 2013, 2014 Antoine Martin <[email protected]>
# Copyright (C) 2013-2017 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

Expand Down Expand Up @@ -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))
Expand Down
5 changes: 3 additions & 2 deletions src/xpra/codecs/nv_util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# This file is part of Xpra.
# Copyright (C) 2013, 2014 Antoine Martin <[email protected]>
# Copyright (C) 2013-2017 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

Expand All @@ -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
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/xpra/codecs/nvenc/encoder.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit ec6ed68

Please sign in to comment.