Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > packaging a python project and associated graphics files

Reply
Thread Tools

packaging a python project and associated graphics files

 
 
Rajarshi Guha
Guest
Posts: n/a
 
      10-03-2005
Hi, I've been trying to package a python project and I'm a little confused
about how I distribute some PNG's that the program uses as icons.

Using distutils I can set the data_files argument of setup() and get my
data files located in, say, /usr/local/mydata.

However when I write my code, it would seem that I have to hardcode the
above path. But this would mean that while working on the code I would
need to have it 'installed' on my system (or else actually make the above
directory).

This seems a little unwieldy. How do people handle this situation?

Thanks,

 
Reply With Quote
 
 
 
 
Mike Meyer
Guest
Posts: n/a
 
      10-03-2005
Rajarshi Guha <(E-Mail Removed)> writes:

> Hi, I've been trying to package a python project and I'm a little confused
> about how I distribute some PNG's that the program uses as icons.
>
> Using distutils I can set the data_files argument of setup() and get my
> data files located in, say, /usr/local/mydata.
>
> However when I write my code, it would seem that I have to hardcode the
> above path. But this would mean that while working on the code I would
> need to have it 'installed' on my system (or else actually make the above
> directory).
>
> This seems a little unwieldy. How do people handle this situation?


With symlinks from the installed location to the source tree.

<mike
--
Mike Meyer <(E-Mail Removed)> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
 
Reply With Quote
 
 
 
 
Robert Kern
Guest
Posts: n/a
 
      10-04-2005
Rajarshi Guha wrote:
> Hi, I've been trying to package a python project and I'm a little confused
> about how I distribute some PNG's that the program uses as icons.
>
> Using distutils I can set the data_files argument of setup() and get my
> data files located in, say, /usr/local/mydata.
>
> However when I write my code, it would seem that I have to hardcode the
> above path. But this would mean that while working on the code I would
> need to have it 'installed' on my system (or else actually make the above
> directory).
>
> This seems a little unwieldy. How do people handle this situation?


I recommend packaging the files in the package itself. With Python 2.4,
you can make distutils do this with the package_data argument to
setup(). You can find your files by looking at the __file__ variable in
any of your modules.

Also, take a look at PythonEggs and pkg_resources.

http://peak.telecommunity.com/DevCenter/PythonEggs
http://peak.telecommunity.com/DevCenter/PkgResources

--
Robert Kern
http://www.velocityreviews.com/forums/(E-Mail Removed)

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
jar files and packaging lora Java 14 07-01-2009 11:11 PM
cannot locate associated aspx files for web project rosettaservice@gmail.com ASP .Net 1 03-10-2007 05:58 AM
packaging a project into a component Tina ASP .Net 1 10-31-2004 04:13 AM
packaging a project into a component Tina ASP .Net Building Controls 0 10-31-2004 12:12 AM
Packaging a project into a component Tina ASP .Net Web Controls 0 10-31-2004 12:11 AM



Advertisments