Skip to content

Commit

Permalink
ready to try on all files!
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmouret committed Aug 25, 2016
1 parent 827657b commit 8a051ca
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 23 deletions.
1 change: 0 additions & 1 deletion LICENSE
@@ -1,4 +1,3 @@

CeCILL-C FREE SOFTWARE LICENSE AGREEMENT


Expand Down
22 changes: 0 additions & 22 deletions src/benchmarks/bayesopt/testfunctions.hpp
@@ -1,25 +1,3 @@
/*
-------------------------------------------------------------------------
This file is part of BayesOpt, an efficient C++ library for
Bayesian optimization.
Copyright (C) 2011-2013 Ruben Martinez-Cantin <rmcantin@unizar.es>
BayesOpt is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BayesOpt is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with BayesOpt. If not, see <http://www.gnu.org/licenses/>.
------------------------------------------------------------------------
*/

#define _USE_MATH_DEFINES
#include <cmath>
#include <algorithm>
Expand Down
77 changes: 77 additions & 0 deletions waf_tools/license.py
@@ -0,0 +1,77 @@
# functions to insert the license in the headers of each cpp/hpp/py/wscript file
# note that we add a pipe (|) on each line so that we can remove the license and
# reinsert it automatically
import fnmatch,re
import os, shutil, sys

license= '''Copyright Inria May 2015
This project has received funding from the European Research Council (ERC) under
the European Union's Horizon 2020 research and innovation programme (grant
agreement No 637972) - see http://www.resibots.eu
Contributor(s):
- Jean-Baptiste Mouret (jean-baptiste.mouret@inria.fr)
- Antoine Cully (antoinecully@gmail.com)
- Kontantinos Chatzilygeroudis (konstantinos.chatzilygeroudis@inria.fr)
- Federico Allocati (fede.allocati@gmail.com)
- Vaios Papaspyros (b.papaspyros@gmail.com)
This software is a computer program whose purpose is to optimize continuous,
black-box functions. I mainly implements Gaussian processes and the Bayesian
optimization algorithm. Main repository: http://github.com/resibots/limbo
This software is governed by the CeCILL-C license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL-C
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL-C license and that you accept its terms.
'''

def make_dirlist(folder, extensions):
matches = []
for root, dirnames, filenames in os.walk(folder):
for ext in extensions:
for filename in fnmatch.filter(filenames, '*' + ext):
matches.append(os.path.join(root, filename))
return matches

def insert_header(fname, prefix, license):
input = open(fname, 'r')
output = open('/tmp/' + fname.split('/')[-1], 'w')
for line in license.split('\n'):
output.write(prefix + line + "\n")
for line in input:
if line[0:len(prefix)] != prefix:
output.write(line)
output.close()

def insert():
# cpp
cpp = make_dirlist('src', ['.hpp', '.cpp'])
insert_header('src/benchmarks/bayesopt/testfunctions.hpp', "//| ", license)
for i in cpp:
insert_header(i, "//| ", license)
py = make_dirlist('waf_tools', ['.py'])
py += make_dirlist('.', ['wscript'])
for i in py:
insert_header(i, "#| ", license)
3 changes: 3 additions & 0 deletions waf_tools/limbo.py
Expand Up @@ -4,6 +4,7 @@
import time
import threading
import params
import license
from waflib.Tools import waf_unit_test

json_ok = True
Expand Down Expand Up @@ -242,3 +243,5 @@ def output_params(folder):
text_file = open("params_"+folder[4:]+".txt", "w")
text_file.write(output)
text_file.close()

def insert_license(): license.insert()
7 changes: 7 additions & 0 deletions wscript
Expand Up @@ -160,10 +160,17 @@ def shutdown(ctx):
if ctx.options.local_serial:
limbo.run_local(ctx.options.local_serial)

def insert_license(ctx):
limbo.insert_license()

class BuildExtensiveTestsContext(BuildContext):
cmd = 'build_extensive_tests'
fun = 'build_extensive_tests'

class BuildBenchmark(BuildContext):
cmd = 'build_benchmark'
fun = 'build_benchmark'

class InsertLicense(BuildContext):
cmd = 'insert_license'
fun = 'insert_license'

0 comments on commit 8a051ca

Please sign in to comment.