Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 14th, 2004, 02:42 AM
evilmrhenry evilmrhenry is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 28 evilmrhenry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Understanding Distutils

I'm trying to understand Distutils, but even after reading the documentation, searching the Internet, and playing around with it, I still don't understand how to use it. I think that if I could get an example setup for distutils, I could take it from there.

The following shows about what my setup looks like (simplified):
code
code/code_file1.py
code/code_file2.py
data
data/datafile2.txt
data/datafile2.txt

In addition, I'm calling the Python Imaging Library, (http://www.pythonware.com/products/pil/index.htm) so a way to bring that along would be useful. I call it with "import ImageTk"

Reply With Quote
  #2  
Old June 14th, 2004, 09:14 PM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 12
Send a message via MSN to Grim Archon
You need two files in addition to your source code:
setup.py
and
MANIFEST

setup.py is used to create the distributable package by the author and is also used by the enduser to install the package.

MANIFEST is a plain text file that just contains a list of files to include in the package (one file per line).

The author will then use the command;
python setup.py sdist
which creates a dist sub-directory. This directory contains a zip file with all the files specified in the MANIFEST,
it also contains the PKG-INFO file which helps describe the package (usually a module description) for repositories like Pypi.

The end user will then unzip the package and run
python setup.py install
which typically would install the package into the site-packages sub-directory.

As a very simple example here are my setup.py and MANIFEST files for my ptypes.py module. You probably don't need so much info defined in the setup file but the principle should be clear. I used information defined in the ptypes.py module to help self document the package but you don't have to do it that way.

SETUP.PY
Code:
from distutils.core import setup
import ptypes
doc = ptypes.__doc__
sum = doc.split("\n")
classifiers = """\
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: Freely Distributable
Programming Language :: Python
Topic :: Software Development :: Libraries :: Python Modules
Operating System :: Microsoft :: Windows
Operating System :: Unix
"""

setup(name="ptypes",
      version = ptypes.__version__,
      maintainer = "Paul Hardwick",
      maintainer_email = "paul@peck.org.uk",
      url = "http://www.peck.org.uk/p/python",
      platforms = ["any"],
      description = sum[0],
      classifiers = filter(None, classifiers.split("\n")),
      long_description = doc,
      license = "GNU GPL",
      py_modules = []
      )


MANIFEST
Code:
README.txt
ptypes.py
setup.py


You should be able to modify that to your needs.

grim
__________________
*** Experimental Python Markup CGI V2 ***

Reply With Quote
  #3  
Old June 15th, 2004, 02:39 AM
evilmrhenry evilmrhenry is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 28 evilmrhenry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks. That takes care of most of it; however, I still would like a way to include the Python Imaging Library along with my program. Any pointers?

Reply With Quote
  #4  
Old June 15th, 2004, 03:56 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 12
Send a message via MSN to Grim Archon
PIL has it's own installer -
If you include the the PIL installer in the package you could easily write a batch file that first runs the PIL installer and then runs the setup.py script.

Alternativley when you think the program is stable you could convert the whole thing to a self-contained executable with something like py2exe (Windows) or cxFreeze (Linux).

grim

Reply With Quote
  #5  
Old June 15th, 2004, 10:39 AM
evilmrhenry evilmrhenry is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 28 evilmrhenry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
On second look, the PIL includes a portion in C, which would make it difficult to include it properly. Worse, the thing's larger than my actual program. I think I'll just include a download link.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Understanding Distutils

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap