[Python-checkins] r45405 - in sandbox/trunk/setuptools: EasyInstall.txt easy_install.py setup.py setuptools/command/__init__.py setuptools/command/easy_install.py setuptools/site-patch.py site.py

phillip.eby python-checkins at python.org
Fri Apr 14 21:38:39 CEST 2006


Author: phillip.eby
Date: Fri Apr 14 21:38:38 2006
New Revision: 45405

Added:
   sandbox/trunk/setuptools/setuptools/site-patch.py
      - copied unchanged from r45281, sandbox/trunk/setuptools/site.py
Removed:
   sandbox/trunk/setuptools/site.py
Modified:
   sandbox/trunk/setuptools/EasyInstall.txt
   sandbox/trunk/setuptools/easy_install.py
   sandbox/trunk/setuptools/setup.py
   sandbox/trunk/setuptools/setuptools/command/__init__.py
   sandbox/trunk/setuptools/setuptools/command/easy_install.py
Log:
First round of prepping setuptools for inclusion in Python 2.5: move 
site.py to setuptools/site-patch.py; reinstate 'python -m easy_install' 
support; use distutils' "upload" command when running under 2.5.


Modified: sandbox/trunk/setuptools/EasyInstall.txt
==============================================================================
--- sandbox/trunk/setuptools/EasyInstall.txt	(original)
+++ sandbox/trunk/setuptools/EasyInstall.txt	Fri Apr 14 21:38:38 2006
@@ -331,6 +331,10 @@
 2.4, you can use the ``easy_install-2.3`` or ``easy_install-2.4`` scripts to
 install packages for Python 2.3 or 2.4, respectively.
 
+Also, if you're working with Python version 2.4 or higher, you can run Python
+with ``-m easy_install`` to run that particular Python version's
+``easy_install`` command.
+
 
 Restricting Downloads with ``--allow-hosts``
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1097,6 +1101,8 @@
 ============================
 
 0.7a1
+ * You can now use "python -m easy_install" with Python 2.4 and above.
+
  * Added automatic retry for Sourceforge mirrors.  The new download process is
    to first just try dl.sourceforge.net, then randomly select mirror IPs and
    remove ones that fail, until something works.  The removed IPs stay removed

Modified: sandbox/trunk/setuptools/easy_install.py
==============================================================================
--- sandbox/trunk/setuptools/easy_install.py	(original)
+++ sandbox/trunk/setuptools/easy_install.py	Fri Apr 14 21:38:38 2006
@@ -1,15 +1,6 @@
-#!python
-"""\
-This script/module exists for backward compatibility only!  It will go away
-entirely in 0.7.  Please start using the 'easy_install' script or .exe instead
-of using 'python -m easy_install' or running 'easy_install.py' directly.
-"""
+"""Run the EasyInstall command"""
 
 if __name__ == '__main__':
-    import sys
-    print >>sys.stderr, \
-        "Please use the 'easy_install' script or executable instead."
-    print >>sys.stderr, \
-        "(i.e., don't include the '.py' extension and don't use 'python -m')"
-    sys.exit(2)
+    from setuptools.command.easy_install import main
+    main()
 

Modified: sandbox/trunk/setuptools/setup.py
==============================================================================
--- sandbox/trunk/setuptools/setup.py	(original)
+++ sandbox/trunk/setuptools/setup.py	Fri Apr 14 21:38:38 2006
@@ -23,8 +23,6 @@
 from setuptools import setup, find_packages
 import sys
 scripts = []
