summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorxoviat <xoviat@users.noreply.github.com>2018-01-30 17:25:12 -0600
committerCharles Harris <charlesr.harris@gmail.com>2018-01-30 16:25:12 -0700
commitbb7b12672fe7b68c7776a7f757741d4632001bf3 (patch)
tree2b5429400e5054e96b69d4182ebff5e632b00c9f /numpy
parente988535a06c8150e28e6858d7be0a5d2f7e08fa9 (diff)
downloadnumpy-bb7b12672fe7b68c7776a7f757741d4632001bf3.tar.gz
ENH: Add entry_points for f2py, conv_template, and from_template. (#10463)
* Add entry points for f2py and conv-template * Add main function to conv_template * Extract function * Add entry point
Diffstat (limited to 'numpy')
-rw-r--r--numpy/distutils/conv_template.py6
-rw-r--r--numpy/distutils/from_template.py6
2 files changed, 8 insertions, 4 deletions
diff --git a/numpy/distutils/conv_template.py b/numpy/distutils/conv_template.py
index a42611051..4a8746236 100644
--- a/numpy/distutils/conv_template.py
+++ b/numpy/distutils/conv_template.py
@@ -315,8 +315,7 @@ def unique_key(adict):
return newkey
-if __name__ == "__main__":
-
+def main():
try:
file = sys.argv[1]
except IndexError:
@@ -335,3 +334,6 @@ if __name__ == "__main__":
e = get_exception()
raise ValueError("In %s loop at %s" % (file, e))
outfile.write(writestr)
+
+if __name__ == "__main__":
+ main()
diff --git a/numpy/distutils/from_template.py b/numpy/distutils/from_template.py
index b19c7cc0b..8f587eab9 100644
--- a/numpy/distutils/from_template.py
+++ b/numpy/distutils/from_template.py
@@ -238,8 +238,7 @@ _special_names = find_repl_patterns('''
<ctypereal=float,double,\\0,\\1>
''')
-if __name__ == "__main__":
-
+def main():
try:
file = sys.argv[1]
except IndexError:
@@ -254,3 +253,6 @@ if __name__ == "__main__":
allstr = fid.read()
writestr = process_str(allstr)
outfile.write(writestr)
+
+if __name__ == "__main__":
+ main()