<p>I wrote a quick program in python to add a gtk GUI to a cli program. I was wondering how I can create an installer using distutils. Since it's just a GUI frontend for a command line app it only works in *nix anyway so I'm not worried about it being cross platform.</p>

<p>my main goal is to create a .deb package for debian/ubuntu users, but I don't understand make/configure files. I've primarily been a web developer up until now.</p>

<p><strong>edit</strong>: Does anyone know of a project that uses distutils so I could see it in action and, you know, actually try building it?</p>

<h2>Here are a few useful links</h2>

<ul>
<li><p><a href="https://wiki.ubuntu.com/PackagingGuide/Python" rel="nofollow noreferrer">Ubuntu Python Packaging Guide</a></p>

<p>This Guide is <strong><em>very</em></strong> helpful. I don't know how I missed it during my initial wave of gooling. It even walks you through packaging up an existing python application</p></li>
<li><p><a href="https://wiki.ubuntu.com/MOTU/GettingStarted" rel="nofollow noreferrer">The Ubuntu MOTU Project</a></p>

<p>This is the official package maintaining project at ubuntu. Anyone can join, and there are lots of tutorials and info about creating packages, of all types, which include the above 'python packaging guide'.</p></li>
<li><p><a href="http://episteme.arstechnica.com/eve/forums/a/tpc/f/96509133/m/808004952931" rel="nofollow noreferrer">"Python distutils to deb?" - Ars Technica Forum discussion</a></p>

<p>According to this conversation, you can't just use distutils. It doesn't follow the debian packaging format (or something like that). I guess that's why you need dh_make as seen in the Ubuntu Packaging guide</p></li>
<li><p><a href="http://osdir.com/ml/linux.debian.devel.python/2004-10/msg00013.html" rel="nofollow noreferrer">"A bdist_deb command for distutils</a></p>

<p>This one has some interesting discussion (it's also how I found the ubuntu guide) about concatenating a zip-file and a shell script to create some kind of universal executable (anything with python and bash that is). weird. Let me know if anyone finds more info on this practice because I've never heard of it.</p></li>
<li><p><A href="http://mail.python.org/pipermail/distutils-sig/2000-May/001000.html" rel="nofollow noreferrer">Description of the deb format and how distutils fit in - python mailing list</a></p></li>
</ul>

[{'answer_id': 29575, 'author': 'Sander', 'author_id': 2928, 'author_profile': 'https://Stackoverflow.com/users/2928', 'pm_score': 5, 'selected': True, 'text': '<p>See the <a href="http://docs.python.org/dist/simple-example.html" rel="noreferrer">distutils simple example</a>. That\'s basically what it is like, except real install scripts usually contain a bit more information. I have not seen any that are fundamentally more complicated, though. In essence, you just give it a list of what needs to be installed. Sometimes you need to give it some mapping dicts since the source and installed trees might not be the same.</p>\n\n<p>Here is a real-life (anonymized) example:</p>\n\n<pre><code>#!/usr/bin/python \n\nfrom distutils.core import setup \n\nsetup (name = \'Initech Package 3\', \n          description = "Services and libraries ABC, DEF", \n          author = "That Guy, Initech Ltd", \n          author_email = "that.guy@initech.com", \n          version = \'1.0.5\', \n          package_dir = {\'Package3\' : \'site-packages/Package3\'}, \n          packages = [\'Package3\', \'Package3.Queries\'], \n          data_files = [ \n                       (\'/etc/Package3\', [\'etc/Package3/ExternalResources.conf\']) \n          ])\n</code></pre>\n'}, {'answer_id': 29839, 'author': 'Andrew Wilkinson', 'author_id': 2990, 'author_profile': 'https://Stackoverflow.com/users/2990', 'pm_score': 2, 'selected': False, 'text': '<p>Most Python programs will use distutils. <a href="http://www.djangoproject.com" rel="nofollow noreferrer">Django</a> is a one - see <a href="http://code.djangoproject.com/svn/django/trunk/setup.py" rel="nofollow noreferrer">http://code.djangoproject.com/svn/django/trunk/setup.py</a></p>\n\n<p>You should also read <a href="http://docs.python.org/dist/dist.html" rel="nofollow noreferrer">the documentation</a>, as it\'s very comprehensive and has some good examples.</p>\n'}, {'answer_id': 31225, 'author': 'Jason Baker', 'author_id': 2147, 'author_profile': 'https://Stackoverflow.com/users/2147', 'pm_score': 1, 'selected': False, 'text': '<p>distutils really isn\'t all that difficult once you get the hang of it.  It\'s really just a matter of putting in some meta-information (program name, author, version, etc) and then selecting what files you want to include.  For example, here\'s a sample distutils setup.py module from a decently complex python library:</p>\n\n<p><a href="http://code.google.com/p/kamaelia/source/browse/trunk/Code/Python/Kamaelia/setup.py" rel="nofollow noreferrer">Kamaelia setup.py</a></p>\n\n<p>Note that this doesn\'t deal with any data files or or whatnot, so YMMV.</p>\n\n<p>On another note, I agree that the distutils documentation is probably some of python\'s worst documentation.  It is extremely inclusive in some areas, but neglects some really important information in others.</p>\n'}, {'answer_id': 4189217, 'author': 'Rusty Shackelford', 'author_id': 508652, 'author_profile': 'https://Stackoverflow.com/users/508652', 'pm_score': 2, 'selected': False, 'text': '<p>I found the following <a href="http://wiki.python.org/moin/Distutils/Tutorial" rel="nofollow">tutorial</a> to be very helpful. It\'s shorter than the distutils documentation and explains how to setup a typical project step by step. </p>\n'}, {'answer_id': 4716772, 'author': 'Stuart Cardall', 'author_id': 555451, 'author_profile': 'https://Stackoverflow.com/users/555451', 'pm_score': 3, 'selected': False, 'text': '<p><code>apt-get install python-stdeb</code></p>\n\n<p>Python to Debian source package conversion utility</p>\n\n<p>This package provides some tools to produce Debian packages from Python packages via a new distutils command, sdist_dsc. Automatic defaults are provided for the Debian package, but many aspects of the resulting package can be customized via a configuration file.</p>\n\n<ul>\n<li>pypi-install will query the Python Package Index (PyPI) for a\npackage, download it, create a .deb from it, and then install\nthe .deb.</li>\n<li>py2dsc will convert a distutils-built source tarball into a Debian\nsource package.</li>\n</ul>\n'}]
['https://Stackoverflow.com/questions/29562', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2908/']