summaryrefslogtreecommitdiff
path: root/numpy/distutils/misc_util.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2019-06-12 00:05:32 -0700
committerEric Wieser <wieser.eric@gmail.com>2019-06-12 00:20:39 -0700
commitf89414564743495ca9104400e9ab1a6ba0963e2e (patch)
treeac5bca8291ad96904fa34b6089c8832417dc8d31 /numpy/distutils/misc_util.py
parentda1bc31213675425c43f025c5fa09869b904b667 (diff)
downloadnumpy-f89414564743495ca9104400e9ab1a6ba0963e2e.tar.gz
MAINT: Use textwrap.dedent for multiline strings
This makes it easier to visually jump between functions. A couple places have changed to not emit leading whitespace where they previously did. Since this is C code and not fortran, that doesn't matter.
Diffstat (limited to 'numpy/distutils/misc_util.py')
-rw-r--r--numpy/distutils/misc_util.py52
1 files changed, 26 insertions, 26 deletions
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index cba84bffa..795d348ef 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -10,6 +10,7 @@ import tempfile
import subprocess
import shutil
import multiprocessing
+import textwrap
import distutils
from distutils.errors import DistutilsError
@@ -2273,38 +2274,37 @@ def generate_config_py(target):
f.write('__all__ = ["get_info","show"]\n\n')
# For gfortran+msvc combination, extra shared libraries may exist
- f.write("""
+ f.write(textwrap.dedent("""
+ import os
+ import sys
-import os
-import sys
-
-extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs')
+ extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs')
-if sys.platform == 'win32' and os.path.isdir(extra_dll_dir):
- os.environ.setdefault('PATH', '')
- os.environ['PATH'] += os.pathsep + extra_dll_dir
+ if sys.platform == 'win32' and os.path.isdir(extra_dll_dir):
+ os.environ.setdefault('PATH', '')
+ os.environ['PATH'] += os.pathsep + extra_dll_dir
-""")
+ """))
for k, i in system_info.saved_results.items():
f.write('%s=%r\n' % (k, i))
- f.write(r'''
-def get_info(name):
- g = globals()
- return g.get(name, g.get(name + "_info", {}))
-
-def show():
- for name,info_dict in globals().items():
- if name[0] == "_" or type(info_dict) is not type({}): continue
- print(name + ":")
- if not info_dict:
- print(" NOT AVAILABLE")
- for k,v in info_dict.items():
- v = str(v)
- if k == "sources" and len(v) > 200:
- v = v[:60] + " ...\n... " + v[-60:]
- print(" %s = %s" % (k,v))
- ''')
+ f.write(textwrap.dedent(r'''
+ def get_info(name):
+ g = globals()
+ return g.get(name, g.get(name + "_info", {}))
+
+ def show():
+ for name,info_dict in globals().items():
+ if name[0] == "_" or type(info_dict) is not type({}): continue
+ print(name + ":")
+ if not info_dict:
+ print(" NOT AVAILABLE")
+ for k,v in info_dict.items():
+ v = str(v)
+ if k == "sources" and len(v) > 200:
+ v = v[:60] + " ...\n... " + v[-60:]
+ print(" %s = %s" % (k,v))
+ '''))
return target