dev-python/quex: Adding quex - Lexican Analyzer Generator
authorTupone Alfredo <tupone@gentoo.org>
Thu, 14 Dec 2017 20:53:02 +0000 (21:53 +0100)
committerTupone Alfredo <tupone@gentoo.org>
Thu, 14 Dec 2017 20:53:51 +0000 (21:53 +0100)
Package-Manager: Portage-2.3.13, Repoman-2.3.3

dev-python/quex/Manifest [new file with mode: 0644]
dev-python/quex/files/quex-0.65.4-gentoo.patch [new file with mode: 0644]
dev-python/quex/metadata.xml [new file with mode: 0644]
dev-python/quex/quex-0.65.4.ebuild [new file with mode: 0644]

diff --git a/dev-python/quex/Manifest b/dev-python/quex/Manifest
new file mode 100644 (file)
index 0000000..28b6c40
--- /dev/null
@@ -0,0 +1 @@
+DIST quex-0.65.4.tar.gz 2202154 BLAKE2B 6b273998c9641aeee458291245a4fb956b5fe9b66d8c42f0c1d9b360a4d171c830a1d487bcbab9ccea49d10b7532ed488ce66dc165f31cce9521f97c5a4575f4 SHA512 0b11d7e5c5165674626fbbe7f54853656c579c63b78bd2fef2f5a9b316171dc647812d9a37df4e7c49c05de11a307b6425089f4ab281affb6c03a9cf09e2a035
diff --git a/dev-python/quex/files/quex-0.65.4-gentoo.patch b/dev-python/quex/files/quex-0.65.4-gentoo.patch
new file mode 100644 (file)
index 0000000..cbe161a
--- /dev/null
@@ -0,0 +1,43 @@
+--- quex-0.65.4/quex-exe.py.old        2017-12-13 21:42:48.633280478 +0100
++++ quex-0.65.4/quex-exe.py    2017-12-13 21:43:02.066040530 +0100
+@@ -40,11 +40,6 @@
+     print("error: Please, use Python versions 2.x.")
+     sys.exit(-1)
+ 
+-if os.environ.has_key("QUEX_PATH") == False:
+-    print("Environment variable QUEX_PATH has not been defined.")
+-else:
+-    sys.path.insert(0, os.environ["QUEX_PATH"])
+-
+ try:
+     exception_checker.do_on_import(sys.argv)
+     import quex.DEFINITIONS
+--- quex-0.65.4/quex/DEFINITIONS.py.old        2017-12-13 21:48:52.887765325 +0100
++++ quex-0.65.4/quex/DEFINITIONS.py    2017-12-13 21:52:29.805877359 +0100
+@@ -23,7 +23,7 @@
+ QUEX_VERSION = '0.65.4'
+ 
+ try:
+-    QUEX_INSTALLATION_DIR = os.environ["QUEX_PATH"]
++    QUEX_INSTALLATION_DIR = "@PYTHON_SITEDIR@"
+     # Note, that windows can also deal with backslashes.
+     QUEX_INSTALLATION_DIR = QUEX_INSTALLATION_DIR.replace("\\", "/")
+ except:
+@@ -49,15 +49,14 @@
+     sys.exit(-1) # sys.exit(-1) is acceptable
+ 
+ QUEX_PATH          = QUEX_INSTALLATION_DIR
+-QUEX_CODEC_DB_PATH = QUEX_PATH + "/quex/engine/codec_db/database"
++QUEX_CODEC_DB_PATH = "/usr/share/quex/database"
+ 
+-sys.path.insert(0, QUEX_INSTALLATION_DIR)
+ 
+ def check():
+     global QUEX_INSTALLATION_DIR
+ 
+     # -- Try to acces the file 'quex-exe.py' in order to verify
+-    if os.access(QUEX_INSTALLATION_DIR + "/quex-exe.py", os.F_OK) == False:
++    if False:
+         print "error: Environment variable 'QUEX_PATH' does not point to"
+         print "error: a valid installation directory of quex."
+         print "error: current setting of 'QUEX_PATH':"
diff --git a/dev-python/quex/metadata.xml b/dev-python/quex/metadata.xml
new file mode 100644 (file)
index 0000000..7500e5f
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="project">
+               <email>python@gentoo.org</email>
+       </maintainer>
+       <maintainer type="person">
+               <email>tupone@gentoo.org</email>
+               <name>Tupone Alfredo</name>
+       </maintainer>
+       <longdescription lang="en">
+               It is:
+               a tool to generate lexical analyzers. A lexical analyzer is a program
+               that transforms a stream of characters into a stream of
+               'atomic chunks of meaning', so called tokens.
+               
+               It does:
+               generate directly coded lexical analyzers, rather than table based
+               engines.
+               respond to queries on Unicode properties and regular expressions on the
+               command line.
+               generate state transition graphs of the generated engines.
+       </longdescription>
+</pkgmetadata>
diff --git a/dev-python/quex/quex-0.65.4.ebuild b/dev-python/quex/quex-0.65.4.ebuild
new file mode 100644 (file)
index 0000000..0bf833a
--- /dev/null
@@ -0,0 +1,44 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit python-single-r1
+
+DESCRIPTION="Mode Oriented Directly Coded Lexical Analyser Generator"
+HOMEPAGE="http://quex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="${PYTHON_DEPS}"
+RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}"/${P}-gentoo.patch )
+
+src_prepare() {
+       default
+       sed -i \
+               -e "s:@PYTHON_SITEDIR@:$(python_get_sitedir):g" \
+               quex/DEFINITIONS.py || die
+       mv quex/engine/codec_db/database . || die
+}
+
+src_install() {
+       default
+       insinto /usr/share/quex
+       doins -r database
+       dosym $(python_get_sitedir)/quex/code_base /usr/include/quex/code_base
+
+       python_domodule quex
+       python_newexe quex-exe.py quex
+       doman manpage/quex.1
+       dodoc -r demo
+}