2 This script adapts import statements in sympy/mpmath/tests to work properly.
4 We want to have this fully automatic, so that we don't have to do it by hand
5 each time we copy files from mpmath to sympy.
9 $ python bin/adapt_paths.py > /tmp/x
12 You can use the "--dry-run" parameter to 'patch' to see if all is ok and you
13 should also inspect the /tmp/x that all the changes generated are actually
21 def get_files_mpmath():
22 return glob("sympy/mpmath/tests/test_*.py")
24 def fix_file(filename
):
27 # This converts stuff like "mpmath.dps -> sympy.mpmath.dps", but will leave
28 # "sympy.mpmath.dps" untouched.
29 s
= re
.sub("(?<!sympy\.)mpmath", "sympy.mpmath", orig
)
31 # print differences in an unified diff format
32 d
= difflib
.unified_diff(orig
.split("\n"), s
.split("\n"),
33 fromfile
=filename
, tofile
=filename
+".new", lineterm
="")
39 for x
in get_files_mpmath():