Przeglądaj źródła

python-pycparser: new package

From the README:

pycparser is a parser for the C language, written in pure Python. It is a
module designed to be easily integrated into applications that need to parse
C source code.

This depends on python-ply, which is in PR #1956

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
Jeffery To 9 lat temu
rodzic
commit
168975c82d

+ 52
- 0
lang/python-pycparser/Makefile Wyświetl plik

@@ -0,0 +1,52 @@
1
+#
2
+# Copyright (C) 2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=pycparser
11
+PKG_VERSION:=2.14
12
+PKG_RELEASE:=1
13
+
14
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15
+PKG_SOURCE_URL:=https://pypi.python.org/packages/source/p/pycparser
16
+PKG_MD5SUM:=a2bc8d28c923b4fe2b2c3b4b51a4f935
17
+
18
+PKG_BUILD_DEPENDS:=python python-setuptools
19
+
20
+PKG_LICENSE:=BSD-3-Clause
21
+PKG_LICENSE_FILES:=LICENSE
22
+PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
23
+
24
+include $(INCLUDE_DIR)/package.mk
25
+$(call include_mk, python-package.mk)
26
+
27
+define Package/python-pycparser
28
+	SECTION:=lang
29
+	CATEGORY:=Languages
30
+	SUBMENU:=Python
31
+	TITLE:=python-pycparser
32
+	URL:=https://github.com/eliben/pycparser
33
+	DEPENDS:=+python-light +python-ply
34
+endef
35
+
36
+define Package/python-pycparser/description
37
+pycparser is a parser for the C language, written in pure Python. It is a
38
+module designed to be easily integrated into applications that need to parse
39
+C source code.
40
+endef
41
+
42
+define PyPackage/python-pycparser/filespec
43
++|$(PYTHON_PKG_DIR)
44
+-|$(PYTHON_PKG_DIR)/pycparser/ply
45
+endef
46
+
47
+define Build/Compile
48
+	$(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
49
+endef
50
+
51
+$(eval $(call PyPackage,python-pycparser))
52
+$(eval $(call BuildPackage,python-pycparser))

+ 41
- 0
lang/python-pycparser/patches/001-use-external-ply.patch Wyświetl plik

@@ -0,0 +1,41 @@
1
+diff --git a/pycparser/c_lexer.py b/pycparser/c_lexer.py
2
+index cbb9d26..cbd7742 100644
3
+--- a/pycparser/c_lexer.py
4
++++ b/pycparser/c_lexer.py
5
+@@ -9,8 +9,8 @@
6
+ import re
7
+ import sys
8
+ 
9
+-from .ply import lex
10
+-from .ply.lex import TOKEN
11
++from ply import lex
12
++from ply.lex import TOKEN
13
+ 
14
+ 
15
+ class CLexer(object):
16
+diff --git a/pycparser/c_parser.py b/pycparser/c_parser.py
17
+index f4f7453..5c0ca88 100644
18
+--- a/pycparser/c_parser.py
19
++++ b/pycparser/c_parser.py
20
+@@ -8,7 +8,7 @@
21
+ #------------------------------------------------------------------------------
22
+ import re
23
+ 
24
+-from .ply import yacc
25
++from ply import yacc
26
+ 
27
+ from . import c_ast
28
+ from .c_lexer import CLexer
29
+diff --git a/setup.py b/setup.py
30
+index fdccbb3..036a10b 100644
31
+--- a/setup.py
32
++++ b/setup.py
33
+@@ -49,7 +49,7 @@ setup(
34
+     classifiers = [
35
+         'Programming Language :: Python :: 2',
36
+         'Programming Language :: Python :: 3',],
37
+-    packages=['pycparser', 'pycparser.ply'],
38
++    packages=['pycparser'],
39
+     package_data={'pycparser': ['*.cfg']},
40
+     cmdclass={'install': install, 'sdist': sdist},
41
+ )