Installing Python Behave On Ubuntu 14.04.1LTS

February 16, 2015 at 12:26 PM | categories: python, bdd, behave, packaging, ubuntu | View Comments

Brief notes on how I installed Behave - a behaviour driven development package on Ubuntu 14.04.1LTS.

First off, why? Well, the common answer for installing things would be "use pip" or "use virtualenv". I tend to prefer to use debian packages when installing things under Ubuntu - primarily because then I only have one packaging system to worry about. This works fine for lots of things since lots of things have sufficiently recent packages. In the case of something like Behave though, this doesn't have any package, so we need to build one for that, and its dependencies.

Partly as a note to self, and for anyone else who may be interested, this is how I did it. First of all we need the sources of behave and its dependencies:

hg clone https://bitbucket.org/stoneleaf/enum34
git clone git@github.com:r1chardj0n3s/parse
git clone git@github.com:jenisys/parse_type.git
git clone git@github.com:behave/behave

To package these up we need some other things too:

sudo apt-get install python-stdeb
sudo apt-get install devscripts

One of the dependencies is available as a package:

sudo apt-get install python-hamcrest

The just package up each dependency and install.

First of enum34:

cd enum34/
python setup.py sdist
cd dist/
py2dsc enum34-1.0.4.tar.gz
cd deb_dist/
cd enum34-1.0.4
debuild -uc -us
cd ..
sudo dpkg -i python-enum34_1.0.4-1_all.deb 
cd ../..
rm -rf dist
cd ..

Then parse:

cd parse
python setup.py sdist
cd dist/
py2dsc parse-1.6.5.tar.gz 
cd deb_dist/
cd parse-1.6.5
debuild -uc -us 
cd ..
sudo dpkg -i python-parse_1.6.5-1_all.deb 
cd ../..
rm -rf dist
cd ..

Then parse_type:

cd parse_type/
python setup.py sdist
cd dist/
py2dsc parse_type-0.3.5dev.tar.gz
cd deb_dist/
cd parse-type-0.3.5dev
debuild  -uc -us 
cd ..
sudo dpkg -i python-parse-type_0.3.5dev-1_all.deb 
cd ../..
rm -rf dist/
cd ..

And finally behave itself:

cd behave/
python setup.py sdist
cd dist/
py2dsc behave-1.2.6.dev0.tar.gz
cd deb_dist/
cd behave-1.2.6~dev0
debuild  -uc -us 
cd ..
sudo dpkg -i python-behave_1.2.6~dev0-1_all.deb
cd ../..
rm -rf dist/
cd ..
Read and Post Comments

Quick guide to packaging python libraries

February 09, 2015 at 06:22 PM | categories: python, packaging, ubuntu | View Comments

The short and simple guide to installing python packages for Ubuntu:

  • Install python-stdeb
  • Build an sdist version of your package, make sure it's all good
  • Run py2dsc on the library, debuild the resulting package
  • Install

That's probably a little terse, but gets over how simple this can be if you can ensure that your package's sdist builds cleanly.

Short example of steps involved:

sudo apt-get install python-stdeb

tar zxvf guild-0.1.0.tar.gz
cd guild-0.1.0/
python setup.py sdist
cd dist

py2dsc guild-0.1.0.tar.gz
cd deb_dist
cd guild-0.1.0
debuild -uc -us

cd ..
sudo dpkg -i python-guild_0.1.0-1_all.deb

(This has been languishing in my drafts folder for a while, so I've shortened to post)

Read and Post Comments