[pypy-svn] r64720 - in pypy/trunk: lib-python/modified-2.5.2/distutils pypy/doc

pedronis at codespeak.net pedronis at codespeak.net
Mon Apr 27 11:58:44 CEST 2009


Author: pedronis
Date: Mon Apr 27 11:58:44 2009
New Revision: 64720

Modified:
   pypy/trunk/lib-python/modified-2.5.2/distutils/cmd.py
   pypy/trunk/pypy/doc/getting-started-python.txt
Log:
(iko, pedronis)

make easy_install as is found in the wild work out of the box with some example doc



Modified: pypy/trunk/lib-python/modified-2.5.2/distutils/cmd.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/distutils/cmd.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/distutils/cmd.py	Mon Apr 27 11:58:44 2009
@@ -14,6 +14,14 @@
 from distutils import util, dir_util, file_util, archive_util, dep_util
 from distutils import log
 
+def _easy_install_get_site_dirs():
+    # return a list of 'site' dirs for easy_install
+    from pkg_resources import normalize_path
+    sitedirs = filter(None,os.environ.get('PYTHONPATH','').split(os.pathsep))
+    sitedirs.append(os.path.join(sys.pypy_prefix, 'site-packages'))
+    sitedirs = map(normalize_path, sitedirs)
+    return sitedirs
+
 class Command:
     """Abstract base class for defining command classes, the "worker bees"
     of the Distutils.  A useful analogy for command classes is to think of
@@ -49,6 +57,10 @@
 
     # -- Creation/initialization methods -------------------------------
 
+    def _easy_install_integration(self):
+        from setuptools.command import easy_install
+        easy_install.get_site_dirs = _easy_install_get_site_dirs
+        
     def __init__ (self, dist):
         """Create and initialize a new Command object.  Most importantly,
         invokes the 'initialize_options()' method, which is the real
@@ -63,6 +75,9 @@
         if self.__class__ is Command:
             raise RuntimeError, "Command is an abstract class"
 
+        if self.__class__.__name__ == "easy_install":
+            self._easy_install_integration()
+
         self.distribution = dist
         self.initialize_options()
 

Modified: pypy/trunk/pypy/doc/getting-started-python.txt
==============================================================================
--- pypy/trunk/pypy/doc/getting-started-python.txt	(original)
+++ pypy/trunk/pypy/doc/getting-started-python.txt	Mon Apr 27 11:58:44 2009
@@ -38,7 +38,7 @@
 1. Install dependencies.  You need (these are Debian package names,
    adapt as needed):
 
-   * gcc
+   * ``gcc``
    * ``python-dev``
    * ``python-ctypes`` if you are still using Python2.4
    * ``libffi-dev``
@@ -248,6 +248,21 @@
     ../../..
     etc.
 
+In order to use ``distutils`` or ``setuptools`` a directory ``PREFIX/site-packages`` needs to be created. Here's an example session setting up and using ``easy_install``::
+
+    $ cd PREFIX
+    $ mkdir site-packages
+    $ curl -sO http://peak.telecommunity.com/dist/ez_setup.py
+    $ bin/pypy-c ez_setup.py
+    ...
+    $ bin/easy_install WebOb
+    $ bin/pypy-c           
+    Python 2.5.2 (64714, Apr 27 2009, 08:16:13)
+    [PyPy 1.1.0] on linux2
+    Type "help", "copyright", "credits" or "license" for more information.
+    And now for something completely different: ``PyPy doesn't have copolyvariadic dependently-monomorphed hyperfluxads''
+    >>>> import webob
+    >>>>               
 
 .. _`py.py interpreter`:
 



More information about the Pypy-commit mailing list