Commit 3920d3c768372d2a1a007763822a6d8b1b995fa5
1 parent
acbf12c3
avoid empty lines in Python 3
Showing
1 changed file
with
11 additions
and
10 deletions
dev/codegen.py
| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | +from __future__ import print_function | |
| 21 | 22 | import os |
| 22 | 23 | import sys |
| 23 | 24 | import fileinput |
| ... | ... | @@ -274,13 +275,13 @@ def add_ctool(name, tokens, baseclass): |
| 274 | 275 | if 'libctools_la_LIBADD' in line.replace(' ', ''): |
| 275 | 276 | last = line[-2] |
| 276 | 277 | line = line.replace(line, line+insertline2+last+'\n') |
| 277 | - print(line), | |
| 278 | + print(line,end=''), | |
| 278 | 279 | |
| 279 | 280 | # Update Python module |
| 280 | 281 | for line in fileinput.FileInput('pyext/ctools/tools.i',inplace=1): |
| 281 | 282 | if '%include "ctbin.i"' in line: |
| 282 | 283 | print('%%include "%s.i"' % (name)) |
| 283 | - print(line), | |
| 284 | + print(line,end=''), | |
| 284 | 285 | |
| 285 | 286 | # Update unit test |
| 286 | 287 | for line in fileinput.FileInput('test/test_python_ctools.py',inplace=1): |
| ... | ... | @@ -288,25 +289,25 @@ def add_ctool(name, tokens, baseclass): |
| 288 | 289 | print('import test_%s' % (name)) |
| 289 | 290 | elif 'test_ctbin.Test()' in line: |
| 290 | 291 | print(' test_%s.Test(),' % (name)) |
| 291 | - print(line), | |
| 292 | + print(line,end=''), | |
| 292 | 293 | |
| 293 | 294 | # Update export of unit test |
| 294 | 295 | for line in fileinput.FileInput('pyext/Makefile.am',inplace=1): |
| 295 | 296 | if '$(top_srcdir)/test/test_ctbin.py' in line: |
| 296 | 297 | print(' $(top_srcdir)/test/test_%s.py \\' % (name)) |
| 297 | - print(line), | |
| 298 | + print(line,end=''), | |
| 298 | 299 | |
| 299 | 300 | # Update configure.ac |
| 300 | 301 | for line in fileinput.FileInput('configure.ac',inplace=1): |
| 301 | 302 | if 'src/ctbin/Makefile' in line: |
| 302 | 303 | print(' src/%s/Makefile' % (name)) |
| 303 | - print(line), | |
| 304 | + print(line,end=''), | |
| 304 | 305 | |
| 305 | 306 | # Update reference manual index file |
| 306 | 307 | for line in fileinput.FileInput('doc/source/users/reference_manual/index.rst',inplace=1): |
| 307 | 308 | if 'ctbin --- Generates counts cube <ctbin>' in line: |
| 308 | 309 | print(' %s --- ToDo: Describe what tool is doing <%s>' % (name, name)) |
| 309 | - print(line), | |
| 310 | + print(line,end=''), | |
| 310 | 311 | |
| 311 | 312 | # Return |
| 312 | 313 | return |
| ... | ... | @@ -355,7 +356,7 @@ def add_cscript(name, tokens, baseclass): |
| 355 | 356 | print(' "%s",' % (name)) |
| 356 | 357 | elif 'from cscripts.csworkflow import csworkflow' in line: |
| 357 | 358 | print('from cscripts.%s import %s' % (name, name)) |
| 358 | - print(line), | |
| 359 | + print(line,end=''), | |
| 359 | 360 | |
| 360 | 361 | # Update cscripts/Makefile.am file |
| 361 | 362 | for line in fileinput.FileInput('cscripts/Makefile.am',inplace=1): |
| ... | ... | @@ -367,7 +368,7 @@ def add_cscript(name, tokens, baseclass): |
| 367 | 368 | print(' %s \\' % (name)) |
| 368 | 369 | elif '$(top_srcdir)/test/test_csworkflow.py' in line: |
| 369 | 370 | print(' $(top_srcdir)/test/test_%s.py \\' % (name)) |
| 370 | - print(line), | |
| 371 | + print(line,end=''), | |
| 371 | 372 | |
| 372 | 373 | # Update test/test_python_cscripts.py file |
| 373 | 374 | for line in fileinput.FileInput('test/test_python_cscripts.py',inplace=1): |
| ... | ... | @@ -375,13 +376,13 @@ def add_cscript(name, tokens, baseclass): |
| 375 | 376 | print('import test_%s' % (name)) |
| 376 | 377 | elif 'test_csworkflow.Test()' in line: |
| 377 | 378 | print(' test_%s.Test(),' % (name)) |
| 378 | - print(line), | |
| 379 | + print(line,end=''), | |
| 379 | 380 | |
| 380 | 381 | # Update reference manual index file |
| 381 | 382 | for line in fileinput.FileInput('doc/source/users/reference_manual/index.rst',inplace=1): |
| 382 | 383 | if 'csbkgmodel --- Generates background model for 3D analysis <csbkgmodel>' in line: |
| 383 | 384 | print(' %s --- ToDo: Describe what script is doing <%s>' % (name, name)) |
| 384 | - print(line), | |
| 385 | + print(line,end=''), | |
| 385 | 386 | |
| 386 | 387 | # Return |
| 387 | 388 | return | ... | ... |