
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# Explicit paths specified without -i nor -o; assuming --only paths...
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   setup.py
#
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	deleted:    INSTALL
#	modified:   debian/rules
#	modified:   pylib/debian_pylib.py
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	Makefile
diff --git a/setup.py b/setup.py
index bcd3469..0810f8f 100644
--- a/setup.py
+++ b/setup.py
@@ -1,70 +1,6 @@
 # Copyright (c) 2010 Liraz Siri <liraz@turnkeylinux.org> - all rights reserved
 
-import re
-import os.path
-import commands
-
-from distutils.core import setup
-
-class ExecError(Exception):
-    pass
-
-def _getoutput(command):
-    status, output = commands.getstatusoutput(command)
-    if status != 0:
-        raise ExecError()
-    return output
-
-def get_version():
-    if not os.path.exists("debian/changelog"):
-        return None
-
-    output = _getoutput("dpkg-parsechangelog")
-    version = [ line.split(" ")[1]
-                for line in output.split("\n")
-                if line.startswith("Version:") ][0]
-    return version
-
-def parse_control(control):
-    """parse control fields -> dict"""
-    d = {}
-    for line in control.split("\n"):
-        if not line or line[0] == " ":
-            continue
-        line = line.strip()
-        i = line.index(':')
-        key = line[:i]
-        val = line[i + 2:]
-        d[key] = val
-
-    return d
-
-def parse_email(email):
-    m = re.match(r'(.*)\s*<(.*)>', email.strip())
-    if m:
-        name, address = m.groups()
-    else:
-        name = ""
-        address = email
-
-    return name.strip(), address.strip()
-
-def main():
-    control_fields = parse_control(file("debian/control").read())
-    maintainer = control_fields['Maintainer']
-    maintainer_name, maintainer_email = parse_email(maintainer)
-
-    setup(packages = [''],
-          package_dir = {'': 'pylib'},
-
-          # non-essential meta-data
-          name=control_fields['Source'],
-          version=get_version(),
-          maintainer=maintainer_name,
-          maintainer_email=maintainer_email,
-          description=control_fields['Description'])
+from debian_pylib import setup
 
 if __name__=="__main__":
-    main()
-
-
+    setup()
