[Python-checkins] commit of r41673 - in sandbox/trunk/setuptools: EasyInstall.txt setuptools.txt setuptools/command/bdist_rpm.py setuptools/command/install.py

phillip.eby python-checkins at python.org
Wed Dec 14 19:10:12 CET 2005


Author: phillip.eby
Date: Wed Dec 14 19:10:11 2005
New Revision: 41673

Modified:
   sandbox/trunk/setuptools/EasyInstall.txt
   sandbox/trunk/setuptools/setuptools.txt
   sandbox/trunk/setuptools/setuptools/command/bdist_rpm.py
   sandbox/trunk/setuptools/setuptools/command/install.py
Log:
Added a ``--single-version-externally-managed`` option to the ``install``
command so that you can more easily wrap a "flat" egg in a system package.
Enhanced ``bdist_rpm`` so that it installs single-version eggs that
don't rely on a ``.pth`` file.  The ``--no-egg`` option has been removed,
since all RPMs are now built in a more backwards-compatible format.

Some work is now needed for easy_install to recognize bdist_wininst 
.exe's that wrap these new flat eggs, as currently the .egg-info will 
not be recognized.


Modified: sandbox/trunk/setuptools/EasyInstall.txt
==============================================================================
--- sandbox/trunk/setuptools/EasyInstall.txt	(original)
+++ sandbox/trunk/setuptools/EasyInstall.txt	Wed Dec 14 19:10:11 2005
@@ -874,6 +874,10 @@
    the shortest one.  This helps to avoid "table of contents" CGI URLs like the
    ones on effbot.org.
 
+ * Quote arguments to python.exe (including python's path) to avoid problems
+   when Python (or a script) is installed in a directory whose name contains
+   spaces on Windows.
+
 0.6a8
  * Update for changed SourceForge mirror format
  

Modified: sandbox/trunk/setuptools/setuptools.txt
==============================================================================
--- sandbox/trunk/setuptools/setuptools.txt	(original)
+++ sandbox/trunk/setuptools/setuptools.txt	Wed Dec 14 19:10:11 2005
@@ -1629,6 +1629,25 @@
 them in a ``[develop]`` section or on the command line.
 
 
+``easy_install`` - Find and install packages
+============================================
+
+This command runs the `EasyInstall tool
+<http://peak.telecommunity.com/DevCenter/EasyInstall>`_ for you.  It is exactly
+equivalent to running the ``easy_install`` command.  All command line arguments
+following this command are consumed and not processed further by the distutils,
+so this must be the last command listed on the command line.  Please see
+the EasyInstall documentation for the options reference and usage examples.
+Normally, there is no reason to use this command via the command line, as you
+can just use ``easy_install`` directly.  It's only listed here so that you know
+it's a distutils command, which means that you can:
+
+* create command aliases that use it,
+* create distutils extensions that invoke it as a subcommand, and
+* configure options for it in your ``setup.cfg`` or other distutils config
+  files.
+
+
 .. _egg_info:
 
 ``egg_info`` - Create egg metadata and set build tags
@@ -1717,6 +1736,47 @@
     no ``package_dir`` set, this option defaults to the current directory.
 
 
+``install`` - Run ``easy_install`` or old-style installation
+============================================================
+
+The setuptools ``install`` command is basically a shortcut to run the
+``easy_install`` command on the current project.  However, for convenience
+in creating "system packages" of setuptools-based projects, you can also
+use this option:
+
+``--single-version-externally-managed``
+    This boolean option tells the ``install`` command to perform an "old style"
+    installation, with the addition of an ``.egg-info`` directory so that the
+    installed project will still have its metadata available and operate
+    normally.  If you use this option, you *must* also specify the ``--root``
+    or ``--record`` options (or both), because otherwise you will have no way
+    to identify and remove the installed files.
+
+This option is automatically in effect when ``install`` is invoked by another
+distutils command, so that commands like ``bdist_wininst`` and ``bdist_rpm``
+will create system packages of eggs.
+
+
+``install_egg_info`` - Install an ``.egg-info`` directory in ``site-packages``
+==============================================================================
+
+Setuptools runs this command as part of ``install`` operations that use the
+``--single-version-externally-managed`` options.  You should not invoke it
+directly; it is documented here for completeness and so that distutils
+extensions such as system package builders can make use of it.  This command
+has only one option:
+
+``--install-dir=DIR, -d DIR``
+    The parent directory where the ``.egg-info`` directory will be placed.
+    Defaults to the same as the ``--install-dir`` option specified for the
+    ``install_lib`` command, which is usually the system ``site-packages``
+    directory.
+
+This command assumes that the ``egg_info`` command has been given valid options
+via the command line or ``setup.cfg``, as it will invoke the ``egg_info``
+command and use its options to locate the project's source ``.egg-info``
+directory.
+
 
 .. _rotate:
 
@@ -2185,6 +2245,13 @@
    ``install`` operations, that installs an ``.egg-info`` directory with the
    package.
 
+ * Added a ``--single-version-externally-managed`` option to the ``install``
+   command so that you can more easily wrap a "flat" egg in a system package.
+
+ * Enhanced ``bdist_rpm`` so that it installs single-version eggs that
+   don't rely on a ``.pth`` file.  The ``--no-egg`` option has been removed,
+   since all RPMs are now built in a more backwards-compatible format.
+
 0.6a8
  * Fixed some problems building extensions when Pyrex was installed, especially
    with Python 2.4 and/or packages using SWIG.

Modified: sandbox/trunk/setuptools/setuptools/command/bdist_rpm.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/bdist_rpm.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/bdist_rpm.py	Wed Dec 14 19:10:11 2005
@@ -6,12 +6,6 @@
 
 class bdist_rpm(_bdist_rpm):
 
-    user_options = _bdist_rpm.user_options + [
-        ('no-egg', None, "Don't install as an egg (may break the package!)")
-    ]
-
-    boolean_options = _bdist_rpm.boolean_options + ['no-egg']
-
     def initialize_options(self):
         _bdist_rpm.initialize_options(self)
         self.no_egg = None
@@ -31,24 +25,16 @@
                 "Source0: %{name}-%{version}.tar",
                 "Source0: %{name}-%{unmangled_version}.tar"
             ).replace(
+                "setup.py install ",
+                "setup.py install --single-version-externally-managed "
+            ).replace(
                 "%setup",
                 "%setup -n %{name}-%{unmangled_version}"
             ).replace(line23,line24)
             for line in spec
         ]
         spec.insert(spec.index(line24)+1, "%define unmangled_version "+version)
