[57571] trunk/dports/python
afb at macports.org
afb at macports.org
Sun Sep 13 03:53:52 PDT 2009
Revision: 57571
http://trac.macports.org/changeset/57571
Author: afb at macports.org
Date: 2009-09-13 03:53:51 -0700 (Sun, 13 Sep 2009)
Log Message:
-----------
new port: PylibLZMA, backported to python25
Modified Paths:
--------------
trunk/dports/python/py25-liblzma/Portfile
Added Paths:
-----------
trunk/dports/python/py25-liblzma/
trunk/dports/python/py25-liblzma/files/
trunk/dports/python/py25-liblzma/files/pyliblzma-python25.diff
Property changes on: trunk/dports/python/py25-liblzma
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: trunk/dports/python/py25-liblzma/Portfile
===================================================================
--- trunk/dports/python/py-lzma/Portfile 2009-01-30 06:52:23 UTC (rev 46143)
+++ trunk/dports/python/py25-liblzma/Portfile 2009-09-13 10:53:51 UTC (rev 57571)
@@ -1,29 +1,21 @@
# $Id$
PortSystem 1.0
-PortGroup python24 1.0
+PortGroup python25 1.0
-name py-lzma
-version 0.0.3
-revision 1
+name py25-liblzma
+version 0.5.2
categories python archivers
platforms darwin
-maintainers nomaintainer
-description Python bindings for the LZMA compression library.
+maintainers afb openmaintainer
+description Python bindings for the XZ Utils compression library.
long_description ${description}
-homepage http://www.joachim-bauch.de/projects/python/pylzma/
-master_sites ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/
-distname pylzma-${version}
-checksums md5 312416b2cdf6f4b82ec8fc7a816f74a4
+homepage https://launchpad.net/pyliblzma
+master_sites http://pypi.python.org/packages/source/p/pyliblzma/
+use_bzip2 yes
+distname pyliblzma-${version}
+checksums md5 8e5596bc60e784c74f10e94820655336
-test.run no
-test.dir ${worksrcpath}/tests
-test.cmd "ln -s ../build/lib*/pylzma.so && ln -s ../build/lib*/py7zlib.py . && ${python.bin} testall.py"
-test.target
-
-post-destroot {
- xinstall -m 644 -W ${worksrcpath} LICENSE.txt readme.txt version.txt \
- ${destroot}${prefix}/share/doc/${name}
-}
-
+depends_build port:py-setuptools port:liblzma
+patchfiles pyliblzma-python25.diff
Added: trunk/dports/python/py25-liblzma/files/pyliblzma-python25.diff
===================================================================
--- trunk/dports/python/py25-liblzma/files/pyliblzma-python25.diff (rev 0)
+++ trunk/dports/python/py25-liblzma/files/pyliblzma-python25.diff 2009-09-13 10:53:51 UTC (rev 57571)
@@ -0,0 +1,369 @@
+diff -u pyliblzma-0.5.2.orig/liblzma.h pyliblzma-0.5.2/liblzma.h
+--- liblzma.h 2009-01-26 01:51:17.000000000 +0100
++++ liblzma.h 2009-03-02 10:29:20.000000000 +0100
+@@ -6,6 +6,15 @@
+ */
+ #define PY_SSIZE_T_CLEAN 1
+ #include <Python.h>
++#if PY_VERSION_HEX >= 0x020600F0
++#define USE_PYBUFFER 1
++#define USE_USECOUNT 1
++#else
++#define Py_TYPE(op) (op)->ob_type
++#define PyOS_stricmp strcasecmp
++#define USE_PYBUFFER 0
++#define USE_USECOUNT 0
++#endif
+ #include <stdio.h>
+ #include <stdlib.h>
+ #if defined (__APPLE__) || defined(__FreeBSD__) || \
+@@ -49,5 +58,5 @@
+
+ #define INITCHECK if (!self->is_initialised) { PyErr_Format(PyExc_RuntimeError, "%s object not initialised!", self->ob_type->tp_name); return NULL; }
+
+-PyObject *module;
++extern PyObject *module;
+ #endif /* LIBLZMA_H */
+diff -u pyliblzma-0.5.2.orig/liblzma.c pyliblzma-0.5.2/liblzma.c
+--- liblzma.c 2009-01-26 04:09:27.000000000 +0100
++++ liblzma.c 2009-03-02 10:30:19.000000000 +0100
+@@ -4,6 +4,8 @@
+ #include "liblzma_options.h"
+ #include "liblzma_util.h"
+
++PyObject *module = NULL;
++
+ static const char __author__[] =
+ "The lzma python module was written by:\n\
+ \n\
+@@ -20,7 +22,9 @@
+ LZMA_compress(__attribute__((unused)) PyObject *self, PyObject *args, PyObject *kwargs)
+ {
+ PyObject *ret = NULL, *options_dict = NULL;
++#if USE_PYBUFFER
+ Py_buffer pdata;
++#endif
+ uint8_t *data;
+ Py_ssize_t datasize, bufsize;
+ lzma_ret lzuerror;
+@@ -31,16 +35,24 @@
+
+ static char *kwlist[] = {"input", "options", NULL};
+
++#if USE_PYBUFFER
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|O:compress", kwlist,
+ &pdata, &options_dict))
+ return NULL;
++#else
++ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:compress", kwlist,
++ (char **) &data, &datasize, &options_dict))
++ return NULL;
++#endif
+
+ filters[0].options = &options;
+ if(!init_lzma_options("compress", options_dict, filters))
+ return NULL;
+
++#if USE_PYBUFFER
+ data = pdata.buf;
+ datasize = pdata.len;
++#endif
+
+ lzma_stream tmp = LZMA_STREAM_INIT;
+ *lzus = tmp;
+@@ -85,14 +97,18 @@
+ _PyString_Resize(&ret, (Py_ssize_t)lzus->total_out);
+ }
+
++#if USE_PYBUFFER
+ PyBuffer_Release(&pdata);
++#endif
+ return ret;
+
+ error:
+ if(lzuerror != LZMA_MEM_ERROR && lzuerror != LZMA_PROG_ERROR)
+ lzma_end(lzus);
+ Py_XDECREF(ret);
++#if USE_PYBUFFER
+ PyBuffer_Release(&pdata);
++#endif
+ return NULL;
+ }
+
+@@ -110,7 +126,9 @@
+ LZMA_decompress(__attribute__((unused)) PyObject *self, PyObject *args, PyObject *kwargs)
+ {
+ PyObject *ret = NULL;
++#if USE_PYBUFFER
+ Py_buffer pdata;
++#endif
+ uint8_t *data;
+ Py_ssize_t datasize, bufsize = SMALLCHUNK;
+ uint64_t memlimit = -1;
+@@ -120,20 +138,30 @@
+
+ static char *kwlist[] = {"input", "bufsize", "memlimit", NULL};
+
++#if USE_PYBUFFER
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|lK:decompress", kwlist,
+ &pdata, &bufsize, &memlimit))
+ return NULL;
+ data = pdata.buf;
+ datasize = pdata.len;
++#else
++ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|lK:decompress", kwlist,
++ (char **) &data, &datasize, &memlimit))
++ return NULL;
++#endif
+
+ if (datasize == 0) {
++#if USE_PYBUFFER
+ PyBuffer_Release(&pdata);
++#endif
+ return PyString_FromString("");
+ }
+
+ ret = PyString_FromStringAndSize(NULL, bufsize);
+ if (!ret) {
++#if USE_PYBUFFER
+ PyBuffer_Release(&pdata);
++#endif
+ return NULL;
+ }
+
+@@ -170,7 +198,9 @@
+
+ _PyString_Resize(&ret, (Py_ssize_t)lzus->total_out);
+ lzma_end(lzus);
++#if USE_PYBUFFER
+ PyBuffer_Release(&pdata);
++#endif
+
+ return ret;
+
+@@ -178,7 +208,9 @@
+ if(lzuerror != LZMA_MEM_ERROR && lzuerror != LZMA_PROG_ERROR)
+ lzma_end(lzus);
+ Py_XDECREF(ret);
++#if USE_PYBUFFER
+ PyBuffer_Release(&pdata);
++#endif
+ return NULL;
+ }
+
+diff -u pyliblzma-0.5.2.orig/liblzma_compressobj.c pyliblzma-0.5.2/liblzma_compressobj.c
+--- liblzma_compressobj.c 2009-01-26 04:10:37.000000000 +0100
++++ liblzma_compressobj.c 2009-03-02 10:36:14.000000000 +0100
+@@ -14,7 +14,9 @@
+ static PyObject *
+ LZMAComp_compress(LZMACompObject *self, PyObject *args)
+ {
++#if USE_PYBUFFER
+ Py_buffer pdata;
++#endif
+ Py_ssize_t datasize, bufsize = SMALLCHUNK;
+ uint8_t *data;
+ uint64_t start_total_out;
+@@ -23,10 +25,15 @@
+ lzma_ret lzuerror;
+
+ INITCHECK
++#if USE_PYBUFFER
+ if (!PyArg_ParseTuple(args, "s*:compress", &pdata))
+ return NULL;
+ data = pdata.buf;
+ datasize = pdata.len;
++#else
++ if (!PyArg_ParseTuple(args, "s#:compress", (char **) &data, &datasize))
++ return NULL;
++#endif
+
+ ACQUIRE_LOCK(self);
+ if (!self->running) {
+@@ -62,12 +69,16 @@
+ _PyString_Resize(&ret, (Py_ssize_t)lzus->total_out - (Py_ssize_t)start_total_out);
+
+ RELEASE_LOCK(self);
++#if USE_PYBUFFER
+ PyBuffer_Release(&pdata);
++#endif
+ return ret;
+
+ error:
+ RELEASE_LOCK(self);
++#if USE_PYBUFFER
+ PyBuffer_Release(&pdata);
++#endif
+ Py_XDECREF(ret);
+ return NULL;
+ }
+@@ -358,5 +369,7 @@
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
++#if PY_VERSION_HEX >= 0x020600F0 /* Added in version 2.6 */
+ 0 /*tp_version_tag*/
++#endif
+ };
+diff -u pyliblzma-0.5.2.orig/liblzma_decompressobj.c pyliblzma-0.5.2/liblzma_decompressobj.c
+--- liblzma_decompressobj.c 2009-01-26 04:10:51.000000000 +0100
++++ liblzma_decompressobj.c 2009-03-02 10:36:33.000000000 +0100
+@@ -16,7 +16,9 @@
+ static PyObject *
+ LZMADecomp_decompress(LZMADecompObject *self, PyObject *args, PyObject *kwargs)
+ {
++#if USE_PYBUFFER
+ Py_buffer pdata;
++#endif
+ Py_ssize_t datasize, oldbufsize, bufsize = SMALLCHUNK;
+ uint8_t *data;
+ uint64_t start_total_out;
+@@ -26,11 +28,17 @@
+ static char *kwlist[] = {"data", "max_length", NULL};
+
+ INITCHECK
++#if USE_PYBUFFER
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|l:decompress", kwlist,
+ &pdata, &self->max_length))
+ return NULL;
+ data = pdata.buf;
+ datasize = pdata.len;
++#else
++ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|l:decompress", kwlist,
++ (char **) &data, &datasize, &self->max_length))
++ return NULL;
++#endif
+
+ ACQUIRE_LOCK(self);
+ if (!self->running) {
+@@ -121,12 +129,16 @@
+ _PyString_Resize(&ret, (Py_ssize_t)lzus->total_out - (Py_ssize_t)start_total_out);
+
+ RELEASE_LOCK(self);
++#if USE_PYBUFFER
+ PyBuffer_Release(&pdata);
++#endif
+ return ret;
+
+ error:
+ RELEASE_LOCK(self);
++#if USE_PYBUFFER
+ PyBuffer_Release(&pdata);
++#endif
+ Py_XDECREF(ret);
+ return NULL;
+ }
+@@ -434,5 +446,7 @@
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
++#if PY_VERSION_HEX >= 0x020600F0 /* Added in version 2.6 */
+ 0 /*tp_version_tag*/
++#endif
+ };
+diff -u pyliblzma-0.5.2.orig/liblzma_fileobj.c pyliblzma-0.5.2/liblzma_fileobj.c
+--- liblzma_fileobj.c 2009-01-26 04:10:09.000000000 +0100
++++ liblzma_fileobj.c 2009-03-02 10:36:41.000000000 +0100
+@@ -314,15 +314,22 @@
+ LZMAFile_write(LZMAFileObject *self, PyObject *args)
+ {
+ PyObject *ret = NULL;
++#if USE_PYBUFFER
+ Py_buffer pbuf;
++#endif
+ char *buf;
+ Py_ssize_t len;
+ lzma_ret lzuerror;
+
++#if USE_PYBUFFER
+ if (!PyArg_ParseTuple(args, "s*:write", &pbuf))
+ return NULL;
+ buf = pbuf.buf;
+ len = pbuf.len;
++#else
++ if (!PyArg_ParseTuple(args, "s#:write", &buf, &len))
++ return NULL;
++#endif
+
+ ACQUIRE_LOCK(self);
+ switch (self->mode) {
+@@ -358,7 +365,9 @@
+ ret = Py_None;
+
+ cleanup:
++#if USE_PYBUFFER
+ PyBuffer_Release(&pbuf);
++#endif
+ RELEASE_LOCK(self);
+ return ret;
+ }
+@@ -596,7 +605,9 @@
+ /* we cannot move back, so rewind the stream */
+ lzma_close_real(&lzuerror, self->fp);
+ if (self->fp) {
++#if USE_USECOUNT
+ PyFile_DecUseCount((PyFileObject *)self->file);
++#endif
+ self->fp = NULL;
+ }
+ if (lzuerror != LZMA_OK) {
+@@ -611,8 +622,10 @@
+ self->pos = 0;
+ self->fp = lzma_open_real(&lzuerror, self->filters, PyFile_AsFile(self->file), self->memlimit);
+
++#if USE_USECOUNT
+ if (self->fp)
+ PyFile_IncUseCount((PyFileObject *)self->file);
++#endif
+ if (lzuerror != LZMA_OK) {
+ Util_CatchLZMAError(lzuerror, &self->fp->strm, self->fp->encoding);
+ goto cleanup;
+@@ -704,7 +717,9 @@
+ ACQUIRE_LOCK(self);
+ lzma_close_real(&lzuerror, self->fp);
+ if (self->fp) {
++#if USE_USECOUNT
+ PyFile_DecUseCount((PyFileObject *)self->file);
++#endif
+ self->fp = NULL;
+ }
+ self->mode = MODE_CLOSED;
+@@ -931,7 +946,9 @@
+ Util_CatchLZMAError(lzuerror, &self->fp->strm, self->fp->encoding);
+ goto error;
+ }
++#if USE_USECOUNT
+ PyFile_IncUseCount((PyFileObject *)self->file);
++#endif
+
+ self->mode = self->filters[0].options ? MODE_WRITE : MODE_READ;
+
+@@ -958,7 +975,9 @@
+ #endif
+ lzma_close_real(&lzuerror, self->fp);
+ if (self->fp) {
++#if USE_USECOUNT
+ PyFile_DecUseCount((PyFileObject *)self->file);
++#endif
+ self->fp = NULL;
+ }
+ Util_DropReadAhead(self);
+@@ -1073,5 +1092,7 @@
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
++#if PY_VERSION_HEX >= 0x020600F0 /* Added in version 2.6 */
+ 0 /*tp_version_tag*/
++#endif
+ };
+diff -u pyliblzma-0.5.2.orig/liblzma_options.c pyliblzma-0.5.2/liblzma_options.c
+--- liblzma_options.c 2009-01-26 03:05:57.000000000 +0100
++++ liblzma_options.c 2009-03-02 10:37:02.000000000 +0100
+@@ -460,5 +460,7 @@
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
++#if PY_VERSION_HEX >= 0x020600F0 /* Added in version 2.6 */
+ 0 /*tp_version_tag*/
++#endif
+ };
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090913/18b48013/attachment.html>
More information about the macports-changes
mailing list