Skip to content

Can't compile to Python when package.json description contains new lines #3394

Open
@Chriscbr

Description

@Chriscbr

🐛 Bug Report

Affected Languages

  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)
  • Go

General Information

  • JSII Version: unknown
  • Platform: unknown

What is the problem?

Transferred from projen/projen#1333

Description:
Using description from the Node project and inserting new lines fails python compile.

Steps to reproduce:
INFO: Based on https://github.com/mmuller88/cdk-prowler

  1. configure python compile e.g.
publishToPypi: {
    distName: 'cdk-prowler',
    module: 'cdk_prowler',
  },
...
  1. Use description which contains a new line like:
const project = new awscdk.AwsCdkConstructLibrary({
  author: 'Martin Mueller',
  authorAddress: '[email protected]',
  jsiiFqn: 'projen.AwsCdkConstructLibrary',
  cdkVersion,
  cdkVersionPinning: false,
  description: 'That is with \n newline' ,
...
  1. yarn compile

Expected: Successful compile
Actual Restult:

👾 build » package | jsii-pacmak
[jsii-pacmak] [WARN] Failed building python
[jsii-pacmak] [WARN] python failed
Error: Command (/tmp/npm-pack2I9AVe/.env-XHf0Lg/bin/python setup.py sdist --dist-dir /home/martin/git/cdk-prowler/dist/python) failed with status 1:
#STDERR> Traceback (most recent call last):
#STDERR>   File "setup.py", line 4, in <module>
#STDERR>     kwargs = json.loads(
#STDERR>   File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
#STDERR>     return _default_decoder.decode(s)
#STDERR>   File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
#STDERR>     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
#STDERR>   File "/usr/lib/python3.8/json/decoder.py", line 353, in raw_decode
#STDERR>     obj, end = self.scan_once(s, idx)
#STDERR> json.decoder.JSONDecodeError: Invalid control character at: line 5 column 34 (char 87)
#STDERR> 
#STDOUT> 
    at ChildProcess.<anonymous> (/home/martin/git/cdk-prowler/node_modules/jsii-pacmak/lib/util.js:119:27)
    at Object.onceWrapper (events.js:520:26)
    at ChildProcess.emit (events.js:400:28)
    at maybeClose (internal/child_process.js:1058:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)

Workaround: Remove new lines :D

Verbose Log

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.language/pythonRelated to Python bindingsmodule/compilerIssues affecting the JSII compilerp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions