2009-03-06 Laszlo (Laca) Peter <
[email protected]>
* SUNWpython24-ctypes.spec: (new) ctypes Python module for Python 2.4
* copyright/SUNWpython24-ctypes.copyright: (new) copyright file for the
above
* patches/python-ctypes-02-util-find-library.diff,
patches/python-ctypes-01-ffitarget.diff: (new) patches matching those
applied against the 2.5 and 2.6 code
--- a/ChangeLog Wed Mar 04 14:10:37 2009 +0000
+++ b/ChangeLog Fri Mar 06 08:27:12 2009 +0000
@@ -1,3 +1,12 @@
+2009-03-06 Laszlo (Laca) Peter <[email protected]>
+
+ * SUNWpython24-ctypes.spec: (new) ctypes Python module for Python 2.4
+ * copyright/SUNWpython24-ctypes.copyright: (new) copyright file for the
+ above
+ * patches/python-ctypes-02-util-find-library.diff,
+ patches/python-ctypes-01-ffitarget.diff: (new) patches matching those
+ applied against the 2.5 and 2.6 code
+
2009-03-04 Dave Lin <[email protected]>
(Ported Jim's fix of doo6790 from trunk)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SUNWpython24-ctypes.spec Fri Mar 06 08:27:12 2009 +0000
@@ -0,0 +1,60 @@
+#
+# spec file for package SUNWpython24-ctypes
+#
+# includes module(s): python-ctypes
+#
+%include Solaris.inc
+
+%{?sf_download:#}%define sf_download http://downloads.sourceforge.net
+%define python_version 2.4
+
+Name: SUNWpython24-ctypes
+Summary: Python C data types
+URL: http://python.net/crew/theller/ctypes/
+Version: 1.0.2
+Source: %{sf_download}/ctypes/ctypes-1.0.2.tar.gz
+Patch1: python-ctypes-01-ffitarget.diff
+Patch2: python-ctypes-02-util-find-library.diff
+SUNW_BaseDir: %{_basedir}
+SUNW_Copyright: %{name}.copyright
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%include default-depend.inc
+BuildRequires: SUNWPython-devel
+BuildRequires: SUNWlibffi-devel
+Requires: SUNWPython
+Requires: SUNWlibffi
+
+%prep
+%setup -q -n ctypes-%{version}
+%patch1 -p1
+%patch2 -p1
+
+%build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+python setup.py install --root=$RPM_BUILD_ROOT --prefix=%{_prefix} --no-compile
+
+# move to vendor-packages
+mkdir -p $RPM_BUILD_ROOT%{_libdir}/python%{python_version}/vendor-packages
+mv $RPM_BUILD_ROOT%{_libdir}/python%{python_version}/site-packages/* \
+ $RPM_BUILD_ROOT%{_libdir}/python%{python_version}/vendor-packages/
+rmdir $RPM_BUILD_ROOT%{_libdir}/python%{python_version}/site-packages
+
+%{?pkgbuild_postprocess: %pkgbuild_postprocess -v -c "%{version}:%{jds_version}:%{name}:$RPM_ARCH:%(date +%%Y-%%m-%%d):%{support_level}" $RPM_BUILD_ROOT}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr (-, root, bin)
+%dir %attr (0755, root, bin) %{_libdir}
+%{_libdir}/python%{python_version}/vendor-packages/
+
+%changelog
+* Fri Feb 20 2009 - Ke Wang <[email protected]>
+- Added patch2 for find_library in util.py
+* Wed Jan 21 2009 - Brian Cameron <[email protected]>
+- Created with version 1.0.2.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/copyright/SUNWpython24-ctypes.copyright Fri Mar 06 08:27:12 2009 +0000
@@ -0,0 +1,20 @@
+ Copyright (c) 2000 - 2006 Thomas Heller
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/python-ctypes-01-ffitarget.diff Fri Mar 06 08:27:12 2009 +0000
@@ -0,0 +1,26 @@
+--- ctypes-1.0.2/source/libffi/src/x86/ffitarget.h-orig 2009-01-21 04:16:39.423661000 -0600
++++ ctypes-1.0.2/source/libffi/src/x86/ffitarget.h 2009-01-21 04:17:10.942637000 -0600
+@@ -51,10 +51,10 @@ typedef enum ffi_abi {
+ #endif
+
+ /* ---- Intel x86 and AMD x86-64 - */
+-#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__))
++#if !defined(X86_WIN32) && (defined(__i386__) || defined (__i386) || defined(__x86_64__))
+ FFI_SYSV,
+ FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */
+-#ifdef __i386__
++#if defined (__i386__) || defined (__i386)
+ FFI_DEFAULT_ABI = FFI_SYSV,
+ #else
+ FFI_DEFAULT_ABI = FFI_UNIX64,
+--- ctypes-1.0.2/source/callproc.c.alloca 2008-06-05 23:48:27.578970813 +1200
++++ ctypes-1.0.2/source/callproc.c 2008-06-05 23:48:41.677662640 +1200
+@@ -73,6 +73,8 @@
+ #include <malloc.h>
+ #endif
+
++#include <alloca.h>
++
+ #include <ffi.h>
+ #include "ctypes.h"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/python-ctypes-02-util-find-library.diff Fri Mar 06 08:27:12 2009 +0000
@@ -0,0 +1,74 @@
+--- ctypes-1.0.2/ctypes/util.py.orig 2009-02-19 18:03:24.380668000 +0800
++++ ctypes-1.0.2/ctypes/util.py 2009-02-20 10:33:42.945817000 +0800
+@@ -66,15 +66,26 @@
+ return None
+ return res.group(0)
+
+- def _get_soname(f):
+- # assuming GNU binutils / ELF
+- if not f:
+- return None
+- cmd = "objdump -p -j .dynamic 2>/dev/null " + f
+- res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
+- if not res:
+- return None
+- return res.group(1)
++ if sys.platform == "sunos5":
++ # use /usr/ccs/bin/dump on solaris
++ def _get_soname(f):
++ if not f:
++ return None
++ cmd = "/usr/ccs/bin/dump -Lpv 2>/dev/null " + f
++ res = re.search(r'\[.*\]\sSONAME\s+([^\s]+)', os.popen(cmd).read())
++ if not res:
++ return None
++ return res.group(1)
++ else:
++ def _get_soname(f):
++ # assuming GNU binutils / ELF
++ if not f:
++ return None
++ cmd = "objdump -p -j .dynamic 2>/dev/null " + f
++ res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
++ if not res:
++ return None
++ return res.group(1)
+
+ if (sys.platform.startswith("freebsd")
+ or sys.platform.startswith("openbsd")
+@@ -101,6 +112,35 @@
+ res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y)))
+ return res[-1]
+
++ elif sys.platform == "sunos5":
++
++ def _findLib_crle(name, is64):
++ if not os.path.exists('/usr/bin/crle'):
++ return None
++
++ if is64:
++ cmd = 'env LC_ALL=C /usr/bin/crle -64 2>/dev/null'
++ else:
++ cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null'
++
++ for line in os.popen(cmd).readlines():
++ line = line.strip()
++ if (line.startswith('Default Library Path (ELF):')):
++ paths = line.split()[4]
++
++ if not paths:
++ return None
++
++ for dir in paths.split(":"):
++ libfile = os.path.join(dir, "lib%s.so" % name)
++ if os.path.exists(libfile):
++ return libfile
++
++ return None
++
++ def find_library(name, is64 = False):
++ return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
++
+ else:
+
+ def _findLib_ldconfig(name):