diff --git a/pep-0376.txt b/pep-0376.txt index b9ba37c7e..3345409bb 100644 --- a/pep-0376.txt +++ b/pep-0376.txt @@ -149,19 +149,6 @@ This will require changing the way the `install` command writes the record file, so the old `record` behavior will be deprecated. XXX see how to handle old record (new option, or wait for 2 version?) -Listing the .egg-info elements in Distutils -=========================================== - -In Distutils, the `dist` module will introduce an `EGG_INFO_FILES` constant -to list all files located in the `.egg-info` directory:: - - from collections import namedtuple - - EggInfos = namedtuple('EggInfo', 'manifest record pkg_info') - - # files added in egg-info - EGG_INFO_FILES = EggInfos('RECORD', 'PKG-INFO') - Back to our `zlib` example, we will have:: - zlib @@ -169,8 +156,6 @@ Back to our `zlib` example, we will have:: PKG-INFO RECORD -XXX See if we want to add Python version in the PKG-INFO - New functions in pkgutil ======================== @@ -199,8 +184,6 @@ The new functions added in the package are : Uses `get_egg_info` and gets any file inside the directory, pointed by filename. - filename can be any value found in `distutils.sdist.EGG_INFO_FILES`. - Let's use it with our `zlib` example:: >>> from pkgutil import get_egg_info, get_metadata, get_egg_info_file @@ -209,15 +192,13 @@ Let's use it with our `zlib` example:: >>> metadata = get_metadata('zlib') >>> metadata.version '2.5.2' - >>> from distutils.dist import EGG_INFO_FILES - >>> get_egg_info_file('zlib', EGG_INFO_FILES.manifest).read() + >>> get_egg_info_file('zlib', 'PKG-INFO').read() some ... files - -Adding an Uninstall API -======================= +Adding an Uninstall function +============================ Distutils provides a very basic way to install a project, which is running the `install` command over the `setup.py` script of the distribution. @@ -227,10 +208,15 @@ all files listed in the `RECORD` file of a project, as long as they are not mentioned in another `RECORD` file. This command will be added in the `util` module and will take the name -of the project to uninstall:: +of the project to uninstall. A call to uninstall will return a list +of uninstalled files. If the project is not found, a Distutils:: >>> from distutils.util import uninstall >>> uninstall('zlib') + ['/opt/local/lib/python2.6/site-packages/zlib/file1', + '/opt/local/lib/python2.6/site-packages/zlib/file2'] + +If the project is not found, a ``DistutilsUninstallError`` will be raised. To make it a reference API for third-party projects that wish to provide an `uninstall feature`. The `uninstall` API can also be invoked with a @@ -243,6 +229,7 @@ Examples:: ... logging.info('Removing %s' % path) ... return True >>> uninstall('zlib', _remove_and_log) + >>> def _dry_run(path): ... logging.info('Removing %s (dry run)' % path) ... return False