Details
-
Bug
-
Resolution: Done
-
P4: Low
-
None
-
6.2.3
-
None
-
Python 3.7, Visual Studio 2019, Qt 6.2.3
-
-
96b84fe6c7 (pyside/pyside-setup/6.2) d8791e4f5a (pyside/pyside-setup/dev) 96b84fe6c7 (pyside/tqtc-pyside-setup/6.2) d8791e4f5a (pyside/tqtc-pyside-setup/dev)
Description
While trying to build PySide6 from source under Visual Studio 2019 a colleague and I came across a potential bug in the build system. In the pyside-setup repository (checked out tag 6.2.3) in the file pyside-setup\sources\shiboken6\cmake\ShibokenHelpers.cmake
There is a small python snippet executed to extract the extension from sysconfig.get_config_var('EXT_SUFFIX').
In the current code this is done via rfind('.').
On our system the variable was however set to the value '.cp39-win_amd64.pyd', which fails the following test if pos > 0, as the first character in the string is a '.'.
The current code reports Unable to determine PYTHON_EXTENSION_SUFFIX from EXT_SUFFIX: ""
This can be remedied by using this regex that my colleague wrote for example:
import re
import sysconfig
suffix = sysconfig.get_config_var('EXT_SUFFIX')
res = re.search(r'^(.*)
.(.+)', suffix)
if res:
suffix = res.group(2)
else:
suffix = ''
print(f'Unable to determine PYTHON_EXTENSION_SUFFIX from EXT_SUFFIX: \"{suffix}\"', file=sys.stderr)
print(suffix)
Which prints
.cp39-win_amd64.pyd