1
0
mirror of https://github.com/jordansissel/fpm synced 2025-04-29 14:58:00 +02:00

Merge 839d5424f62dd4d5dbf106461080ef9490dd3633 into d81a1ad1ac7b47662bcb54e7446f2affb5b3170c

This commit is contained in:
Corey Hickey 2024-10-08 17:14:11 -04:00 committed by GitHub
commit e5fd2893d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -171,13 +171,20 @@ class FPM::Package::Python < FPM::Package
# behind a directory with the Python package extracted and ready to be used.
# For example, `pip download ... Django` puts `Django-4.0.4.tar.tz` into the build_path directory.
# If we expect `pip` to leave an unknown-named file in the `build_path` directory, let's check for
# a single file and unpack it. I don't know if it will /always/ be a .tar.gz though.
files = ::Dir.glob(File.join(build_path, "*.tar.gz"))
if files.length != 1
# a single file and unpack it. Iterate over recognized file formats.
::Dir.chdir(build_path) do
files = ::Dir.glob(["*.tar.gz", "*.tgz"])
if files.length == 1
safesystem("tar", "-zxf", files[0], "-C", target)
break
end
files = ::Dir.glob("*.zip")
if files.length == 1
safesystem("unzip", files[0], "-d", target)
break
end
raise "Unexpected directory layout after `pip download ...`. This might be an fpm bug? The directory is #{build_path}"
end
safesystem("tar", "-zxf", files[0], "-C", target)
else
# no pip, use easy_install
logger.debug("no pip, defaulting to easy_install", :easy_install => attributes[:python_easyinstall])