use correct base class for filesystem factory functions
[scons.git] / src / setup.py
index 68b46ab0ed5d06d7333707df9b0cdc0ecff7dd7a..93787704335ce2fa12593596b85cb840815261c0 100644 (file)
@@ -29,7 +29,13 @@ import stat
 import string
 import sys
 
-Version = "0.96.92"
+Version = "__VERSION__"
+
+man_pages = [
+    'scons.1',
+    'sconsign.1',
+    'scons-time.1',
+]
 
 (head, tail) = os.path.split(sys.argv[0])
 
@@ -204,9 +210,22 @@ def get_scons_prefix(libdir, is_win32):
                 return os.path.join(drive + head)
     return libdir
 
+def force_to_usr_local(self):
+    """
+    A hack to decide if we need to "force" the installation directories
+    to be under /usr/local.  This is because Mac Os X Tiger and
+    Leopard, by default, put the libraries and scripts in their own
+    directories under /Library or /System/Library.
+    """
+    return (sys.platform[:6] == 'darwin' and
+            (self.install_dir[:9] == '/Library/' or
+             self.install_dir[:16] == '/System/Library/'))
+
 class install_lib(_install_lib):
     def finalize_options(self):
         _install_lib.finalize_options(self)
+        if force_to_usr_local(self):
+            self.install_dir = '/usr/local/lib'
         args = self.distribution.script_args
         if not set_explicitly("lib", args):
             # They didn't explicitly specify the installation
@@ -227,6 +246,8 @@ class install_lib(_install_lib):
 class install_scripts(_install_scripts):
     def finalize_options(self):
         _install_scripts.finalize_options(self)
+        if force_to_usr_local(self):
+            self.install_dir = '/usr/local/bin'
         self.build_dir = os.path.join('build', 'scripts')
         msg = "Installed SCons scripts into %s" % self.install_dir
         Installed.append(msg)
@@ -326,35 +347,67 @@ class install_data(_install_data):
         _install_data.initialize_options(self)
     def finalize_options(self):
         _install_data.finalize_options(self)
+        if force_to_usr_local(self):
+            self.install_dir = '/usr/local'
         if Options.install_man:
             if is_win32:
                 dir = 'Doc'
             else:
                 dir = os.path.join('man', 'man1')
-            self.data_files = [(dir, ["scons.1", "sconsign.1"])]
+            self.data_files = [(dir, man_pages)]
             man_dir = os.path.join(self.install_dir, dir)
             msg = "Installed SCons man pages into %s" % man_dir
             Installed.append(msg)
         else:
             self.data_files = []
 
+description = "Open Source next-generation build tool."
+
+long_description = """Open Source next-generation build tool.
+Improved, cross-platform substitute for the classic Make
+utility.  In short, SCons is an easier, more reliable
+and faster way to build software."""
+
+scripts = [
+    'script/scons',
+    'script/sconsign',
+    'script/scons-time',
+
+    # We include scons.bat in the list of scripts, even on UNIX systems,
+    # because we provide an option to allow it be installed explicitly,
+    # for example if you're installing from UNIX on a share that's
+    # accessible to Windows and you want the scons.bat.
+    'script/scons.bat',
+]
+
+#if is_win32:
+#    scripts = scripts + [
+#        'script/scons-post-install.py'
+#    ]
+
 arguments = {
     'name'             : "scons",
     'version'          : Version,
+    'description'      : description,
+    'long_description' : long_description,
+    'author'           : 'Steven Knight',
+    'author_email'     : 'knight@baldmt.com',
+    'url'              : "http://www.scons.org/",
     'packages'         : ["SCons",
+                          "SCons.compat",
                           "SCons.Node",
-                          "SCons.Optik",
                           "SCons.Options",
                           "SCons.Platform",
                           "SCons.Scanner",
                           "SCons.Script",
-                          "SCons.Sig",
-                          "SCons.Tool"],
+                          "SCons.Tool",
+                          "SCons.Tool.MSCommon",
+                          "SCons.Tool.packaging",
+                          "SCons.Variables",
+                         ],
     'package_dir'      : {'' : 'engine'},
-    'data_files'       : [('man/man1', ["scons.1", "sconsign.1"])],
-    'scripts'          : ['script/scons',
-                          'script/sconsign',
-                          'script/scons.bat'],
+    'data_files'       : [('man/man1', man_pages)],
+    'scripts'          : scripts,
     'cmdclass'         : {'install'         : install,
                           'install_lib'     : install_lib,
                           'install_data'    : install_data,
@@ -366,3 +419,9 @@ apply(distutils.core.setup, (), arguments)
 
 if Installed:
     print string.join(Installed, '\n')
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: