Permalink
Browse files

- Add python-deb package converter.

  • Loading branch information...
1 parent d4e409b commit b6bfdce6c1e8bc109be3cf59a73d64b1e3154e22 @jordansissel committed Aug 26, 2010
Showing with 46 additions and 0 deletions.
  1. +46 −0 python2deb.sh
View
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+if [ "$1" = "-h" ] ; then
+ echo "Usage: $0 [package]"
+ echo "If no package is given, 'setup.py' is searched for in $PWD."
+ echo "If package given, we download with easy_install then build a package."
+ exit 0
+fi
+
+if [ "0$#" -ne 0 ] ; then
+ easy_install --editable --build-directory . "$@"
+ cd $1
+fi
+
+if [ ! -r "setup.py" ] ; then
+ echo "No setup.py found in current directory ($PWD)"
+ exit 1
+fi
+
+# I know, this is pretty crappy, but it's quicker than monkeypatching or
+# extending distutils.
+eval "$(python <<PYTHON)"
+import pipes
+
+def setup(**kwds):
+ for k in kwds:
+ print "%s=%s" % (k, pipes.quote(str(kwds[k])))
+ if "requires" in kwds:
+ print "requires=%s" % pipes.quote((", ".join(["python-%s" % x for x in kwds["requires"]])))
+
+$(
+ # Include the setup.py, minus distutils.
+ sed -re 's/(import .*)setup, */\1/; s/^.*import setup$//;' setup.py
+)
+PYTHON
+
+if [ -z "$name" -o -z "$version" ] ; then
+ echo "Unable to find name, version, etc..."
+ exit 1
+fi
+
+set -e
+dh_make -s -n -c blank -e $USER -p "python-${name}_${version}"
+sed -i -e "/Depends:.*$requires/! { s/^Depends: .*/&, $requires/ }" debian/control
+debuild -us -uc
+

0 comments on commit b6bfdce

Please sign in to comment.