[Python-checkins] distutils2: Added example output for pkgutil docs

tarek.ziade python-checkins at python.org
Sun Jun 20 23:04:52 CEST 2010


tarek.ziade pushed d5d979a9145a to distutils2:

http://hg.python.org/distutils2/rev/d5d979a9145a
changeset:   214:d5d979a9145a
user:        Josip Djolonga
date:        Sun Jun 20 18:05:19 2010 +0200
summary:     Added example output for pkgutil docs
files:       docs/source/pkgutil.rst

diff --git a/docs/source/pkgutil.rst b/docs/source/pkgutil.rst
--- a/docs/source/pkgutil.rst
+++ b/docs/source/pkgutil.rst
@@ -47,7 +47,8 @@
   print('Files')
   print('=====')
   for (path, md5, size) in dist.get_installed_files():
-      print('%s with hash %s [%d bytes] ' % (path, md5, size))
+      print('* Path: %s' % path)
+      print('  Hash %s, Size: %s bytes' % (md5, size)) 
   print('Metadata')
   print('========')
   for key, value in dist.metadata.items():
@@ -59,6 +60,64 @@
   else:
       print('* It was installed as a dependency')
 
+If we save the script above as ``print_info.py`` and we are intested in the
+distribution located at
+``/home/josip/dev/distutils2/src/distutils2/_backport/tests/fake_dists/choxie-2.0.0.9``
+then by typing in the console:
+
+.. code-block:: bash
+
+  $ echo /home/josip/dev/distutils2/src/distutils2/_backport/tests/fake_dists/choxie-2.0.0.9.dist-info | python print_info.py
+
+we get the following output:
+
+.. code-block:: none
+
+  Information about choxie
+  Files
+  =====
+  * Path: ../home/josip/dev/distutils2/src/distutils2/_backport/tests/fake_dists/choxie-2.0.0.9/truffles.py
+    Hash 5e052db6a478d06bad9ae033e6bc08af, Size: 111 bytes
+  * Path: ../home/josip/dev/distutils2/src/distutils2/_backport/tests/fake_dists/choxie-2.0.0.9/choxie/chocolate.py
+    Hash ac56bf496d8d1d26f866235b95f31030, Size: 214 bytes
+  * Path: ../home/josip/dev/distutils2/src/distutils2/_backport/tests/fake_dists/choxie-2.0.0.9/choxie/__init__.py
+    Hash 416aab08dfa846f473129e89a7625bbc, Size: 25 bytes
+  * Path: ../home/josip/dev/distutils2/src/distutils2/_backport/tests/fake_dists/choxie-2.0.0.9.dist-info/INSTALLER
+    Hash d41d8cd98f00b204e9800998ecf8427e, Size: 0 bytes
+  * Path: ../home/josip/dev/distutils2/src/distutils2/_backport/tests/fake_dists/choxie-2.0.0.9.dist-info/METADATA
+    Hash 696a209967fef3c8b8f5a7bb10386385, Size: 225 bytes
+  * Path: ../home/josip/dev/distutils2/src/distutils2/_backport/tests/fake_dists/choxie-2.0.0.9.dist-info/REQUESTED
+    Hash d41d8cd98f00b204e9800998ecf8427e, Size: 0 bytes
+  * Path: ../home/josip/dev/distutils2/src/distutils2/_backport/tests/fake_dists/choxie-2.0.0.9.dist-info/RECORD
+    Hash None, Size: None bytes
+  Metadata
+  ========
+      Metadata-Version: 1.2
+                  Name: choxie
+               Version: 2.0.0.9
+              Platform: []
+    Supported-Platform: UNKNOWN
+               Summary: Chocolate with a kick!
+           Description: UNKNOWN
+              Keywords: []
+             Home-page: UNKNOWN
+                Author: UNKNOWN
+          Author-email: UNKNOWN
+            Maintainer: UNKNOWN
+      Maintainer-email: UNKNOWN
+               License: UNKNOWN
+            Classifier: []
+          Download-URL: UNKNOWN
+        Obsoletes-Dist: ['truffles (<=0.8,>=0.5)', 'truffles (<=0.9,>=0.6)']
+           Project-URL: []
+         Provides-Dist: ['truffles (1.0)']
+         Requires-Dist: ['towel-stuff (0.1)']
+       Requires-Python: UNKNOWN
+     Requires-External: []
+  Extra
+  =====
+  * It was installed as a dependency
+
 Find Out Obsoleted Distributions
 ++++++++++++++++++++++++++++++++
 
@@ -75,3 +134,10 @@
       for obsoleted_by in pkgutil.obsoletes_distribution(name, version):
           print('%s(%s) is obsoleted by %s' % (name, version, obsoleted_by.name))
 
+This is how the output might look like:
+
+.. code-block:: none
+
+  strawberry(0.6) is obsoleted by choxie
+  grammar(1.0a4) is obsoleted by towel-stuff
+

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list