jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.09k stars 1.07k forks source link

784: unexpected token at '' (JSON::ParserError) packaging python package as deb #1965

Open robinbowes opened 1 year ago

robinbowes commented 1 year ago

In #1962, I found that I get an error when attempting to package a python package as a deb:

$ SETUPTOOLS_SCM_PRETEND_VERSION=0.1.0 fpm  -s python -t deb .
Traceback (most recent call last):
    12: from /Users/robin/.rbenv/versions/2.7.2/bin/fpm:23:in `<main>'
    11: from /Users/robin/.rbenv/versions/2.7.2/bin/fpm:23:in `load'
    10: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/bin/fpm:7:in `<top (required)>'
     9: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/clamp-1.0.1/lib/clamp/command.rb:133:in `run'
     8: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/command.rb:591:in `run'
     7: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/clamp-1.0.1/lib/clamp/command.rb:68:in `run'
     6: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/command.rb:367:in `execute'
     5: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/command.rb:367:in `each'
     4: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/command.rb:368:in `block in execute'
     3: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/package/python.rb:111:in `input'
     2: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/package/python.rb:255:in `load_package_info'
     1: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/json-2.3.1/lib/json/common.rb:263:in `parse'
/Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/json-2.3.1/lib/json/common.rb:263:in `parse': 784: unexpected token at '' (JSON::ParserError)

I'm struggling to figure out how to debug this.

I notice that this is trying to parse the output of setup.py get_metadata. When I try to run that command in the directory, it fails:

$ SETUPTOOLS_SCM_PRETEND_VERSION=0.1.0 python3 ./setup.py get_metadata

An error occurred while building the project, please ensure you have the most updated version of setuptools, setuptools_scm and wheel with:
   pip install -U setuptools setuptools_scm wheel

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'get_metadata'

If I try the same command with the package with which fpm -s python -t deb . works, I get the same thing.

Any idea where I should look next?

jordansissel commented 1 year ago

I ran into this today also — https://github.com/jordansissel/fpm/issues/1889#issuecomment-1328359959

I have a patch that fixes it in that thread. My intent is to include it in a release soon once I get more time to test.

On Sun, Nov 27, 2022, at 5:10 PM, Robin Bowes wrote:

In #1962 https://github.com/jordansissel/fpm/issues/1962, I found that I get an error when attempting to package a python package as a deb:

$ SETUPTOOLS_SCM_PRETEND_VERSION=0.1.0 fpm -s python -t deb . Traceback (most recent call last): 12: from /Users/robin/.rbenv/versions/2.7.2/bin/fpm:23:in

' 11: from /Users/robin/.rbenv/versions/2.7.2/bin/fpm:23:in load' 10: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/bin/fpm:7:in<top (required)>' 9: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/clamp-1.0.1/lib/clamp/command.rb:133:in run' 8: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/command.rb:591:inrun' 7: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/clamp-1.0.1/lib/clamp/command.rb:68:in run' 6: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/command.rb:367:inexecute' 5: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/command.rb:367:in each' 4: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/command.rb:368:inblock in execute' 3: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/package/python.rb:111:in input' 2: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/fpm-1.15.0/lib/fpm/package/python.rb:255:inload_package_info' 1: from /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/json-2.3.1/lib/json/common.rb:263:in parse' /Users/robin/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/json-2.3.1/lib/json/common.rb:263:inparse': 784: unexpected token at '' (JSON::ParserError) ` I'm struggling to figure out how to debug this.

I notice that this is trying to parse the output of setup.py get_metadata. When I try to run that command in the directory, it fails:

`$ SETUPTOOLS_SCM_PRETEND_VERSION=0.1.0 python3 ./setup.py get_metadata

An error occurred while building the project, please ensure you have the most updated version of setuptools, setuptools_scm and wheel with: pip install -U setuptools setuptools_scm wheel

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help

error: invalid command 'get_metadata' If I try the same command with the package with whichfpm -s python -t deb .` works, I get the same thing.

Any idea where I should look next?

— Reply to this email directly, view it on GitHub https://github.com/jordansissel/fpm/issues/1965, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAF2QGZKEWZAJCLM7WH2TWKQBBTANCNFSM6AAAAAASMZV4ZI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

jordansissel commented 1 year ago

I merged #1966 today which should fix this in the next release.

thinkwelltwd commented 1 year ago

I merged #1966 today which should fix this in the next release.

Just dropping my to say that I applied that patch manually and it fixed the problem for me.