Commit 46b38d4c authored by Jean-Baptiste Mouret's avatar Jean-Baptiste Mouret
Browse files

fix some python headers

parent 8a051ca1
......@@ -117,7 +117,7 @@ We can create two variants in the ``wscript``, as follows:
.. code-block:: python
#! /usr/bin/env python
#!/usr/bin/env python
import limbo
def build(bld):
......@@ -139,7 +139,7 @@ You can add as many defines as you like (or even generate them with python code)
.. code-block:: python
#! /usr/bin/env python
#!/usr/bin/env python
import limbo
def build(bld):
......@@ -162,7 +162,7 @@ If you have more than one file, you have 2 options:
.. code-block:: python
#! /usr/bin/env python
#!/usr/bin/env python
import limbo
def build(bld):
......
......@@ -14,7 +14,7 @@ This new file should have the following structure:
.. code:: python
#! /usr/bin/env python
#!/usr/bin/env python
# encoding: utf-8
from waflib.Configure import conf
......@@ -165,7 +165,7 @@ Here's a small and quick example to add `ROS`_ as an external library to our exp
.. code:: python
#! /usr/bin/env python
#!/usr/bin/env python
import limbo
import ros
......@@ -191,7 +191,7 @@ Here's a small and quick example to add `ROS`_ as an external library to our exp
.. code:: python
#! /usr/bin/env python
#!/usr/bin/env python
# encoding: utf-8
import os
......
#! /usr/bin/env python
#!/usr/bin/env python
import limbo
def options(opt):
......
......@@ -55,23 +55,32 @@ def make_dirlist(folder, extensions):
matches.append(os.path.join(root, filename))
return matches
def insert_header(fname, prefix, license):
def insert_header(fname, prefix, license, kept_header = []):
input = open(fname, 'r')
output = open('/tmp/' + fname.split('/')[-1], 'w')
for line in kept_header:
output.write(line + '\n')
for line in license.split('\n'):
output.write(prefix + line + "\n")
for line in input:
if line[0:len(prefix)] != prefix:
#print kept_header
print line in kept_header
header = len(filter(lambda x: x in line, kept_header)) != 0
print filter(lambda x: x in line, kept_header)
if (line[0:len(prefix)] != prefix) and (not header):
output.write(line)
output.close()
def insert():
# cpp
cpp = make_dirlist('src', ['.hpp', '.cpp'])
insert_header('src/benchmarks/bayesopt/testfunctions.hpp', "//| ", license)
insert_header('src/benchmarks/wscript', "//| ", license, ['#!/usr/bin/env python', '# encoding: utf-8'])
return
for i in cpp:
insert_header(i, "//| ", license)
# py
py = make_dirlist('waf_tools', ['.py'])
py += make_dirlist('.', ['wscript'])
for i in py:
insert_header(i, "#| ", license)
insert_header(i, "#| ", license, ['#!/usr/bin/env python', '# encoding: utf-8'])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment