(original) (raw)

? install_db.py Index: cmd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cmd.py,v retrieving revision 1.29 diff -u -r1.29 cmd.py --- cmd.py 6 Dec 2001 20:51:35 -0000 1.29 +++ cmd.py 29 May 2002 21:20:36 -0000 @@ -367,6 +367,7 @@ the latter defaults to false for commands that don't define it.)""" return file_util.copy_file( + self.distribution, infile, outfile, preserve_mode, preserve_times, not self.force, @@ -382,6 +383,7 @@ and force flags. """ return dir_util.copy_tree( + self.distribution, infile, outfile, preserve_mode,preserve_times,preserve_symlinks, not self.force, Index: dir_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dir_util.py,v retrieving revision 1.8 diff -u -r1.8 dir_util.py --- dir_util.py 6 Dec 2001 20:51:35 -0000 1.8 +++ dir_util.py 29 May 2002 21:20:37 -0000 @@ -110,7 +110,7 @@ # create_tree () -def copy_tree (src, dst, +def copy_tree (distribution, src, dst, preserve_mode=1, preserve_times=1, preserve_symlinks=0, @@ -169,11 +169,11 @@ elif os.path.isdir(src_name): outputs.extend( - copy_tree(src_name, dst_name, + copy_tree(distribution, src_name, dst_name, preserve_mode, preserve_times, preserve_symlinks, update, verbose, dry_run)) else: - copy_file(src_name, dst_name, + copy_file(distribution, src_name, dst_name, preserve_mode, preserve_times, update, None, verbose, dry_run) outputs.append(dst_name) Index: dist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v retrieving revision 1.53 diff -u -r1.53 dist.py --- dist.py 6 Dec 2001 20:51:35 -0000 1.53 +++ dist.py 29 May 2002 21:20:37 -0000 @@ -982,30 +982,62 @@ """ pkg_info = open( os.path.join(base_dir, 'PKG-INFO'), 'w') + self._write_pkg_info(pkg_info) + pkg_info.close() + + # write_pkg_info () - pkg_info.write('Metadata-Version: 1.0\n') - pkg_info.write('Name: %s\n' % self.get_name() ) - pkg_info.write('Version: %s\n' % self.get_version() ) - pkg_info.write('Summary: %s\n' % self.get_description() ) - pkg_info.write('Home-page: %s\n' % self.get_url() ) - pkg_info.write('Author: %s\n' % self.get_contact() ) - pkg_info.write('Author-email: %s\n' % self.get_contact_email() ) - pkg_info.write('License: %s\n' % self.get_license() ) + def _write_pkg_info (self, output): + output.write('Metadata-Version: 1.0\n') + output.write('Name: %s\n' % self.get_name() ) + output.write('Version: %s\n' % self.get_version() ) + output.write('Summary: %s\n' % self.get_description() ) + output.write('Home-page: %s\n' % self.get_url() ) + output.write('Author: %s\n' % self.get_author() ) + output.write('Author-email: %s\n' % self.get_author_email() ) + output.write('Maintainer: %s\n' % self.get_maintainer() ) + output.write('Maintainer-email: %s\n' % self.get_maintainer_email() ) + output.write('License: %s\n' % self.get_license() ) long_desc = rfc822_escape( self.get_long_description() ) - pkg_info.write('Description: %s\n' % long_desc) + output.write('Description: %s\n' % long_desc) keywords = string.join( self.get_keywords(), ',') if keywords: - pkg_info.write('Keywords: %s\n' % keywords ) + output.write('Keywords: %s\n' % keywords ) for platform in self.get_platforms(): - pkg_info.write('Platform: %s\n' % platform ) + output.write('Platform: %s\n' % platform ) - pkg_info.close() - - # write_pkg_info () + # _write_pkg_info () + def read_pkg_info (self, headers): + self.name = headers.getheader('Name') + self.version = headers.getheader('Version') + self.description = headers.getheader('Summary') + self.url = headers.getheader('Home-page') + self.author = headers.getheader('Author') + self.author_email = headers.getheader('Author-email') + self.maintainer = headers.getheader('Maintainer') + self.maintainer_email = headers.getheader('Maintainer-email') + self.license = headers.getheader('License') + self.long_description = headers.getheader('Description') + self.platforms = headers.getheaders('Platform') + if 'UNKNOWN' in self.platforms: + self.platforms.remove('UNKNOWN') + + keywords = headers.getheader('Keywords') + if keywords is not None: + keywords = keywords.split(',') + self.keywords = keywords + + for attr in ['name', 'author', 'author_email', + 'maintainer', 'maintainer_email', 'url', 'license', + 'description', 'long_description']: + if getattr(self, attr) == 'UNKNOWN': + setattr(self, attr, None) + + # -- Metadata query methods ---------------------------------------- def get_name (self): Index: file_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/file_util.py,v retrieving revision 1.12 diff -u -r1.12 file_util.py --- file_util.py 1 Feb 2002 18:29:34 -0000 1.12 +++ file_util.py 29 May 2002 21:20:38 -0000 @@ -9,7 +9,7 @@ import os from distutils.errors import DistutilsFileError - +from distutils.install_db import get_install_db # for generating verbose output in 'copy_file()' _copy_action = { None: 'copying', @@ -74,7 +74,7 @@ # _copy_file_contents() -def copy_file (src, dst, +def copy_file (distribution, src, dst, preserve_mode=1, preserve_times=1, update=0, @@ -177,6 +177,9 @@ if preserve_mode: os.chmod(dst, S_IMODE(st[ST_MODE])) + db = get_install_db() + package = db.get_package(distribution.name) + package.add_file(dst) return (dst, 1) # copy_file () Index: command/install_lib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_lib.py,v retrieving revision 1.38 diff -u -r1.38 install_lib.py --- command/install_lib.py 6 Dec 2001 20:57:12 -0000 1.38 +++ command/install_lib.py 29 May 2002 21:20:38 -0000 @@ -6,7 +6,6 @@ from types import IntType from distutils.core import Command from distutils.errors import DistutilsOptionError -from distutils.dir_util import copy_tree class install_lib (Command):