It seems installing data-files in package directories is a common requirement - at least for me. Readme files, data files needed by the packages - the bdist_wininst.exe file is such an example. It needs to be in the same directory as the distutils.command.bdist_wininst module. So here is a build_py subclass (contained in a setup script) which does this. Any comments? Thomas
On Nov 19, 2003, at 3:06 PM, Thomas Heller wrote:
It seems installing data-files in package directories is a common requirement - at least for me.
Me too
Readme files, data files needed by the packages - the bdist_wininst.exe file is such an example. It needs to be in the same directory as the distutils.command.bdist_wininst module.
So here is a build_py subclass (contained in a setup script) which does this. Any comments?
It's also often necessary to recursively include data files and preserve symlinks, especially on OS X. I'm currently using a (modified?) version of Rene Liebscher's "install_data" setup extensions. I believe I borrowed them from PyXML, but I'm not quite sure. -bob
Bob Ippolito <bob@redivi.com> writes:
On Nov 19, 2003, at 3:06 PM, Thomas Heller wrote:
It seems installing data-files in package directories is a common requirement - at least for me.
Me too
Readme files, data files needed by the packages - the bdist_wininst.exe file is such an example. It needs to be in the same directory as the distutils.command.bdist_wininst module.
So here is a build_py subclass (contained in a setup script) which does this. Any comments?
It's also often necessary to recursively include data files and preserve symlinks, especially on OS X. I'm currently using a (modified?) version of Rene Liebscher's "install_data" setup extensions. I believe I borrowed them from PyXML, but I'm not quite sure.
Ah yes, this looks quite nice (I'm looking into PyXML-0.8.3.tar.gz). And the trick is to reuse distutils' useless (?) install_data command ;-). Thanks, Thomas
Thomas Heller wrote:
Ah yes, this looks quite nice (I'm looking into PyXML-0.8.3.tar.gz). And the trick is to reuse distutils' useless (?) install_data command ;-).
talking about data, I believe there's still a bug in the sdist command that causes data files not to be put into a distro by default, i.e. when no MANIFEST[.in] is provided. Regards, Stefan
Thomas Heller wrote:
It seems installing data-files in package directories is a common requirement - at least for me.
Readme files, data files needed by the packages - the bdist_wininst.exe file is such an example. It needs to be in the same directory as the distutils.command.bdist_wininst module.
So here is a build_py subclass (contained in a setup script) which does this. Any comments?
Does this only copy the files into the build directory or also install them ? It's a bit too unflexible for my taste (I wouldn't want *all* files to get copied into the package tree). Here's what I use for install_data to achieve more or less the same with more control: class mx_install_data(install_data): """ Rework the install_data command to something more useful. """ def finalize_options(self): if self.install_dir is None: installobj = self.distribution.get_command_obj('install') self.install_dir = installobj.install_data if _debug: print 'Installing data files to %s' % self.install_dir install_data.finalize_options(self) def run (self): if not self.dry_run: self.mkpath(self.install_dir) data_files = self.get_inputs() for entry in data_files: if type(entry) == types.StringType: if 1 or os.name != 'posix': # Unix- to platform-convention conversion entry = string.join(string.split(entry, '/'), os.sep) filenames = glob.glob(entry) for filename in filenames: dst = os.path.join(self.install_dir, filename) dstdir = os.path.split(dst)[0] if not self.dry_run: self.mkpath(dstdir) outfile = self.copy_file(filename, dst)[0] else: outfile = dst self.outfiles.append(outfile) else: raise ValueError, 'tuples in data_files not supported' -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Nov 19 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/ mxODBC.Zope Database Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
participants (4)
-
Bob Ippolito
-
M.-A. Lemburg
-
Stefan Seefeld
-
Thomas Heller