-if sys.platform != "win32":
-    scripts = ["easy_install.py"]   # for backward compatibility only
 
 setup(
     name="setuptools",
@@ -38,21 +36,16 @@
     keywords = "CPAN PyPI distutils eggs package management",
     url = "http://peak.telecommunity.com/DevCenter/setuptools",
     test_suite = 'setuptools.tests',
-    
     packages = find_packages(),
-    package_data = {'setuptools':['*.exe']},
-
-    py_modules = ['pkg_resources', 'easy_install', 'site'],
-
-    zip_safe = False,   # We want 'python -m easy_install' to work, for now :(
+    package_data = {'setuptools':['*.exe','site-patch.py']},
 
+    py_modules = ['pkg_resources','easy_install'],
+    zip_safe = (sys.version>="2.5"),   # <2.5 needs unzipped for -m to work
     entry_points = {
-
         "distutils.commands" : [
             "%(cmd)s = setuptools.command.%(cmd)s:%(cmd)s" % locals()
             for cmd in SETUP_COMMANDS
         ],
-
         "distutils.setup_keywords": [
             "eager_resources      = setuptools.dist:assert_string_list",
             "namespace_packages   = setuptools.dist:check_nsp",
@@ -68,7 +61,6 @@
             "dependency_links     = setuptools.dist:assert_string_list",
             "test_loader          = setuptools.dist:check_importable",
         ],
-
         "egg_info.writers": [
             "PKG-INFO = setuptools.command.egg_info:write_pkg_info",
             "requires.txt = setuptools.command.egg_info:write_requirements",
@@ -79,16 +71,14 @@
             "depends.txt = setuptools.command.egg_info:warn_depends_obsolete",
             "dependency_links.txt = setuptools.command.egg_info:overwrite_arg",
         ],
-
         "console_scripts": [
              "easy_install = setuptools.command.easy_install:main",
              "easy_install-%s = setuptools.command.easy_install:main"
                 % sys.version[:3]
-            ],
-            
+        ],           
         "setuptools.file_finders":
             ["svn_cvs = setuptools.command.sdist:_default_revctrl"]
-        },
+    },
 
     classifiers = [f.strip() for f in """
     Development Status :: 3 - Alpha
@@ -121,3 +111,13 @@
 
 
 
+
+
+
+
+
+
+
+
+
+

Modified: sandbox/trunk/setuptools/setuptools/command/__init__.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/__init__.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/__init__.py	Fri Apr 14 21:38:38 2006
@@ -4,6 +4,11 @@
     'sdist', 'setopt', 'test', 'upload', 'install_egg_info', 'install_scripts',
 ]
 
+import sys
+if sys.version>='2.5':
+    # In Python 2.5 and above, distutils includes its own upload command
+    __all__.remove('upload')
+    
 
 from distutils.command.bdist import bdist
 
@@ -11,4 +16,4 @@
     bdist.format_command['egg'] = ('bdist_egg', "Python .egg file")
     bdist.format_commands.append('egg')
 
-del bdist
+del bdist, sys

Modified: sandbox/trunk/setuptools/setuptools/command/easy_install.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/easy_install.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/easy_install.py	Fri Apr 14 21:38:38 2006
@@ -1073,7 +1073,7 @@
             return  # already did it, or don't need to
 
         sitepy = os.path.join(self.install_dir, "site.py")
-        source = resource_string(Requirement.parse("setuptools"), "site.py")
+        source = resource_string("setuptools", "site-patch.py")
         current = ""
 
         if os.path.exists(sitepy):

Deleted: /sandbox/trunk/setuptools/site.py
==============================================================================
--- /sandbox/trunk/setuptools/site.py	Fri Apr 14 21:38:38 2006
+++ (empty file)
@@ -1,82 +0,0 @@
-def __boot():
-    import sys, imp, os, os.path   
-    PYTHONPATH = os.environ.get('PYTHONPATH')
-    if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH):
-        PYTHONPATH = []
-    else:
-        PYTHONPATH = PYTHONPATH.split(os.pathsep)
-
-    pic = getattr(sys,'path_importer_cache',{})
-    stdpath = sys.path[len(PYTHONPATH):]
-    mydir = os.path.dirname(__file__)
-    #print "searching",stdpath,sys.path
-
-    for item in stdpath:
-        if item==mydir or not item:
-            continue    # skip if current dir. on Windows, or my own directory
-        importer = pic.get(item)
-        if importer is not None:
-            loader = importer.find_module('site')
-            if loader is not None:
-                # This should actually reload the current module
-                loader.load_module('site')
-                break
-        else:
-            try:
-                stream, path, descr = imp.find_module('site',[item])
-            except ImportError:
-                continue
-            if stream is None:
-                continue
-            try:
-                # This should actually reload the current module
-                imp.load_module('site',stream,path,descr)
-            finally:
-                stream.close()
-            break
-    else:
-        raise ImportError("Couldn't find the real 'site' module")
-
-    #print "loaded", __file__
-
-    known_paths = dict([(makepath(item)[1],1) for item in sys.path]) # 2.2 comp
-
-    oldpos = getattr(sys,'__egginsert',0)   # save old insertion position
-    sys.__egginsert = 0                     # and reset the current one
-
-    for item in PYTHONPATH:
-        addsitedir(item)
-
-    sys.__egginsert += oldpos           # restore effective old position
-    
-    d,nd = makepath(stdpath[0])
-    insert_at = None
-    new_path = []
-
-    for item in sys.path:
-        p,np = makepath(item)
-
-        if np==nd and insert_at is None:
-            # We've hit the first 'system' path entry, so added entries go here
-            insert_at = len(new_path)
-
-        if np in known_paths or insert_at is None:
-            new_path.append(item)
-        else:
-            # new path after the insert point, back-insert it
-            new_path.insert(insert_at, item)
-            insert_at += 1
-            
-    sys.path[:] = new_path
-
-if __name__=='site':    
-    __boot()
-    del __boot
-    
-
-
-
-
-
-
-


More information about the Python-checkins mailing list