[POS-commit] r1749 - in kiwi/trunk: . kiwi

Johan Dahlin jdahlin at async.com.br
Thu Dec 1 12:11:12 BRST 2005


Author: jdahlin
Date: Thu Dec  1 12:11:11 2005
New Revision: 1749

Modified:
   kiwi/trunk/ChangeLog
   kiwi/trunk/kiwi/dist.py
   kiwi/trunk/setup.py
Log:
    * kiwi/dist.py (get_site_packages_dir): 
    New function, to handle installation of modules in the site-packages
    directory in a platform independent way.

    * setup.py (version): Use it here.
    Fixes bug #2326 (Carlos Augusto Marcicano)



Modified: kiwi/trunk/ChangeLog
==============================================================================
--- kiwi/trunk/ChangeLog	(original)
+++ kiwi/trunk/ChangeLog	Thu Dec  1 12:11:11 2005
@@ -1,3 +1,12 @@
+2005-12-01  Johan Dahlin  <jdahlin at async.com.br>
+
+	* kiwi/dist.py (get_site_packages_dir): 
+	New function, to handle installation of modules in the site-packages
+	directory in a platform independent way.
+
+	* setup.py (version): Use it here.
+	Fixes bug #2326 (Carlos Augusto Marcicano)
+
 2005-11-28  Johan Dahlin  <jdahlin at async.com.br>
 
 	* kiwi/ui/gazpacholoader.py (DataTypeProperty.save): Handle None,

Modified: kiwi/trunk/kiwi/dist.py
==============================================================================
--- kiwi/trunk/kiwi/dist.py	(original)
+++ kiwi/trunk/kiwi/dist.py	Thu Dec  1 12:11:11 2005
@@ -26,6 +26,7 @@
 from distutils.command.install_lib import install_lib
 from distutils.dep_util import newer
 from distutils.log import info, warn
+from distutils.sysconfig import get_python_lib
 from fnmatch import fnmatch
 import os
 
@@ -66,6 +67,24 @@
                                           self.global_resources)
         return install_lib.install(self) + [template]
 
+def get_site_packages_dir(*dirs):
+    """
+    Gets the relative path of the site-packages directory
+
+    This is mainly useful for setup.py usage:
+
+    >>> setup(...
+              data_files=[(get_site_packages_dir('foo'),
+                           files..)])
+
+    where files is a list of files to be installed in
+    a directory called foo created in your site-packages directory
+    
+    @param dirs: directory names to be appended
+    """
+
+    return os.path.join(get_python_lib(prefix=''), *dirs)
+                   
 def listfiles(*dirs):
     dir, pattern = os.path.split(os.path.join(*dirs))
     return [os.path.join(dir, filename)

Modified: kiwi/trunk/setup.py
==============================================================================
--- kiwi/trunk/setup.py	(original)
+++ kiwi/trunk/setup.py	Thu Dec  1 12:11:11 2005
@@ -15,7 +15,8 @@
 import os
 import sys
 
-from kiwi.dist import listfiles, listpackages, TemplateInstallLib
+from kiwi.dist import listfiles, listpackages, TemplateInstallLib, \
+     get_site_packages_dir
 
 class InstallLib(TemplateInstallLib):
     name = 'kiwi'
@@ -39,8 +40,7 @@
                    listfiles('gazpacho-plugin', 'kiwiwidgets.xml')),
                   ('share/gazpacho/resources/kiwiwidgets',
                    listfiles('gazpacho-plugin', 'resources', '*.png')),
-                  ('lib/python%d.%d/site-packages/gazpacho/widgets' %
-                   sys.version_info[:2],
+                  (get_site_packages_dir('gazpacho', 'widgets'),
                    listfiles('gazpacho-plugin', 'kiwiwidgets.py')),
                   ('share/doc/kiwi',
                    ('AUTHORS', 'ChangeLog', 'NEWS', 'README')),


More information about the POS-commit mailing list