-
-
-        if not self.no_egg:
-            return spec
-
-        # Hack the spec file so that we install old-style
-        return [
-            line.replace(
-                "setup.py install ","setup.py install --old-and-unmanageable "
-            ) for line in spec
-        ]
-
+        return spec
 
 
 

Modified: sandbox/trunk/setuptools/setuptools/command/install.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/install.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/install.py	Wed Dec 14 19:10:11 2005
@@ -1,29 +1,47 @@
 import setuptools, sys
 from distutils.command.install import install as _install
+from distutils.errors import DistutilsArgError
 
 class install(_install):
     """Use easy_install to install the package, w/dependencies"""
 
     user_options = _install.user_options + [
         ('old-and-unmanageable', None, "Try not to use this!"),
+        ('single-version-externally-managed', None,
+            "used by system package builders to create 'flat' eggs"),
     ]
 
-    boolean_options = _install.boolean_options + ['old-and-unmanageable']
+    boolean_options = _install.boolean_options + [
+        'old-and-unmanageable', 'single-version-externally-managed',
+    ]
+
+    sub_commands = _install.sub_commands + [
+        ('install_egg_info', lambda self: True),
+    ]
 
     def initialize_options(self):
         _install.initialize_options(self)
         self.old_and_unmanageable = None
+        self.single_version_externally_managed = None
         self.no_compile = None  # make DISTUTILS_DEBUG work right!
 
+    def finalize_options(self):
+        _install.initialize_options(self)
+        if self.single_version_externally_managed:
+            if not self.root and not self.record:
+                raise DistutilsArgError(
+                    "You must specify --record or --root when building system"
+                    " packages"
+                )
+
     def handle_extra_path(self):
-        # We always ignore extra_path, because we always install eggs
-        # (you can always use install_* commands directly if needed)
+        # We always ignore extra_path, because we install as .egg or .egg-info
         self.path_file = None
         self.extra_dirs = ''
 
     def run(self):
-        if (self.old_and_unmanageable or
-            sys._getframe(1).f_globals.get('__name__','') != 'distutils.dist'
+        if (self.old_and_unmanageable or self.single_version_externally_managed
+           or sys._getframe(1).f_globals.get('__name__','') != 'distutils.dist'
         ):
             # Either we were asked for the old behavior, or we're not being
             # run from the command line.  This is a bit kludgy, because a
@@ -50,24 +68,6 @@
         cmd.run()
         setuptools.bootstrap_install_from = None
 
-    sub_commands = _install.sub_commands + [
-        ('install_egg_info', lambda self: True),
-    ]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 
 


More information about the Python-checkins mailing list