[Python-modules-commits] r25435 - in packages/pycparser/trunk/debian (7 files)

stefanor at users.alioth.debian.org stefanor at users.alioth.debian.org
Thu Aug 8 08:25:23 UTC 2013


    Date: Thursday, August 8, 2013 @ 08:25:20
  Author: stefanor
Revision: 25435

* New upstream release.
* Port to pybuild.
* Patch: relative-tests. Find the test resources relative to __file__.

Added:
  packages/pycparser/trunk/debian/patches/relative-tests
Modified:
  packages/pycparser/trunk/debian/changelog
  packages/pycparser/trunk/debian/control
  packages/pycparser/trunk/debian/patches/series
  packages/pycparser/trunk/debian/patches/system-ply
  packages/pycparser/trunk/debian/rules
Deleted:
  packages/pycparser/trunk/debian/clean

Modified: packages/pycparser/trunk/debian/changelog
===================================================================
--- packages/pycparser/trunk/debian/changelog	2013-08-07 22:33:13 UTC (rev 25434)
+++ packages/pycparser/trunk/debian/changelog	2013-08-08 08:25:20 UTC (rev 25435)
@@ -1,3 +1,11 @@
+pycparser (2.10+dfsg-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+  * Port to pybuild.
+  * Patch: relative-tests. Find the test resources relative to __file__.
+
+ -- Stefano Rivera <stefanor at debian.org>  Wed, 26 Jun 2013 00:43:10 +0200
+
 pycparser (2.09.1+dfsg-2) unstable; urgency=low
 
   [ Jakub Wilk ]

Deleted: packages/pycparser/trunk/debian/clean
===================================================================
--- packages/pycparser/trunk/debian/clean	2013-08-07 22:33:13 UTC (rev 25434)
+++ packages/pycparser/trunk/debian/clean	2013-08-08 08:25:20 UTC (rev 25435)
@@ -1,2 +0,0 @@
-yacctab.py
-parser.out

Modified: packages/pycparser/trunk/debian/control
===================================================================
--- packages/pycparser/trunk/debian/control	2013-08-07 22:33:13 UTC (rev 25434)
+++ packages/pycparser/trunk/debian/control	2013-08-08 08:25:20 UTC (rev 25435)
@@ -5,6 +5,7 @@
 Uploaders: Stefano Rivera <stefanor at debian.org>
 Build-Depends:
  debhelper (>= 8.1),
+ dh-python,
  python-all (>= 2.6.6-3~),
  python-ply (>= 3.4-1~),
  python3-all (>= 3.1.2-6~),

Added: packages/pycparser/trunk/debian/patches/relative-tests
===================================================================
--- packages/pycparser/trunk/debian/patches/relative-tests	                        (rev 0)
+++ packages/pycparser/trunk/debian/patches/relative-tests	2013-08-08 08:25:20 UTC (rev 25435)
@@ -0,0 +1,74 @@
+Description: Locate test data from __file__
+ Find c_files and fake_libc_include from __file__ of the unit test, rather than
+ expecting the test suite to be run from a particular directory.
+Author: Stefano Rivera <stefanor at debian.org>
+Forwarded: https://github.com/eliben/pycparser/pull/13
+Last-Update: 2013-08-08
+
+--- a/tests/test_c_parser.py
++++ b/tests/test_c_parser.py
+@@ -1518,13 +1518,10 @@
+         """ Find a c file by name, taking into account the current dir can be
+             in a couple of typical places
+         """
+-        fullnames = [
+-            os.path.join('c_files', name),
+-            os.path.join('tests', 'c_files', name)]
+-        for fullname in fullnames:
+-            if os.path.exists(fullname):
+-                return open(fullname, 'rU')
+-        assert False, "Unreachable"
++        testdir = os.path.dirname(__file__)
++        name = os.path.join(testdir, 'c_files', name)
++        assert os.path.exists(name)
++        return open(name, 'rU')
+ 
+     def test_whole_file(self):
+         # See how pycparser handles a whole, real C file.
+--- a/tests/test_general.py
++++ b/tests/test_general.py
+@@ -15,31 +15,29 @@
+         """ Find a c file by name, taking into account the current dir can be
+             in a couple of typical places
+         """
+-        fullnames = [
+-            os.path.join('c_files', name),
+-            os.path.join('tests', 'c_files', name)]
+-        for fullname in fullnames:
+-            if os.path.exists(fullname):
+-                return fullname
+-        assert False, "Unreachable"
++        testdir = os.path.dirname(__file__)
++        name = os.path.join(testdir, 'c_files', name)
++        assert os.path.exists(name)
++        return name
+ 
+     def test_without_cpp(self):
+         ast = parse_file(self._find_file('example_c_file.c'))
+         self.assertTrue(isinstance(ast, c_ast.FileAST))
+ 
+     def test_with_cpp(self):
+-        c_files_path = os.path.join('tests', 'c_files')
+-        ast = parse_file(self._find_file('memmgr.c'), use_cpp=True,
++        memmgr_path = self._find_file('memmgr.c')
++        c_files_path = os.path.dirname(memmgr_path)
++        ast = parse_file(memmgr_path, use_cpp=True,
+             cpp_path=CPPPATH,
+             cpp_args='-I%s' % c_files_path)
+         self.assertTrue(isinstance(ast, c_ast.FileAST))
+-    
++
++        fake_libc = os.path.join(c_files_path, '..', '..',
++                                 'utils', 'fake_libc_include')
+         ast2 = parse_file(self._find_file('year.c'), use_cpp=True,
+-            cpp_path=CPPPATH, 
+-            cpp_args=[
+-                r'-Iutils/fake_libc_include',
+-                r'-I../utils/fake_libc_include'])
+-    
++            cpp_path=CPPPATH,
++            cpp_args=[r'-I%s' % fake_libc])
++
+         self.assertTrue(isinstance(ast2, c_ast.FileAST))
+ 
+     def test_cpp_funkydir(self):

Modified: packages/pycparser/trunk/debian/patches/series
===================================================================
--- packages/pycparser/trunk/debian/patches/series	2013-08-07 22:33:13 UTC (rev 25434)
+++ packages/pycparser/trunk/debian/patches/series	2013-08-08 08:25:20 UTC (rev 25435)
@@ -1 +1,2 @@
 system-ply
+relative-tests

Modified: packages/pycparser/trunk/debian/patches/system-ply
===================================================================
--- packages/pycparser/trunk/debian/patches/system-ply	2013-08-07 22:33:13 UTC (rev 25434)
+++ packages/pycparser/trunk/debian/patches/system-ply	2013-08-08 08:25:20 UTC (rev 25435)
@@ -31,11 +31,11 @@
 --- a/setup.py
 +++ b/setup.py
 @@ -22,7 +22,7 @@
-     classifiers = [
-         'Programming Language :: Python :: 2',
-         'Programming Language :: Python :: 3',],    
--    packages=['pycparser', 'pycparser.ply'],
-+    packages=['pycparser'],
-     package_data={'pycparser': ['*.cfg']},
- )
- 
+     classifiers = [
+         'Programming Language :: Python :: 2',
+         'Programming Language :: Python :: 3',],
+-    packages=['pycparser', 'pycparser.ply'],
++    packages=['pycparser'],
+     package_data={'pycparser': ['*.cfg']},
+ )
+ 

