[python-pycxx] Initial commit of python-pycxx after approval

John Morris zultron at fedoraproject.org
Fri Jun 29 19:18:59 UTC 2012


commit f6aeafd2fa60187a69c7c093c43ffcd140e06670
Author: John Morris <john at zultron.com>
Date:   Fri Jun 29 14:16:19 2012 -0500

    Initial commit of python-pycxx after approval

 .gitignore                                    |    1 +
 python-pycxx-6.2.4-change-include-paths.patch |   28 ++++
 python-pycxx-6.2.4-python3-syntax-fix.patch   |   16 +++
 python-pycxx-6.2.4-setup.py.patch             |   93 +++++++++++++
 python-pycxx.spec                             |  179 +++++++++++++++++++++++++
 sources                                       |    1 +
 6 files changed, 318 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..7614f7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/pycxx-6.2.4.tar.gz
diff --git a/python-pycxx-6.2.4-change-include-paths.patch b/python-pycxx-6.2.4-change-include-paths.patch
new file mode 100644
index 0000000..4bb62d4
--- /dev/null
+++ b/python-pycxx-6.2.4-change-include-paths.patch
@@ -0,0 +1,28 @@
+diff --git a/Src/cxxextensions.c b/Src/cxxextensions.c
+index 28a8e1d..cfab556 100644
+--- a/Src/cxxextensions.c
++++ b/Src/cxxextensions.c
+@@ -37,7 +37,7 @@
+ #include "CXX/WrapPython.h"
+ 
+ #if PY_MAJOR_VERSION == 2
+-#include "Src/Python2/cxxextensions.c"
++#include "Python2/cxxextensions.c"
+ #else
+-#include "Src/Python3/cxxextensions.c"
++#include "Python3/cxxextensions.c"
+ #endif
+diff --git a/Src/cxxsupport.cxx b/Src/cxxsupport.cxx
+index 1f2fb43..946e60d 100644
+--- a/Src/cxxsupport.cxx
++++ b/Src/cxxsupport.cxx
+@@ -37,7 +37,7 @@
+ #include "CXX/WrapPython.h"
+ 
+ #if PY_MAJOR_VERSION == 2
+-#include "Src/Python2/cxxsupport.cxx"
++#include "Python2/cxxsupport.cxx"
+ #else
+-#include "Src/Python3/cxxsupport.cxx"
++#include "Python3/cxxsupport.cxx"
+ #endif
diff --git a/python-pycxx-6.2.4-python3-syntax-fix.patch b/python-pycxx-6.2.4-python3-syntax-fix.patch
new file mode 100644
index 0000000..44c1a23
--- /dev/null
+++ b/python-pycxx-6.2.4-python3-syntax-fix.patch
@@ -0,0 +1,16 @@
+In python 3, 'print()' is now a function:
+http://docs.python.org/release/3.0.1/whatsnew/3.0.html
+
+--- pycxx-6.2.4.orig/Lib/__init__.py.orig	2012-06-28 13:34:47.000000000 -0500
++++ pycxx-6.2.4.orig/Lib/__init__.py	2012-06-28 13:33:36.000000000 -0500
+@@ -34,8 +34,8 @@
+ # DAMAGE.
+ #
+ #-----------------------------------------------------------------------------
+-print """CXX is installed. 
++print ("""CXX is installed. 
+ The support files you need are in the PYTHON/etc/CXX directory. 
+ The include files are in the distutils include path already.
+ Just refer to them as "CXX/CXX_Objects.h", etc.
+-"""
++""")
diff --git a/python-pycxx-6.2.4-setup.py.patch b/python-pycxx-6.2.4-setup.py.patch
new file mode 100644
index 0000000..052b614
--- /dev/null
+++ b/python-pycxx-6.2.4-setup.py.patch
@@ -0,0 +1,93 @@
+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 at 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'}
+       )
diff --git a/python-pycxx.spec b/python-pycxx.spec
new file mode 100644
index 0000000..e4338b2
--- /dev/null
+++ b/python-pycxx.spec
@@ -0,0 +1,179 @@
+%global modname pycxx
+
+# Specify '--with=python3' to build the python 3 RPM
+
+Name:           python-%{modname}
+Version:        6.2.4
+Release:        2%{?dist}
+Summary:        Write Python extensions in C++
+
+Group:          Development/Libraries
+License:        BSD
+URL:            http://CXX.sourceforge.net/
+
+BuildArch:      noarch
+
+Source0:        http://downloads.sourceforge.net/cxx/%{modname}-%{version}.tar.gz
+# Patch0:  remove unnecessary 'Src/' directory from include path in sources
+Patch0:         %{name}-%{version}-change-include-paths.patch
+# Patch1:  fix several problems with install, esp. omitted files, python 
+# v2/v3 awareness
+Patch1:         %{name}-%{version}-setup.py.patch
+# Patch2:  fix python 3 syntax error (print() is a function)
+Patch2:         %{name}-%{version}-python3-syntax-fix.patch
+
+BuildRequires:  python2-devel
+%if 0%{?_with_python3:1}
+BuildRequires:  python3-devel
+%endif
+
+
+%description
+PyCXX is a set of classes to help create extensions of Python in the
+C++ language. The first part encapsulates the Python C API taking care
+of exceptions and ref counting. The second part supports the building
+of Python extension modules in C++.
+
+
+%package devel
+Summary:        PyCXX header and source files
+Group:          Development/Libraries
+Requires:       python2
+
+%description devel
+PyCXX is a set of classes to help create extensions of Python in the
+C++ language. The first part encapsulates the Python C API taking care
+of exceptions and ref counting. The second part supports the building
+of Python extension modules in C++.
+
+The %{name}-devel package provides the header and source files
+for Python 2.  There is no non-devel package needed.
+
+
+%package -n python3-%{modname}-devel
+Summary:        PyCXX header and source files
+Group:          Development/Libraries
+Requires:       python3
+
+%description -n python3-%{modname}-devel
+PyCXX is a set of classes to help create extensions of Python in the
+C++ language. The first part encapsulates the Python C API taking care
+of exceptions and ref counting. The second part supports the building
+of Python extension modules in C++.
+
+The python3-%{modname}-devel package provides the header and source files
+for Python 3.  There is no non-devel package needed.
+
+
+%prep
+%setup -q -n %{modname}-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+
+%build
+python setup.py build
+
+
+%install
+INSTALL='setup.py install
+        --root=%{buildroot}
+        --prefix=%{_prefix}
+        --install-headers=%{_includedir}/CXX
+        --install-data=%{_usrsrc}'
+
+%{__python2} $INSTALL
+
+%if 0%{?_with_python3:1}
+%{__python3} $INSTALL
+%endif
+
+# Write pkg-config PyCXX.pc file
+mkdir -p %{buildroot}%{_datadir}/pkgconfig
+cat > %{buildroot}%{_datadir}/pkgconfig/PyCXX.pc <<EOF
+prefix=%{_prefix}
+exec_prefix=%{_prefix}
+includedir=%{_includedir}
+srcdir=%{_usrsrc}/CXX
+
+Name: PyCXX
+Description: Write Python extensions in C++
+Version: %{version}
+Cflags: -I\${includedir}
+EOF
+
+
+%files devel
+%doc README.html COPYRIGHT Doc/Python2/ 
+%dir %{_includedir}/CXX
+%{_includedir}/CXX/*.hxx
+%{_includedir}/CXX/*.h
+%{_includedir}/CXX/Python2
+%{python2_sitelib}/CXX*
+%dir %{_usrsrc}/CXX
+%{_usrsrc}/CXX/*.cxx
+%{_usrsrc}/CXX/*.c
+%{_usrsrc}/CXX/Python2
+%{_datadir}/pkgconfig/PyCXX.pc
+
+
+%if 0%{?_with_python3:1}
+%files -n python3-%{modname}-devel
+%doc README.html COPYRIGHT Doc/Python3/ 
+%dir %{_includedir}/CXX
+%{_includedir}/CXX/*.hxx
+%{_includedir}/CXX/*.h
+%{_includedir}/CXX/Python3
+%{python3_sitelib}/CXX*
+%dir %{_usrsrc}/CXX
+%{_usrsrc}/CXX/*.cxx
+%{_usrsrc}/CXX/*.c
+%{_usrsrc}/CXX/Python3
+%{_datadir}/pkgconfig/PyCXX.pc
+%endif
+
+
+%check
+export PKG_CONFIG_PATH=%{buildroot}%{_datadir}/pkgconfig:%{buildroot}%{_libdir}/pkgconfig
+test "$(pkg-config --modversion PyCXX)" = "%{version}"
+
+
+%changelog
+* Fri Jun 29 2012  <john at zultron.com> - 6.2.4-2
+- Fix Source0 URL
+
+* Thu Jun 28 2012  <john at zultron.com> - 6.2.4-1
+- Install headers into /usr/include/CXX instead of default
+  /usr/include/python2.7/CXX (setup.py command line option)
+- Install sources into /usr/src/CXX rather than /usr/share/python2.7/CXX
+- setup.py patch:
+  - Update PyCXX version number
+  - Convert tabs to spaces (from original patch)
+  - Add omitted headers and sources to install
+    - Extend install_headers to handle subdirs
+  - Install only Python v2 or v3 code as appropriate
+- Add --with=python3 option to build python3-pycxx-devel RPM
+
+* Wed Jun 27 2012  <john at zultron.com> - 6.2.4-0
+- Add a pkg-config PyCXX.pc file
+- Update to 6.2.4
+- Build only a -devel package; no regular package needed
+- Beautify specfile, fix macros
+
+* Thu Mar 29 2012  <jman at greaser.zultron.com> - 6.2.3-2
+- rebuild with koji
+
+* Wed Feb 22 2012 John Morris <john at zultron.com> - 6.2.3-1
+- update to compile on el5 as well as fc16 (missing python_sitelib macro)
+
+* Tue Feb 21 2012  <jman at greaser.zultron.com> - 6.2.3-1
+- changed python_sitearch to python_sitelib in files section, 
+  since package installs in /usr/lib even on x86_64
+
+* Tue Nov 03 2009 Steve Huff <shuff at vecna.org> - 6.1.1-1 - 7987/shuff
+- Renamed per RPMforge naming convention.
+
+* Thu Oct 08 2009 Steve Huff <shuff at vecna.org> - 6.1.1-1
+- Initial package.
+
diff --git a/sources b/sources
index e69de29..52feb98 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+e2500da3ab64cdba7ce5756945c30f91  pycxx-6.2.4.tar.gz


More information about the scm-commits mailing list