Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ install with "sudo apt-get install tclx"])
fi

AC_MSG_CHECKING([for python pango and cairo modules])
if $PYTHON -c 'import pango,cairo'; then
if $PYTHON -c 'from gi.repository import cairo, Pango, PangoCairo'; then
AC_MSG_RESULT([found])
else
AC_MSG_RESULT(no)
Expand Down Expand Up @@ -1562,20 +1562,20 @@ if test "$PYTHON" = "none"; then
fi

AC_MSG_CHECKING([python version])
if ! $PYTHON -c 'import sys;raise SystemExit,sys.hexversion<0x2070000'
if ! $PYTHON -c 'import sys;raise SystemExit(sys.hexversion<0x2070000)'
then
AC_MSG_ERROR(Python version too old (2.7 or newer required))
fi
AC_MSG_RESULT(OK)

AC_MSG_CHECKING([version of python libraries])
LIBPYTHON=`$PYTHON -c 'import distutils.sysconfig; print "python" + distutils.sysconfig.get_config_vars().get("VERSION")'`
LIBPYTHON=`$PYTHON -c 'import distutils.sysconfig; print("python" + (distutils.sysconfig.get_config_vars().get("LDVERSION") or distutils.sysconfig.get_config_vars().get("VERSION")))'`
AC_MSG_RESULT($LIBPYTHON)

AC_MSG_CHECKING([match between tk and Tkinter versions])

PYTHON_TK_VERSION="`$PYTHON -c 'import _tkinter; print _tkinter.TK_VERSION'`"
PYTHON_TCL_VERSION="`$PYTHON -c 'import _tkinter; print _tkinter.TCL_VERSION'`"
PYTHON_TK_VERSION="`$PYTHON -c 'import _tkinter; print (_tkinter.TK_VERSION)'`"
PYTHON_TCL_VERSION="`$PYTHON -c 'import _tkinter; print (_tkinter.TCL_VERSION)'`"

if test "$PYTHON_TCL_VERSION" != "$TCL_VERSION"; then
AC_MSG_RESULT([TCL mismatch: $TCL_VERSION vs $PYTHON_TCL_VERSION])
Expand All @@ -1589,7 +1589,7 @@ fi
AC_MSG_RESULT([$PYTHON_TK_VERSION])

AC_MSG_CHECKING(location of Python header files)
INCLUDEPY=`$PYTHON -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_vars().get("INCLUDEPY")'`
INCLUDEPY=`$PYTHON -c 'import distutils.sysconfig; print (distutils.sysconfig.get_config_vars().get("INCLUDEPY"))'`
AC_MSG_RESULT($INCLUDEPY)

AC_MSG_CHECKING([for Python headers])
Expand Down Expand Up @@ -1619,7 +1619,7 @@ AC_CHECK_HEADER($INCLUDEPY/Python.h,[],
[AC_MSG_ERROR([Required header Python.h missing. Install it, or specify --disable-python to skip the parts of LinuxCNC that depend on Python])])

AC_MSG_CHECKING(for site-package location)
SITEPY=`$PYTHON -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()'`
SITEPY=`$PYTHON -c 'import distutils.sysconfig; print (distutils.sysconfig.get_python_lib())'`
AC_MSG_RESULT($SITEPY)

AC_CHECK_HEADERS(GL/gl.h GL/glu.h,[],[AC_MSG_ERROR([Required OpenGL header missing. Install it, or specify --disable-python to skip the parts of LinuxCNC that depend on Python])])
Expand Down
24 changes: 12 additions & 12 deletions src/hal/utils/elbpcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ def transact(sdata, quiet=False, response=True):
if not response: return
try:
data, daddr = s.recvfrom(1280)
if not quiet: print "<", data.encode("hex")
if not quiet: print " ", re.sub('[^ -~]', '.', data)
if not quiet: print ("<", data.encode("hex"))
if not quiet: print (" ", re.sub('[^ -~]', '.', data))
return data
except socket.timeout:
if not quiet: print "! no response"
if not quiet: print ("! no response")
return None

def interact():
Expand Down Expand Up @@ -96,35 +96,35 @@ def optimal_size(space, info, address, nbytes):
if info: return 2
info = transact(make_read_request(space, True, 2, True, 2, 4).encode("hex"), quiet=True)
if info is None:
raise RuntimeError, "Failed to get information about memory space %d" % space
raise RuntimeError("Failed to get information about memory space %d" % space)
memsizes, memranges = struct.unpack("<HH", info)
maxaddr = 1 << (memranges & 0x3f)
#print "# Note: space %d has maxaddr %d (memsizes=0x%x memranges=0x%x)" % (space, maxaddr, memsizes, memranges)
# This gets the wrong limit with my firmware on space 6, so disabling it
#if address + nbytes >= maxaddr: raise ValueError, "Address out of range (address=%d nbytes=%d maxaddr=%d)" % (address, nbytes, maxaddr)
#if address + nbytes >= maxaddr: raise ValueError("Address out of range (address=%d nbytes=%d maxaddr=%d)" % (address, nbytes, maxaddr))
for i in (3,2,1,0):
b = (1<<i)
if address % b or nbytes % b or not memsizes & b: continue
return b
raise ValueError, "Access size incompatible with address or length (address=%d nbytes=%d memsizes=%d)" % (address, nbytes, memsizes)
raise ValueError("Access size incompatible with address or length (address=%d nbytes=%d memsizes=%d)" % (address, nbytes, memsizes))

if options.read:
if options.space is None: raise SystemExit, "--read must specifiy --space"
if options.address is None: raise SystemExit, "--read must specifiy --address"
if options.space is None: raise SystemExit("--read must specifiy --space")
if options.address is None: raise SystemExit("--read must specifiy --address")
size = optimal_size(options.space, options.info, options.address, options.read if options.increment else 0)
command = make_read_request(options.space, options.info, size, options.increment, options.address, options.read)
command = command.encode("hex")
print ">", command
print (">", command)
transact(command)

elif options.write:
if options.space is None: raise SystemExit, "--write must specifiy --space"
if options.address is None: raise SystemExit, "--write must specifiy --address"
if options.space is None: raise SystemExit("--write must specifiy --space")
if options.address is None: raise SystemExit("--write must specifiy --address")
write = options.write.decode("hex")
size = optimal_size(options.space, options.info, options.address, len(write) if options.increment else 0)
command = make_write_request(options.space, options.info, size, options.increment, options.address, write)
command = command.encode("hex")
print ">", command
print (">", command)
transact(command, response=False)

elif args:
Expand Down
Loading