File: 0015-exclude-tests-from-python-install.patch

package info (click to toggle)
siconos 4.4.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 78,600 kB
  • sloc: cpp: 160,976; ansic: 129,998; fortran: 33,051; python: 20,958; xml: 1,244; sh: 385; makefile: 318
file content (29 lines) | stat: -rw-r--r-- 1,224 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From: Stephen Sinclair <radarsat1@gmail.com>
Date: Wed, 14 Sep 2022 13:19:00 +0000
Subject: Patch to exclude tests from Python install.

The Python install includes a `tests` module which is only useful for development.  In
particular the file `tests_setup.py` gets included, which is generated by CMake and
contains the full source path in its `working_dir` variable, which harms reproducibility.
Rather than fix this to a relative path, this patch elects to just remove this file from
the package, as it is not needed for regular Siconos usage.  It does so by not installing
any tests during the setuptools build phase.

diff --git a/wrap/setup.py.in b/wrap/setup.py.in
index 8be63b5..4f2b69a 100644
--- a/wrap/setup.py.in
+++ b/wrap/setup.py.in
@@ -265,6 +266,13 @@ except ValueError:
 if install_symlinks:
     cmdclass['build_py'] = build_py_symlink
     cmdclass['install_lib'] = install_lib_symlink
+
+class exclude_tests(build_py):
+    def build_module(self, module, module_file, package):
+        if 'tests' in module_file: return
+        return super().build_module(module, module_file, package)
+cmdclass['build_py'] = exclude_tests
+
 config = Configuration(
     name=name,
     version='@SICONOS_VERSION@',