[packages/python-pycxx] - initial; from fc

arekm arekm at pld-linux.org
Thu Jun 11 21:45:00 CEST 2015


commit 61a01712977dff35b583dd239e451a8c713e21ee
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Jun 11 21:44:38 2015 +0200

    - initial; from fc

 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             |  85 +++++++++++++++
 python-pycxx.spec                             | 151 ++++++++++++++++++++++++++
 4 files changed, 280 insertions(+)
---
diff --git a/python-pycxx.spec b/python-pycxx.spec
new file mode 100644
index 0000000..037e6e5
--- /dev/null
+++ b/python-pycxx.spec
@@ -0,0 +1,151 @@
+%bcond_without  python2 # CPython 2.x module
+%bcond_without  python3 # CPython 3.x module
+#
+%global modname pycxx
+#
+Summary:	Write Python extensions in C++
+Name:		python-%{modname}
+Version:	6.2.6
+Release:	1
+License:	BSD
+Group:		Development/Libraries
+URL:		http://CXX.sourceforge.net/
+BuildArch:	noarch
+Source0:	http://downloads.sourceforge.net/cxx/%{modname}-%{version}.tar.gz
+# Source0-md5:	20bcc50e9529aad3d646c1c48c1502d9
+# Patch0:  remove unnecessary 'Src/' directory from include path in sources
+Patch0:		%{name}-6.2.4-change-include-paths.patch
+# Patch1:  fix several problems with install, esp. omitted files, python
+# v2/v3 awareness
+Patch1:		%{name}-6.2.4-setup.py.patch
+# Patch2:  fix python 3 syntax error (print() is a function)
+Patch2:		%{name}-6.2.4-python3-syntax-fix.patch
+%{?with_python2:BuildRequires:	python-devel}
+%{?with_python3:BuildRequires:	python3-devel}
+
+%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:	python
+
+%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 -b .change-include-paths
+%patch1 -p1 -b .setup
+%patch2 -p1 -b .python3-syntax-fix
+
+
+%build
+%if %{with python2}
+%{__python} setup.py build --build-base build-2
+%endif
+
+%if %{with python3}
+%{__python3} setup.py build --build-base build-3
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%{__python} setup.py \
+	build --build-base build-2 \
+	install --skip-build \
+	--optimize=2 \
+	--install-data=%{_datadir}/%{name} \
+	--root=$RPM_BUILD_ROOT
+
+%py_postclean
+%endif
+
+%if %{with python3}
+%{__python3} setup.py \
+	build --build-base build-3 \
+	install --skip-build \
+	--optimize=2 \
+	--install-data=%{_datadir}/python3-%{modname} \
+	--root=$RPM_BUILD_ROOT
+%endif
+
+# Write pkg-config PyCXX.pc file
+install -d $RPM_BUILD_ROOT%{_npkgconfigdir}
+
+%if %{with python2}
+cat > $RPM_BUILD_ROOT%{_npkgconfigdir}/PyCXX.pc <<EOF
+prefix=%{_prefix}
+exec_prefix=%{_prefix}
+includedir=%{py_incdir}
+srcdir=%{_datadir}/%{name}
+
+Name: PyCXX
+Description: Write Python extensions in C++
+Version: %{version}
+Cflags: -I\${includedir}
+EOF
+%endif
+
+%if %{with python3}
+cat > $RPM_BUILD_ROOT%{_npkgconfigdir}/Py3CXX.pc <<EOF
+prefix=%{_prefix}
+exec_prefix=%{_prefix}
+includedir=%{py3_incdir}
+srcdir=%{_datadir}/python3-%{modname}
+
+Name: Py3CXX
+Description: Write Python 3 extensions in C++
+Version: %{version}
+Cflags: -I\${includedir}
+EOF
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files devel
+%defattr(644,root,root,755)
+%doc README.html COPYRIGHT Doc/Python2/
+%{_includedir}/python2*
+%{py_sitescriptdir}/CXX*
+%{_datadir}/%{name}
+%{_npkgconfigdir}/PyCXX.pc
+%endif
+
+%if %{with python3}
+%files -n python3-%{modname}-devel
+%defattr(644,root,root,755)
+%doc README.html COPYRIGHT Doc/Python3/
+%{_includedir}/python3*/CXX
+%{py3_sitescriptdir}/CXX*
+%{_datadir}/python3-%{modname}
+%{_npkgconfigdir}/Py3CXX.pc
+%endif
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..e227ab5
--- /dev/null
+++ b/python-pycxx-6.2.4-setup.py.patch
@@ -0,0 +1,85 @@
+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 -up cxx-code-280-trunk/CXX/setup.py.setup cxx-code-280-trunk/CXX/setup.py
+--- a/setup.py.setup	2013-06-18 13:20:30.000000000 -0500
++++ b/setup.py	2013-08-06 00:36:16.000000000 -0500
+@@ -1,12 +1,31 @@
+ 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):
+@@ -17,10 +36,25 @@ class my_install (install):
+         install.finalize_options (self)
+ 
+     def run (self):
+-        self.distribution.data_files = [("CXX", sources)]
++        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.4",
+@@ -29,7 +63,8 @@ setup (name             = "CXX",
+        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'}
+       )
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-pycxx.git/commitdiff/61a01712977dff35b583dd239e451a8c713e21ee



More information about the pld-cvs-commit mailing list