Blob Blame History Raw
This patch makes several changes to setup.py:

- Add omitted headers and sources to install
  - Extend install_headers to handle subdirs
- Install only Python v2 or v3 code as appropriate
- Update version number
- Convert tabs to spaces (from original RPM)
  - http://www.python.org/dev/peps/pep-0008/#tabs-or-spaces

diff -ruN pycxx-6.2.4.orig/setup.py pycxx-6.2.4/setup.py
--- pycxx-6.2.4.orig/setup.py	2010-05-02 14:10:27.000000000 -0500
+++ pycxx-6.2.4/setup.py	2012-06-28 03:26:33.000000000 -0500
@@ -1,35 +1,70 @@
 import os, sys
 from glob import glob
 from distutils.command.install import install
+from distutils.command.install_headers import install_headers
 from distutils.core import setup
 
-headers = (glob( os.path.join( "CXX","*.hxx" ) )
-          +glob( os.path.join( "CXX","*.h" ) ))
-sources = (glob( os.path.join( "Src", "*.cxx" ) )
-          +glob( os.path.join( "Src", "*.c" ) ))
+# either "Python2" or "Python3"
+PythonVer = "Python" + sys.version[0]
+
+headers = [
+    (None,
+     glob(os.path.join("CXX","*.hxx")) + \
+         glob(os.path.join("CXX","*.h"))
+     ),
+    (PythonVer,
+     glob(os.path.join("CXX",PythonVer,"*.hxx"))
+     )
+    ]
+
+sources = [
+    ("CXX", 
+     glob(os.path.join("Src", "*.cxx")) + \
+         glob(os.path.join("Src", "*.c"))
+     ),
+    (os.path.join("CXX",PythonVer), 
+     glob(os.path.join("Src",PythonVer,"*"))
+     )
+    ]
 
 
 class my_install (install):
 
     def finalize_options (self):
-	if not self.install_data or (len(self.install_data) < 8) :
-	    self.install_data = "$base/share/python$py_version_short"
+        if not self.install_data or (len(self.install_data) < 8):
+            self.install_data = "$base/share/python$py_version_short"
         install.finalize_options (self)
 
     def run (self):
-	self.distribution.data_files = [("CXX", sources)]
-	self.distribution.headers = headers
+        self.distribution.data_files = sources
+        self.distribution.headers = headers
         install.run (self)
 
+class my_install_headers (install_headers):
+    def run (self):
+        if not self.distribution.headers:
+            return
+
+        for subdir, headers in self.distribution.headers:
+            try:
+                dir = os.path.join(self.install_dir,subdir)
+            except:
+                dir = self.install_dir
+            self.mkpath(dir)
+            for header in headers:
+                (out, _) = self.copy_file(header, dir)
+                self.outfiles.append(out)
+
 
 setup (name             = "CXX",
-       version          = "6.2.0",
+       version          = "6.2.4",
        maintainer       = "Barry Scott",
        maintainer_email = "barry-scott@users.sourceforge.net",
        description      = "Facility for extending Python with C++",
        url              = "http://cxx.sourceforge.net",
        
-       cmdclass         = {'install': my_install},
+       cmdclass         = {'install': my_install,
+                           'install_headers': my_install_headers},
        packages         = ['CXX'],
        package_dir      = {'CXX': 'Lib'}
       )