Modified: packages/pycparser/trunk/debian/rules
===================================================================
--- packages/pycparser/trunk/debian/rules	2013-08-07 22:33:13 UTC (rev 25434)
+++ packages/pycparser/trunk/debian/rules	2013-08-08 08:25:20 UTC (rev 25435)
@@ -1,49 +1,31 @@
 #!/usr/bin/make -f
 
-PYVERS = $(shell pyversions -r)
-PY3VERS = $(shell py3versions -r)
+export PYBUILD_DESTDIR_python2=debian/python-pycparser
+export PYBUILD_DESTDIR_python3=debian/python3-pycparser
+export PYBUILD_AFTER_TEST=rm {build_dir}/parser.out
+export PYBUILD_TEST_ARGS={dir}/tests
 
-# Don't accidentally run tests against the existing pycparser
-export PYTHONPATH=$(CURDIR)
-
 %:
-	dh $@ --with python2,python3
+	dh $@ --with python2,python3 --buildsystem pybuild
 
 override_dh_auto_build: clean-generated-code
 	cd pycparser && python _build_tables.py
-	set -e -x; \
-	for py in $(PYVERS) $(PY3VERS); do \
-		$$py setup.py build; \
-	done
+	dh_auto_build
 
-override_dh_auto_test:
-ifeq "$(filter nocheck,$(DEB_BUILD_OPTIONS))" ""
-	set -e -x; \
-	for py in $(PYVERS) $(PY3VERS); do \
-		$$py tests/all_tests.py; \
-	done
-endif
-
-override_dh_auto_install:
-	set -e -x; \
-	for py in $(PYVERS); do \
-		$$py setup.py install --skip-build --root debian/python-pycparser --install-layout=deb; \
-	done
-	set -e -x; \
-	for py in $(PY3VERS); do \
-		$$py setup.py install --skip-build --root debian/python3-pycparser --install-layout=deb; \
-	done
-
 override_dh_auto_clean: clean-generated-code
-	rm -rf build
-	find . -name '*.pyc' -delete
+	dh_auto_clean
 
 override_dh_python2:
 	dh_python2
-	dh_python-ply pycparser/lextab.py pycparser/yacctab.py
+	dh_python-ply debian/python-pycparser/usr/share/pyshared/pycparser/lextab.py \
+	              debian/python-pycparser/usr/share/pyshared/pycparser/yacctab.py
+
+override_dh_python3:
+	dh_python3
 	# I blame jwilk for this temporary hack: (waiting for #714099)
 	sed -e 's/python-/python3-/g' /usr/bin/dh_python-ply | \
-		perl - pycparser/lextab.py pycparser/yacctab.py
+		perl - debian/python3-pycparser/usr/lib/python3/dist-packages/pycparser/lextab.py \
+	           debian/python3-pycparser/usr/lib/python3/dist-packages/yacctab.py
 
 clean-generated-code:
 	cd pycparser && rm -f lextab.py yacctab.py c_ast.py




More information about the Python-modules-commits mailing list