cmake failure when default 'python' is aliased to python3
Closed, ResolvedPublic

Description

When:
On Linux distros where there are two versions of python installed (2 and 3), and where 'python' command is aliased to ptyhon3.

What
during cmake configuration tools/sdc.py script crashes with "SyntaxError: invalid syntax" on lines with "print" command.

Why
in python3 "print" is a function and should be called with parentheses:

  • python2
print "some value: %s" % myValue
  • python3
print ( "some value %s" % myValue)

Solutions

  1. call tools/sdc.py directly and change default "python" to "python2" in tools/sdc.py
  2. change in KDbCreateShareDataClasse.cmake to use python2 instead of python in KDB_CREATE_SHARED_DATA_CLASSES macro.
wicik created this task.Jan 12 2016, 1:22 PM
wicik updated the task description. (Show Details)
wicik raised the priority of this task from to Needs Triage.
wicik added a project: KDb.
wicik added subscribers: wicik, staniek.

Thanks for this test, Radek. sdc.py from KReport moved to python3, with the print() function upgraded. We have "from future import print_function" there so works no matter what version the python command has.

We just need to cherry-pick commits to KDb, where sdc.py is outdated. Let me check it later...

And yes, sdc.py is copied as we have no energy to keep it in a separate repo. Maybe one day. Now it's still internal.

staniek renamed this task from cmake failure on linux when default 'python' is aliased to python3 to cmake failure when default 'python' is aliased to python3.Jan 12 2016, 1:32 PM
staniek triaged this task as High priority.
staniek claimed this task.
staniek awarded a token.
wicik added a comment.Jan 12 2016, 6:23 PM

I've tested your solution, copy sdc.py from KReport, then there's another error.
Assign this bug to me, I'll try to resolve it.

wicik removed a subscriber: wicik.Jan 12 2016, 6:28 PM
wicik added a subscriber: wicik.
staniek reassigned this task from staniek to wicik.Jan 12 2016, 7:03 PM