Skip to content

Commit

Permalink
Merge pull request #255 from zllak/feature/python/install_data
Browse files Browse the repository at this point in the history
python: customize the --install-data option for setup.py
  • Loading branch information
jordansissel committed Sep 7, 2012
2 parents 649b47c + ad7f395 commit 0ea8c73
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/fpm/package/python.rb
Expand Up @@ -47,6 +47,8 @@ class FPM::Package::Python < FPM::Package
"Want to what your target platform is using? Run this: " \
"python -c 'from distutils.sysconfig import get_python_lib; " \
"print get_python_lib()'"
option "--install-data", "DATA_PATH", "The path to where data should be " \
"installed to."

private

Expand Down Expand Up @@ -188,13 +190,16 @@ def install_to_staging(setup_py)
@logger.info("Setting default :python_install_lib attribute",
:value => attributes[:python_install_lib])
end
if attributes[:python_install_data].nil?
attributes[:python_install_data] = attributes[:python_install_lib]
end
# Some setup.py's assume $PWD == current directory of setup.py, so let's
# chdir first.
::Dir.chdir(project_dir) do
safesystem(attributes[:python_bin], "setup.py", "install",
"--root", staging_path,
"--install-lib", File.join(prefix, attributes[:python_install_lib]),
"--install-data", File.join(prefix, attributes[:python_install_lib]),
"--install-data", File.join(prefix, attributes[:python_install_data]),
"--install-scripts", File.join(prefix, attributes[:python_install_bin]))
end
end # def install_to_staging
Expand Down

0 comments on commit 0ea8c73

Please sign in to comment.