Python 3 Migration
Helix QAC (v3.1.0/2021.3) replaced our internal version of Python 2 with Python 3. Any projects or CCTs created with earlier version of Helix QAC are unlikely to work without upgrading their CIP generation scripts. Typical output seen when using an invalid CIP script would look like:
$ qacli analyze -f -P .
Helix QAC has issued the following command:
C:\Users\Morpheus\AppData\Local\Perforce\Helix-QAC-2021.2\samples\sample_inspect_c-2021.2\prqa\configs\Initial\config\DATA\Helix_Generic_C\Script\Helix_Generic_C.py
but the command failed.
Exit Code: 1 (0x1)
C:\Users\Morpheus\AppData\Local\Perforce\Helix-QAC-2021.2\samples\sample_inspect_c-2021.2\src\inspect.c:qac:23:1:0
Progress(File-based Analysis): ................................... done
0 successes and 1 failure.
See log for more details: C:\Users\Morpheus\AppData\Local\Perforce\Helix-QAC-2021.3\app\logs\Helix-QAC_20211122T13281583_17040.log
Additionally, if you see the following in the logfile then this also indicates an old Python 2 script is being used:
13:39:38.237 30932 QAF.debug: PRQA::QAAPI::QAUtils::startProcess: === import dircache
13:39:38.237 30932 QAF.debug: PRQA::QAAPI::QAUtils::startProcess: === ModuleNotFoundError: No module named 'dircache'
Depending upon your requirements, you can either upgrade an existing project to be Python 3 compatible or you may upgrade an existing CCT to be Python 3 compatible. This CCT can then be used later when creating projects.
Project Upgrading
The easiest way to upgrade a project is to use the qacli project upgrade
command mentioned in the following section. This updates the component versions in the projects and upgrades the CIP generation scripts to Python 3.
CCT Upgrading
It's also possible to manually update a project or CCT by using the standalone Python script; update_to_py3.py
. This script, given a directory that the project or CCT resides in, will update all Python files in that directory and all sub-directories. It will additionally replace known changed files with their newer Python 3 versions, such as qaf.py
, cygpathHandler.py
, gnu_gcc.py
, msvc.py
, Helix_Generic_C++.py
and Helix_Generic_C.py
. It can be run using our internal version for Python, for example to convert the project in the current directory:
C:\Perforce\Helix-QAC-2021.3\components\python-3.9.6\python.exe C:\Perforce\Helix-QAC-2021.3\scripts\update_to_py3.py my_old_project
Replacing C:\Temp\my_old_project\prqa\configs\Initial\config\DATA\core_qaf\qaf.py
Replacing C:\Temp\my_old_project\prqa\configs\Initial\config\DATA\Helix_Generic_C\Script\Helix_Generic_C.py