Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fpm method fails while generating package for python if downloaded package in zip format #2072

Open
hbani opened this issue Oct 10, 2024 · 1 comment

Comments

@hbani
Copy link

hbani commented Oct 10, 2024

Here’s a GitHub issue description for the problem you're encountering with fpm:


Title: fpm Fails to Generate Package for Python When Package is Downloaded in .zip Format

Description:

I'm experiencing an issue when using fpm to create a package for a Python project. Specifically, the failure occurs when pip download fetches the package in .zip format rather than .tar.gz. The fpm process fails with an unexpected directory layout error, as shown below:

/usr/local/rvm/gems/ruby-2.7.1/gems/fpm-1.15.1/lib/fpm/package/python.rb:177:in `download_if_necessary': Unexpected directory layout after `pip download ...`. This might be an fpm bug? The directory is /tmp/package-python-build-xxxxxxxx (RuntimeError)

Steps to Reproduce:

  1. Run fpm to create a package for a Python module, which pip downloads in .zip format:

    fpm -s python -t deb <package_name>
  2. If pip downloads the package as a .zip archive, the process fails with a directory layout error.

Expected Behavior:

fpm should handle Python packages regardless of whether they are downloaded as .zip or .tar.gz and correctly generate the package.

Actual Behavior:

The process fails with the following error:

Unexpected directory layout after `pip download ...`

Workaround:

Manually extracting the .zip file and converting it to .tar.gz allows the process to succeed. However, this adds an unnecessary manual step to the packaging process.

Environment:

  • fpm version: 1.15.1
  • Ruby version: 2.7.1
  • Python version: (whichever is relevant)
  • OS: (provide your OS and version)

Additional Context:

This issue seems to arise specifically with .zip formatted packages. fpm works fine when the package is downloaded in .tar.gz format.


This description should help developers understand and reproduce the issue while providing sufficient context for further investigation.

@hussainbani
Copy link

PR to fix this issue
#2074

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants