On Aug 24, 4:55 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > I'm packaging up a python program and need to include an entire > directory tree in the distribution. the data_files=[] option to > setup() is fine for individual files, but what do I do when I > need to include an entire directory tree? > > On a more general note, I'm having trouble finding much > documentation on py2exe at all. There's a wiki page at > py2exe.org, but it's pretty superficial. It mentions looking > at the distutils documentation for details, but I've no idea > how distutils relates to py2exe or where in the distutils > documentation to look for py2exe stuff (I don't see anything > that looks familiar in the distutils docs). > > There must be some py2exe documentation somewhere... > > [http://sourceforge.net/projects/py2exe/hasn't been updated in > 5 years, is there any reason why it's still around?] > > -- > Grant Edwards grante Yow! LBJ, LBJ, how many > at JOKES did you tell today??! > visi.com
Grant, Any os.walk() loop that you can conceive which will generate a list of the kind [(dir1, pathList1), (dir2, pathList2), etc...] will work. Each subdir of your top-level tree has to be listed this way with the accompanying pathList of the subdir's files. I did this once for a 'samples' directory tree that I packaged with an app: #sample data files sampleDir = r'.\\samples' for root, dirs, files in os.walk(sampleDir): sampleList = [] if files: for filename in files: #ignore SVN dirs if ".svn" not in root: sampleList.append(os.path.join(root, filename)) if sampleList: dataFiles.append((root, sampleList)) On a side note, I've discovered that matplotlib since 0.90 or maybe earlier has specifically added a matplotlib.get_py2exe_datafiles() function to add its necessary data files in this way. Wouldn't it be nice if py2exe had something simple like that built in... Have you tried GUI2Exe? I've found its interface quite easy to use. It doesn't recurse into a dir tree (feature request?), but it makes the selection process at least half as painful. The py2exe docs leave something more to be desired. I found more tips and help via Google, ASPN, and on this list. Good luck, Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list