[Python-modules-commits] r30503 - in packages/cov-core/trunk/debian (7 files)

barry at users.alioth.debian.org barry at users.alioth.debian.org
Fri Sep 5 17:56:37 UTC 2014


    Date: Friday, September 5, 2014 @ 17:56:35
  Author: barry
Revision: 30503

* New upstream release.
* d/p/pth-installation-path.patch: Fix the calculation of the .pth
  installation path for package builds.  (Closes: #760583)
* d/tests: Add DEP-8 tests to verify the functionality of the .pth files.

Added:
  packages/cov-core/trunk/debian/patches/pth-installation-path.patch
  packages/cov-core/trunk/debian/tests/
  packages/cov-core/trunk/debian/tests/control
  packages/cov-core/trunk/debian/tests/pth-magic
Modified:
  packages/cov-core/trunk/debian/changelog
  packages/cov-core/trunk/debian/control
  packages/cov-core/trunk/debian/patches/series

Modified: packages/cov-core/trunk/debian/changelog
===================================================================
--- packages/cov-core/trunk/debian/changelog	2014-09-05 16:59:10 UTC (rev 30502)
+++ packages/cov-core/trunk/debian/changelog	2014-09-05 17:56:35 UTC (rev 30503)
@@ -1,3 +1,12 @@
+cov-core (1.14.0-1) UNRELEASED; urgency=medium
+
+  * New upstream release.
+  * d/p/pth-installation-path.patch: Fix the calculation of the .pth
+    installation path for package builds.  (Closes: #760583)
+  * d/tests: Add DEP-8 tests to verify the functionality of the .pth files.
+
+ -- Barry Warsaw <barry at debian.org>  Fri, 05 Sep 2014 11:24:51 -0400
+
 cov-core (1.13.0-1) unstable; urgency=medium
 
   * New upstream release.

Modified: packages/cov-core/trunk/debian/control
===================================================================
--- packages/cov-core/trunk/debian/control	2014-09-05 16:59:10 UTC (rev 30502)
+++ packages/cov-core/trunk/debian/control	2014-09-05 17:56:35 UTC (rev 30503)
@@ -15,6 +15,7 @@
 Standards-Version: 3.9.5
 Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/cov-core/trunk/
 Vcs-Browser: http://anonscm.debian.org/viewvc/python-modules/packages/cov-core/trunk/
+XS-Testsuite: autopkgtest
 
 Package: python-cov-core
 Architecture: all

Added: packages/cov-core/trunk/debian/patches/pth-installation-path.patch
===================================================================
--- packages/cov-core/trunk/debian/patches/pth-installation-path.patch	                        (rev 0)
+++ packages/cov-core/trunk/debian/patches/pth-installation-path.patch	2014-09-05 17:56:35 UTC (rev 30503)
@@ -0,0 +1,47 @@
+Author: Barry Warsaw <barry at debian.org>
+Patch-Name: pth-installation-path
+Subject: Calculate the correct .pth path
+
+ cov-core wants to install the file init_cov_core.pth so that cov_core_init
+ will be imported and initialized automatically for subprocess coverage, if
+ the environment variable COV_CORE_SOURCE is set (which e.g. nose does
+ automatically).  However the upstream setup.py tries to install this file
+ directly into /usr/lib/pythonX.Y/{site,dist}-packages, which clearly doesn't
+ work when building the package.  This patch hard codes the .pth path for a
+ location within the build directory.  dh_python{2,3} does the rest.
+Forwarded: not-needed
+
+--- a/setup.py
++++ b/setup.py
+@@ -48,23 +48,11 @@
+                               'Topic :: Software Development :: Testing'])
+ 
+ if sys.argv[1] in ('install', 'develop'):
+-    for path in sys.path:
+-        if (path.endswith('site-packages')) or (path.endswith('dist-packages')
+-                                                and 'local' in path):
+-            path = os.path.join(path, PTH_FILE_NAME)
+-            try:
+-                pth_file = open(path, 'w')
+-                pth_file.write(PTH_FILE)
+-                pth_file.close()
+-                sys.stdout.write('\nWrote pth file for subprocess '
+-                                 'measurement to %s\n' % path)
+-                break
+-            except Exception:
+-                sys.stdout.write('\nFailed to write pth file for subprocess '
+-                                 'measurement to %s\n' % path)
+-                sys.stdout.write(PTH_FILE_FAILURE)
+-                break
+-    else:
+-        sys.stdout.write('\nFailed to find site-packages or dist-packages '
+-                         'dir to put pth file in.\n')
+-        sys.stdout.write(PTH_FILE_FAILURE)
++    majmin = sys.version_info[0:2]
++    pth_path = os.path.join(
++        'debian',
++        ('python3-cov-core' if majmin[0] == 3 else 'python-cov-core'),
++        'usr', 'lib', 'python{}.{}'.format(*majmin), 'dist-packages',
++        PTH_FILE_NAME)
++    with open(pth_path, 'w') as fp:
++        fp.write(PTH_FILE)

Modified: packages/cov-core/trunk/debian/patches/series
===================================================================
--- packages/cov-core/trunk/debian/patches/series	2014-09-05 16:59:10 UTC (rev 30502)
+++ packages/cov-core/trunk/debian/patches/series	2014-09-05 17:56:35 UTC (rev 30503)
@@ -0,0 +1 @@
+pth-installation-path.patch

Added: packages/cov-core/trunk/debian/tests/control
===================================================================
--- packages/cov-core/trunk/debian/tests/control	                        (rev 0)
+++ packages/cov-core/trunk/debian/tests/control	2014-09-05 17:56:35 UTC (rev 30503)
@@ -0,0 +1,2 @@
+Tests: pth-magic
+Depends: @

Added: packages/cov-core/trunk/debian/tests/pth-magic
===================================================================
--- packages/cov-core/trunk/debian/tests/pth-magic	                        (rev 0)
+++ packages/cov-core/trunk/debian/tests/pth-magic	2014-09-05 17:56:35 UTC (rev 30503)
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -x
+
+cmd="import sys; sys.exit('cov_core_init' in sys.modules)"
+
+# This one returns exit code 0 because without the triggering environment
+# variable, the module is not imported.  (Note that this doesn't test whether
+# it actually gets initialized, but we'll just assume that.)
+python -c "$cmd" || exit 1
+
+# With the triggering environment variable, the import happens.
+COV_CORE_SOURCE=1 python -c "$cmd" && exit 1
+
+# Same tests for Python 3.
+python3 -c "$cmd" || exit 1
+COV_CORE_SOURCE=1 python3 -c "$cmd" && exit 1




More information about the Python-modules-commits mailing list