Commits

Anonymous committed c0d324e

Add some help to setup.py if distutils isn't installed on the local system.

Comments (0)

Files changed (4)

         http://www.scons.org/download.html
 
 
-REQUIREMENTS
-============
+EXECUTION REQUIREMENTS
+======================
 
-SCons requires Python version 1.5.2 or later.  There should be no
-other dependencies or requirements to run SCons.
+Running SCons requires Python version 1.5.2 or later.  There should be
+no other dependencies or requirements to run SCons.
 
 The default SCons configuration assumes use of the Microsoft Visual C++
 compiler suite on WIN32 systems, and assumes a C compiler named 'cc',
 configuration of Environment construction variables.
 
 
+INSTALLATION REQUIREMENTS
+=========================
+
+Building and installing SCons from this package requires the Python
+distutils package.  The distutils package was not shipped as a standard
+part of Python until Python version 1.6, so if your system is running
+Python 1.5.2, you may not have distutils installed.  If you are running
+Python version 1.6 or later, you should be fine.
+
+NOTE TO RED HAT USERS:  All Red Hat Linux versions as late as 7.3
+still ship Python 1.5.2 as the default, so you probably do *not* have
+distutils installed, unless you have already done so manually.
+
+In this case, your options are:
+
+    --  (Optional.)  Install from a pre-packaged SCons package that
+        does not require distutils:
+
+            Red Hat Linux       scons-0.08-1.noarch.rpm
+
+            Debian GNU/Linux    scons_0.08-1_all.deb
+                                (or use apt-get)
+
+            Windows             scons-0.08.win32.exe
+
+    --  (Recommended.)  Download the latest distutils package from the
+        following URL:
+
+            http://www.python.org/sigs/distutils-sig/download.html
+
+        Install the distutils according to the instructions on the page.
+        You can then proceed to the next section to install SCons from
+        this package.
+
+
 INSTALLATION
 ============
 
-To install SCons from this package, you must first populate the
-build/scons/ directory.  (For an easier way to install SCons, without
-having to populate this directory, use the scons-{version}.tar.gz
-or scons-{version}.zip package.)
+Assuming your system satisfies the installation requirements in
+the previous section, install SCons from this package by first
+populating the build/scons/ directory.  (For an easier way to
+install SCons, without having to populate this directory, use the
+scons-{version}.tar.gz or scons-{version}.zip package.)
 
 If you already have an appropriate version of SCons installed on your
 system, populate the build/scons/ directory by running:
     and a separate Platform() method, for more flexible specification
     of platform-specific environment changes.
 
+  - Updated README instructions and setup.py code to catch an
+    installation failure from not having distutils installed.
+
   From Anthony Roach:
 
   - Add a "multi" keyword argument to Builder creation that specifies
         http://www.scons.org/download.html
 
 
-REQUIREMENTS
-============
+EXECUTION REQUIREMENTS
+======================
 
-SCons requires Python version 1.5.2 or later.  There should be no
-other dependencies or requirements to run SCons.
+Running SCons requires Python version 1.5.2 or later.  There should be
+no other dependencies or requirements to run SCons.  (There is, however,
+an additional requirement to *install* SCons from this particular
+package; see the next section.)
 
 The default SCons configuration assumes use of the Microsoft Visual C++
 compiler suite on WIN32 systems, and assumes a C compiler named 'cc',
 configuration of Environment construction variables.
 
 
+INSTALLATION REQUIREMENTS
+=========================
+
+Installing SCons from this package requires the Python distutils
+package.  The distutils package was not shipped as a standard part of
+Python until Python version 1.6, so if your system is running Python
+1.5.2, you may not have distutils installed.  If you are running
+Python version 1.6 or later, you should be fine.
+
+NOTE TO RED HAT USERS:  All Red Hat Linux versions as late as 7.3
+still ship Python 1.5.2 as the default, so you probably do *not* have
+distutils installed, unless you have already done so manually.
+
+In this case, your options are:
+
+    --  (Recommended.)  Install from a pre-packaged SCons package that
+        does not require distutils:
+
+            Red Hat Linux       scons-__VERSION__-1.noarch.rpm
+
+            Debian GNU/Linux    scons___VERSION__-1_all.deb
+                                (or use apt-get)
+
+            Windows             scons-__VERSION__.win32.exe
+
+    --  (Optional.)  Download the latest distutils package from the
+        following URL:
+
+            http://www.python.org/sigs/distutils-sig/download.html
+
+        Install the distutils according to the instructions on the page.
+        You can then proceed to the next section to install SCons from
+        this package.
+
+
 INSTALLATION
 ============
 
-To install this package, simply run the provided Python-standard setup
-script as follows:
+Assuming your system satisfies the installation requirements in the
+previous section, install SCons from this package simply by running the
+provided Python-standard setup script as follows:
 
         # python setup.py install
 
     os.chdir(head)
     sys.argv[0] = tail
 
-from distutils.core import setup
-from distutils.command.install_lib import install_lib
+try:
+    from distutils.core import setup
+    from distutils.command.install_lib import install_lib
+except ImportError:
+    sys.stderr.write("""Could not import distutils.
+
+Building or installing SCons from this package requires that the Python
+distutils be installed.  See the README or README.txt file from this
+package for instructions on where to find distutils for installation on
+your system, or on how to install SCons from a different package.
+""")
+    sys.exit(1)
 
 class my_install_lib(install_lib):
     def finalize_options(self):