diff options
Diffstat (limited to 'textproc')
-rw-r--r-- | textproc/libxml2/files/patch-python_drv-libxml2.py | 46 | ||||
-rw-r--r-- | textproc/libxml2/files/patch-python_setup.py.in | 142 | ||||
-rw-r--r-- | textproc/py3-libxml2/Makefile | 37 | ||||
-rw-r--r-- | textproc/py3-libxml2/pkg-descr | 3 | ||||
-rw-r--r-- | textproc/py3-libxml2/pkg-plist | 9 |
5 files changed, 237 insertions, 0 deletions
diff --git a/textproc/libxml2/files/patch-python_drv-libxml2.py b/textproc/libxml2/files/patch-python_drv-libxml2.py new file mode 100644 index 000000000..fbcc9e6ad --- /dev/null +++ b/textproc/libxml2/files/patch-python_drv-libxml2.py @@ -0,0 +1,46 @@ +From 6c9c611beed57f001ca3ae6b964518d9c7336a69 Mon Sep 17 00:00:00 2001 +From: Alexandre Rostovtsev <tetromino@gentoo.org> +Date: Thu, 11 Jul 2013 03:00:54 +0000 +Subject: python: fix drv_libxml2.py for python3 compatibility + +https://bugzilla.gnome.org/show_bug.cgi?id=703979 +--- +diff --git a/python/drv_libxml2.py b/python/drv_libxml2.py +index e43fb1d..c9075e6 100644 +--- python/drv_libxml2.py ++++ python/drv_libxml2.py +@@ -34,12 +34,20 @@ TODO + + """ + +-__author__ = u"Stéphane Bidoul <sbi@skynet.be>" ++__author__ = "Stéphane Bidoul <sbi@skynet.be>" + __version__ = "0.3" + ++import sys + import codecs +-from types import StringType, UnicodeType +-StringTypes = (StringType,UnicodeType) ++ ++if sys.version < "3": ++ __author__ = codecs.unicode_escape_decode(__author__)[0] ++ ++ from types import StringType, UnicodeType ++ StringTypes = (StringType,UnicodeType) ++ ++else: ++ StringTypes = (str) + + from xml.sax._exceptions import * + from xml.sax import xmlreader, saxutils +@@ -65,7 +73,7 @@ def _d(s): + + try: + import libxml2 +-except ImportError, e: ++except ImportError as e: + raise SAXReaderNotAvailable("libxml2 not available: " \ + "import error was: %s" % e) + +-- +cgit v0.9.2 diff --git a/textproc/libxml2/files/patch-python_setup.py.in b/textproc/libxml2/files/patch-python_setup.py.in new file mode 100644 index 000000000..72f7423a5 --- /dev/null +++ b/textproc/libxml2/files/patch-python_setup.py.in @@ -0,0 +1,142 @@ +--- python/setup.py.in.orig 2014-03-24 21:27:16.000000000 +0100 ++++ python/setup.py.in 2014-03-24 21:31:10.000000000 +0100 +@@ -67,7 +67,7 @@ + for dir in includes_dir: + if not missing(dir + "/libxml2/libxml/tree.h"): + xml_includes=dir + "/libxml2" +- break; ++ break; + + if xml_includes == "": + print("failed to find headers for libxml2: update includes_dir") +@@ -77,7 +77,7 @@ + for dir in includes_dir: + if not missing(dir + "/iconv.h"): + iconv_includes=dir +- break; ++ break; + + if iconv_includes == "": + print("failed to find headers for libiconv: update includes_dir") +@@ -90,22 +90,22 @@ + + xml_files = ["libxml2-api.xml", "libxml2-python-api.xml", + "libxml.c", "libxml.py", "libxml_wrap.h", "types.c", +- "xmlgenerator.py", "README", "TODO", "drv_libxml2.py"] ++ "xmlgenerator.py", "README", "TODO", "drv_libxml2.py"] + + xslt_files = ["libxslt-api.xml", "libxslt-python-api.xml", + "libxslt.c", "libxsl.py", "libxslt_wrap.h", +- "xsltgenerator.py"] ++ "xsltgenerator.py"] + + if missing("libxml2-py.c") or missing("libxml2.py"): + try: +- try: +- import xmlgenerator +- except: +- import generator ++ try: ++ import xmlgenerator ++ except: ++ import generator + except: +- print("failed to find and generate stubs for libxml2, aborting ...") +- print(sys.exc_info()[0], sys.exc_info()[1]) +- sys.exit(1) ++ print("failed to find and generate stubs for libxml2, aborting ...") ++ print(sys.exc_info()[0], sys.exc_info()[1]) ++ sys.exit(1) + + head = open("libxml.py", "r") + generated = open("libxml2class.py", "r") +@@ -116,7 +116,7 @@ + else: + result.write(line) + for line in generated.readlines(): +- result.write(line) ++ result.write(line) + head.close() + generated.close() + result.close() +@@ -126,39 +126,39 @@ + if missing("xsltgenerator.py") or missing("libxslt-api.xml"): + print("libxslt stub generator not found, libxslt not built") + else: +- try: +- import xsltgenerator +- except: +- print("failed to generate stubs for libxslt, aborting ...") +- print(sys.exc_info()[0], sys.exc_info()[1]) +- else: +- head = open("libxsl.py", "r") +- generated = open("libxsltclass.py", "r") +- result = open("libxslt.py", "w") +- for line in head.readlines(): ++ try: ++ import xsltgenerator ++ except: ++ print("failed to generate stubs for libxslt, aborting ...") ++ print(sys.exc_info()[0], sys.exc_info()[1]) ++ else: ++ head = open("libxsl.py", "r") ++ generated = open("libxsltclass.py", "r") ++ result = open("libxslt.py", "w") ++ for line in head.readlines(): + if WITHDLLS: + result.write(altImport(line)) + else: + result.write(line) +- for line in generated.readlines(): +- result.write(line) +- head.close() +- generated.close() +- result.close() +- with_xslt=1 ++ for line in generated.readlines(): ++ result.write(line) ++ head.close() ++ generated.close() ++ result.close() ++ with_xslt=1 + else: + with_xslt=1 + + if with_xslt == 1: + xslt_includes="" + for dir in includes_dir: +- if not missing(dir + "/libxslt/xsltconfig.h"): +- xslt_includes=dir + "/libxslt" +- break; ++ if not missing(dir + "/libxslt/xsltconfig.h"): ++ xslt_includes=dir + "/libxslt" ++ break; + + if xslt_includes == "": +- print("failed to find headers for libxslt: update includes_dir") +- with_xslt = 0 ++ print("failed to find headers for libxslt: update includes_dir") ++ with_xslt = 0 + + + descr = "libxml2 package" +@@ -198,7 +198,7 @@ + libraries=libs, define_macros=macros)] + if with_xslt == 1: + extens.append(Extension('libxsltmod', xslt_c_files, include_dirs=includes, +- library_dirs=libdirs, ++ library_dirs=libdirs, + libraries=libs, define_macros=macros)) + + if missing("MANIFEST"): +@@ -208,8 +208,8 @@ + for file in xml_files: + manifest.write(file + "\n") + if with_xslt == 1: +- for file in xslt_files: +- manifest.write(file + "\n") ++ for file in xslt_files: ++ manifest.write(file + "\n") + manifest.close() + + if WITHDLLS: diff --git a/textproc/py3-libxml2/Makefile b/textproc/py3-libxml2/Makefile new file mode 100644 index 000000000..53dba1635 --- /dev/null +++ b/textproc/py3-libxml2/Makefile @@ -0,0 +1,37 @@ +# Created by: Alexander Nedotsukov <bland@FreeBSD.org> +# $FreeBSD$ +# $MCom$ + +PORTREVISION= 0 +CATEGORIES= textproc gnome python +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= gnome@FreeBSD.org +COMMENT= Python interface for XML parser library for GNOME + +MASTERDIR= ${.CURDIR}/../libxml2 +BUILD_WRKSRC= ${WRKSRC}/python +INSTALL_WRKSRC= ${BUILD_WRKSRC} +DESCR= ${.CURDIR}/pkg-descr +PLIST= ${.CURDIR}/pkg-plist + +USE_GNOME+= libxml2 +USE_PYTHON= 3 +USE_PYDISTUTILS=yes +PYDISTUTILS_EGGINFO= libxml2_python-${PORTVERSION}-py${PYTHON_VER}.egg-info +PLIST_SUB+= PYTVER=${PYTHON_VER:S/.//} + +CPPFLAGS+= `${PYTHON_VERSION}-config --cflags` +LDFLAGS+= -L${LOCALBASE}/lib `${PYTHON_VERSION}-config --libs` +CONFIGURE_ARGS= --with-iconv=${ICONV_PREFIX} \ + --with-html-dir=${PREFIX}/share/doc \ + --with-html-subdir=${PORTNAME} \ + --with-python=${PYTHON_CMD} + +DOCSDIR= ${PREFIX}/share/doc/py-libxml2 +EXAMPLESDIR= ${PREFIX}/share/examples/py-libxml2 + +post-install: + @${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/libxml2mod.so + +.include "${MASTERDIR}/Makefile" diff --git a/textproc/py3-libxml2/pkg-descr b/textproc/py3-libxml2/pkg-descr new file mode 100644 index 000000000..afb7cf4dd --- /dev/null +++ b/textproc/py3-libxml2/pkg-descr @@ -0,0 +1,3 @@ +Python interface for XML parser library for GNOME + +WWW: http://xmlsoft.org/ diff --git a/textproc/py3-libxml2/pkg-plist b/textproc/py3-libxml2/pkg-plist new file mode 100644 index 000000000..bbda20c6d --- /dev/null +++ b/textproc/py3-libxml2/pkg-plist @@ -0,0 +1,9 @@ +%%PYTHON_SITELIBDIR%%/__pycache__/drv_libxml2.cpython-%%PYTVER%%.pyc +%%PYTHON_SITELIBDIR%%/__pycache__/drv_libxml2.cpython-%%PYTVER%%.pyo +%%PYTHON_SITELIBDIR%%/__pycache__/libxml2.cpython-%%PYTVER%%.pyc +%%PYTHON_SITELIBDIR%%/__pycache__/libxml2.cpython-%%PYTVER%%.pyo +%%PYTHON_SITELIBDIR%%/drv_libxml2.py +%%PYTHON_SITELIBDIR%%/libxml2.py +%%PYTHON_SITELIBDIR%%/libxml2mod.so +@dirrmtry %%PYTHON_SITELIBDIR%%/__pycache__ + |