Grant Edwards schrieb:
> I've been beating my head against the wall for days trying to
> convince py2exe to include two trees of data files with my
> application. Using os.walk() and packages, package_dir, and
> package_data keywowrds I've managed to get the desired files
> into the 'build' directory, but then they don't end up in the
> 'dist' directory.
> How do I get a tree of data files into the 'dist' directory?
Well, IMO it isn't complicated. data_files is a list of (dest_dir, [filelist])
pairs. 'dest_dir' is the destination directory relative to the 'dist' directly
that py2exe creates (an empty string denotes the 'dist' directory itself),
and [filelist] is a sequence of sourcefile paths.
setup(console = [...],
windows = [...],
data_files = [("", ["path\to\file1.ext", "path\to\file2.ext", ...],
("lib", ["a.txt", "x\y\z\b.txt"])]
will copy these data files into the dist directory:
> Since getting distutils/py2exe to copy a tree of files is like
> pulling hens' teeth, is there any reason not to just do this
> after I call setup() in my setup.py program?
> setup( yadda, yadda)
> for d in datadirs:
This would also work, of course.