Package init
This commit is contained in:
commit
a966aa6e1a
38
pycparser-0.91.1-remove-relative-sys-path.py
Normal file
38
pycparser-0.91.1-remove-relative-sys-path.py
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
'''
|
||||
pycparser examples all contain the following boiler plate code
|
||||
for running in tree. This script removes them:
|
||||
|
||||
# This is not required if you've installed pycparser into
|
||||
# your site-packages/ with setup.py
|
||||
#
|
||||
sys.path.extend(['.', '..'])
|
||||
'''
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
boiler_plate = "sys.path.extend(['.', '..'])\n"
|
||||
d = sys.argv[1]
|
||||
for (root, dirs, files) in os.walk(d):
|
||||
for i in files:
|
||||
if not i.endswith('.py'):
|
||||
continue
|
||||
fname = os.path.join(root, i)
|
||||
lines = open(fname).readlines()
|
||||
try:
|
||||
start = lines.index(boiler_plate)
|
||||
end = start
|
||||
except ValueError:
|
||||
start = None
|
||||
end = start
|
||||
if start is not None:
|
||||
while lines[start-1].startswith('#'):
|
||||
start -= 1
|
||||
|
||||
if start is not None and end is not None:
|
||||
f = open(fname, 'w')
|
||||
f.writelines(lines[:start])
|
||||
f.writelines(lines[end+1:])
|
||||
f.close()
|
||||
39
pycparser-2.10-ply.patch
Normal file
39
pycparser-2.10-ply.patch
Normal file
@ -0,0 +1,39 @@
|
||||
diff -up pycparser-release_v2.10/pycparser/c_lexer.py.ply pycparser-release_v2.10/pycparser/c_lexer.py
|
||||
--- pycparser-release_v2.10/pycparser/c_lexer.py.ply 2013-08-03 07:15:32.000000000 -0600
|
||||
+++ pycparser-release_v2.10/pycparser/c_lexer.py 2014-08-20 12:40:48.308461164 -0600
|
||||
@@ -9,8 +9,8 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
-from .ply import lex
|
||||
-from .ply.lex import TOKEN
|
||||
+from ply import lex
|
||||
+from ply.lex import TOKEN
|
||||
|
||||
|
||||
class CLexer(object):
|
||||
diff -up pycparser-release_v2.10/pycparser/c_parser.py.ply pycparser-release_v2.10/pycparser/c_parser.py
|
||||
--- pycparser-release_v2.10/pycparser/c_parser.py.ply 2013-08-03 07:15:32.000000000 -0600
|
||||
+++ pycparser-release_v2.10/pycparser/c_parser.py 2014-08-20 12:40:05.154894980 -0600
|
||||
@@ -8,7 +8,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
import re
|
||||
|
||||
-from .ply import yacc
|
||||
+from ply import yacc
|
||||
|
||||
from . import c_ast
|
||||
from .c_lexer import CLexer
|
||||
diff -up pycparser-release_v2.10/setup.py.ply pycparser-release_v2.10/setup.py
|
||||
--- pycparser-release_v2.10/setup.py.ply 2013-08-03 07:15:32.000000000 -0600
|
||||
+++ pycparser-release_v2.10/setup.py 2014-08-20 12:40:05.154894980 -0600
|
||||
@@ -60,7 +60,7 @@ setup(
|
||||
'Programming Language :: Python :: 3.6',
|
||||
],
|
||||
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
|
||||
- packages=['pycparser', 'pycparser.ply'],
|
||||
+ packages=['pycparser'],
|
||||
package_data={'pycparser': ['*.cfg']},
|
||||
cmdclass={'install': install, 'sdist': sdist},
|
||||
)
|
||||
--
|
||||
BIN
pycparser-release_v2.19.tar.gz
Normal file
BIN
pycparser-release_v2.19.tar.gz
Normal file
Binary file not shown.
98
python-pycparser.spec
Normal file
98
python-pycparser.spec
Normal file
@ -0,0 +1,98 @@
|
||||
Name: python-pycparser
|
||||
Summary: A parser for the C language
|
||||
Version: 2.19
|
||||
Release: 1
|
||||
License: BSD
|
||||
URL: http://github.com/eliben/pycparser
|
||||
Source0: http://github.com/eliben/pycparser/archive/pycparser-release_v%{version}.tar.gz
|
||||
# source1 from https://koji.fedoraproject.org/koji/buildinfo?buildID=1092324
|
||||
Source1: pycparser-0.91.1-remove-relative-sys-path.py
|
||||
# patch1 is adapted from https://koji.fedoraproject.org/koji/buildinfo?buildID=1092324
|
||||
# remove embedded libraries during packaging
|
||||
Patch1: pycparser-2.10-ply.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: python2-devel python2-setuptools python2-pycparser python-unversioned-command
|
||||
# for unit tests
|
||||
BuildRequires: dos2unix python2-ply >= 3.6 python3-devel python3-setuptools python3-ply
|
||||
|
||||
%description
|
||||
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.
|
||||
|
||||
%package devel
|
||||
Summary: Development files for %{name}
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
This package contains development files for %{name}
|
||||
|
||||
%package -n python2-pycparser
|
||||
Summary: A parser for the C language
|
||||
Group: System Environment/Libraries
|
||||
Requires: python2-ply >= 3.6
|
||||
%{?python_provide:%python_provide python2-pycparser}
|
||||
%description -n python2-pycparser
|
||||
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 package is for Python2.
|
||||
|
||||
%package -n python3-pycparser
|
||||
Summary: A parser for the C language
|
||||
Group: System Environment/Libraries
|
||||
Requires: python3-ply
|
||||
%{?python_provide:%python_provide python3-pycparser}
|
||||
|
||||
%description -n python3-pycparser
|
||||
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 package is for Python3.
|
||||
%prep
|
||||
%autosetup -n pycparser-release_v%{version} -p1
|
||||
# remove embedded copy of ply
|
||||
rm -rf pycparser/ply
|
||||
%{__python2} %{SOURCE1} examples
|
||||
dos2unix LICENSE
|
||||
|
||||
%build
|
||||
%py2_build
|
||||
pushd build/lib/pycparser
|
||||
%{__python2} _build_tables.py
|
||||
popd
|
||||
|
||||
%py3_build
|
||||
pushd build/lib/pycparser
|
||||
%{__python3} _build_tables.py
|
||||
popd
|
||||
|
||||
%install
|
||||
%py2_install
|
||||
%py3_install
|
||||
|
||||
%check
|
||||
%{__python2} tests/all_tests.py
|
||||
%{__python3} tests/all_tests.py
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
%doc examples
|
||||
|
||||
%files -n python2-pycparser
|
||||
%defattr(-,root,root)
|
||||
%license LICENSE
|
||||
%{python_sitelib}/pycparser/
|
||||
%{python_sitelib}/pycparser-*.egg-info
|
||||
|
||||
%files -n python3-pycparser
|
||||
%defattr(-,root,root)
|
||||
%license LICENSE
|
||||
%{python3_sitelib}/pycparser/
|
||||
%{python3_sitelib}/pycparser-*.egg-info
|
||||
|
||||
%changelog
|
||||
* Sun Sep 15 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.19-1
|
||||
- Package init
|
||||
Loading…
x
Reference in New Issue
Block a user