Skip to content

Instantly share code, notes, and snippets.

@pcn
Created June 10, 2015 03:50
Show Gist options
  • Select an option

  • Save pcn/c44914bdadc8c0f9e946 to your computer and use it in GitHub Desktop.

Select an option

Save pcn/c44914bdadc8c0f9e946 to your computer and use it in GitHub Desktop.
Building a python+pyenv apt package with fpm on a bare-ish ubuntu image

Vagrant up an official cloud 14.04. Vagrant ssh in, then

sudo apt-get -y install git gcc libz-dev libreadline-dev libbz2-dev libsqlite3-dev libssl-dev ruby-dev
git clone https://github.com/yyuu/pyenv-installer
cd pyenv-installer; bin/pyenv-installer

Add this to the user's .bash_profile:

# Load pyenv automatically by adding
# the following to ~/.bash_profile:

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Logout/login to get a new shell, etc.

Now continue to build a python in the pyenv:

. .bashrc
pyenv install 2.7.10
pyenv virtualenv 2.7.10 some-project
pyenv global some-project

Now for the fpm part:

sudo gem install fpm
fpm -v 0.0.1 -n some-project_pyenv -s dir -t deb $PWD/.bash_profile $PWD/.pyenv

Add in some depdencies, and this seems to create reproducable builds of python and modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment