14
0
forked from pool/python-pycxx

- Initial package, used by pysvn

- Apply patches from Fedora:
  * python-pycxx-7.0.3-python37.patch
  * python-pycxx-7.0.3-change-include-paths.patch
  * python-pycxx-7.0.3-setup.py.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pycxx?expand=0&rev=1
This commit is contained in:
Tomáš Chvátal
2018-08-09 07:49:40 +00:00
committed by Git OBS Bridge
commit bcf4546736
8 changed files with 274 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

3
pycxx-7.0.3.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:33ac7eb5fd41688cb206da89bac1fa06704116e7e632468c69d72b799a138afa
size 148813

View File

@@ -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

View File

@@ -0,0 +1,48 @@
diff --git a/CXX/Python2/IndirectPythonInterface.hxx b/CXX/Python2/IndirectPythonInterface.hxx
index e2ee725..1c7cc24 100644
--- a/CXX/Python2/IndirectPythonInterface.hxx
+++ b/CXX/Python2/IndirectPythonInterface.hxx
@@ -153,7 +153,7 @@ int &_Py_VerboseFlag();
void _XINCREF( PyObject *op );
void _XDECREF( PyObject *op );
-char *__Py_PackageContext();
+const char *__Py_PackageContext();
}
#endif // __CXX_INDIRECT_PYTHON_INTERFACE__HXX__
diff --git a/CXX/Python3/IndirectPythonInterface.hxx b/CXX/Python3/IndirectPythonInterface.hxx
index 6163536..9807b2e 100644
--- a/CXX/Python3/IndirectPythonInterface.hxx
+++ b/CXX/Python3/IndirectPythonInterface.hxx
@@ -149,7 +149,7 @@ int &_Py_UnicodeFlag();
void _XINCREF( PyObject *op );
void _XDECREF( PyObject *op );
-char *__Py_PackageContext();
+const char *__Py_PackageContext();
};
#endif // __CXX_INDIRECT_PYTHON_INTERFACE__HXX__
diff --git a/Src/IndirectPythonInterface.cxx b/Src/IndirectPythonInterface.cxx
index de0ca7f..b7d7d9e 100644
--- a/Src/IndirectPythonInterface.cxx
+++ b/Src/IndirectPythonInterface.cxx
@@ -348,7 +348,7 @@ PyTypeObject *_CObject_Type() { return ptr__CObject_Type; }
PyTypeObject *_Bytes_Type() { return ptr__Bytes_Type; }
#endif
-char *__Py_PackageContext() { return *ptr__Py_PackageContext; }
+const char *__Py_PackageContext() { return *ptr__Py_PackageContext; }
//
@@ -468,7 +468,7 @@ int &_Py_InteractiveFlag() { return Py_InteractiveFlag; }
int &_Py_OptimizeFlag() { return Py_OptimizeFlag; }
int &_Py_NoSiteFlag() { return Py_NoSiteFlag; }
int &_Py_VerboseFlag() { return Py_VerboseFlag; }
-char *__Py_PackageContext() { return _Py_PackageContext; }
+const char *__Py_PackageContext() { return _Py_PackageContext; }
//
// Needed to keep the abstactions for delayload interface

View File

@@ -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
--- a/setup.py
+++ b/setup.py
@@ -1,13 +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 +35,26 @@ 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)
+
+
# read the version from the master file CXX/Version.hxx
v_maj = None
v_min = None
@@ -43,7 +77,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'}
)

9
python-pycxx.changes Normal file
View File

@@ -0,0 +1,9 @@
-------------------------------------------------------------------
Thu Aug 9 07:21:40 UTC 2018 - tchvatal@suse.com
- Initial package, used by pysvn
- Apply patches from Fedora:
* python-pycxx-7.0.3-python37.patch
* python-pycxx-7.0.3-change-include-paths.patch
* python-pycxx-7.0.3-setup.py.patch

77
python-pycxx.spec Normal file
View File

@@ -0,0 +1,77 @@
#
# spec file for package python
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%global modname pycxx
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-%{modname}
Version: 7.0.3
Release: 0
Summary: Python extensions in C++
License: BSD-3-Clause
Group: Development/Libraries/Python
URL: http://CXX.sourceforge.net/
# SVN version contains updates for Python3
Source0: http://downloads.sourceforge.net/cxx/%{modname}-%{version}.tar.gz
Patch0: python-pycxx-7.0.3-python37.patch
Patch1: python-pycxx-7.0.3-change-include-paths.patch
Patch2: python-pycxx-7.0.3-setup.py.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: gcc-c++
BuildRequires: python-rpm-macros
BuildArch: noarch
%python_subpackages
%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: Development files for %{modname} applications
Group: Development/Libraries/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++.
%prep
%setup -q -n %{modname}-%{version}
%autopatch -p1
%build
%python_build
%install
%python_install
%files %{python_files devel}
%license COPYRIGHT
%doc README.html
%python2_only %doc Doc/Python2/
%python3_only %doc Doc/Python3/
%{python_sitelib}/CXX*
%python2_only %{_datadir}/python%{python2_bin_suffix}
%python3_only %{_datadir}/python%{python3_bin_suffix}
%python2_only %{_includedir}/python%{python2_bin_suffix}/
%python3_only %{_includedir}/python%{python3_bin_suffix}m/
%changelog