build_cffi_imports: fix determining CFLAGS

Merged Dan Villiom Podlaski Christiansen requested to merge branch/py3.8-fix-cflags into branch/py3.8

The previous logic implicitly assumed that CFLAGS was either unset or started with a space, breaking the MacPorts build. In addition, it also extracted the version info from the running interpreter rather than the built one.

I ran into this when trying to package the release candidate of 3.8 for MacPorts, which sets CFLAGS during the build.

Merge request reports