Improve readability of the toml string

This commit is contained in:
Robin Dunn
2022-08-05 19:47:26 -07:00
parent 8fa9b6507c
commit 70719f64f5

View File

@@ -27,6 +27,7 @@ import tarfile
import tempfile
import datetime
import shlex
import textwrap
try:
import pathlib
@@ -1283,36 +1284,38 @@ def cmd_sip(options, args):
pycode = 'pycode'+base+':'+pycode
# Write out a pyproject.toml to configure sip
pyproject_toml = (
'[build-system]\n'
'requires = ["sip >=5.5.0, <7"]\n'
'build-backend = "sipbuild.api"\n'
'\n'
'[tool.sip.metadata]\n'
'name = "{base}"\n'
'\n'
'[tool.sip.bindings.{base}]\n'
'docstrings = true\n'
'release-gil = true\n'
'exceptions = false\n'
'tracing = {tracing}\n'
'protected-is-public = false\n'
'generate-extracts = [\'{extracts}\']\n'
'pep484-pyi = false\n'
'\n'
'[tool.sip.project]\n'
'abi-version = "{abi_version}"\n'
'sip-files-dir = \'{sip_gen_dir}\'\n'
'sip-include-dirs = [\'{src_dir}\']\n'
'sip-module = "wx.siplib"\n'
).format(
base=base,
abi_version=cfg.SIP_ABI,
tracing=str(cfg.SIP_TRACE).lower(),
extracts=pycode,
src_dir=opj(phoenixDir(), 'src'),
sip_gen_dir=opj(phoenixDir(), 'sip', 'gen'),
pyproject_toml = textwrap.dedent("""\
[build-system]
requires = ["sip >=5.5.0, <7"]
build-backend = "sipbuild.api"
[tool.sip.metadata]
name = "{base}"
[tool.sip.bindings.{base}]
docstrings = true
release-gil = true
exceptions = false
tracing = {tracing}
protected-is-public = false
generate-extracts = [\'{extracts}\']
pep484-pyi = false
[tool.sip.project]
abi-version = "{abi_version}"
sip-files-dir = '{sip_gen_dir}'
sip-include-dirs = ['{src_dir}']
sip-module = "wx.siplib"
""".format(
base=base,
abi_version=cfg.SIP_ABI,
tracing=str(cfg.SIP_TRACE).lower(),
extracts=pycode,
src_dir=opj(phoenixDir(), 'src'),
sip_gen_dir=opj(phoenixDir(), 'sip', 'gen'),
)
)
with open(opj(tmpdir, 'pyproject.toml'), 'w') as f:
f.write(pyproject_toml)