diff --git a/.travis.yml b/.travis.yml index b298424..84bcef1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,9 +76,9 @@ install: - pip install -r requirements.txt script: - # pep8 tests - - pep8 --ignore E501 update.py - - pep8 --ignore E501,E265 autocmake + # pycodestyle tests + - pycodestyle --ignore E501 update.py + - pycodestyle --ignore E501,E265,E741 autocmake # unit tests - py.test -vv autocmake/* - py.test -vv test/test.py diff --git a/doc/contributors/testing.rst b/doc/contributors/testing.rst index d320fca..99345c3 100644 --- a/doc/contributors/testing.rst +++ b/doc/contributors/testing.rst @@ -11,8 +11,8 @@ build and test recipe for other requirements. Your contributions and changes should preserve the test set and be PEP8 conform. You can run locally all tests with:: - $ pep8 --ignore E501 update.py - $ pep8 --ignore E501,E265 autocmake + $ pycodestyle --ignore E501 update.py + $ pycodestyle --ignore E501,E265 autocmake $ py.test -vv autocmake/* $ py.test -vv test/test.py diff --git a/modules/attach-license-header.py b/modules/attach-license-header.py new file mode 100644 index 0000000..43e12b3 --- /dev/null +++ b/modules/attach-license-header.py @@ -0,0 +1,13 @@ +import glob + +license_text = '''# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + +''' + +for filename in glob.iglob('**/*.cmake', recursive=True): + with open(filename, 'r') as old: + text = old.read() + with open(filename, 'w') as new: + new.write(license_text) + new.write(text) diff --git a/modules/boost/boost.cmake b/modules/boost/boost.cmake index a33665e..cbfabfd 100644 --- a/modules/boost/boost.cmake +++ b/modules/boost/boost.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Detect, build, and link Boost libraries. diff --git a/modules/boost/boost_build.cmake b/modules/boost/boost_build.cmake index 8fcea49..c4b4c7e 100644 --- a/modules/boost/boost_build.cmake +++ b/modules/boost/boost_build.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + # Build Boost # This is not Windows-friendly! add_custom_command( diff --git a/modules/boost/boost_cleanup.cmake b/modules/boost/boost_cleanup.cmake index 2c0faff..bbe878f 100644 --- a/modules/boost/boost_cleanup.cmake +++ b/modules/boost/boost_cleanup.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + # Clean-up add_custom_command( OUTPUT ${CUSTOM_BOOST_LOCATION}/boost.cleanedup diff --git a/modules/boost/boost_configure.cmake b/modules/boost/boost_configure.cmake index 36c65ee..fdbe01a 100644 --- a/modules/boost/boost_configure.cmake +++ b/modules/boost/boost_configure.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + # Run bootstrap.sh to configure the build. We will install in ${PROJECT_BINARY_DIR}/boost # This is not Windows-friendly! add_custom_command( diff --git a/modules/boost/boost_headers.cmake b/modules/boost/boost_headers.cmake index 9e33d8c..a8fad94 100644 --- a/modules/boost/boost_headers.cmake +++ b/modules/boost/boost_headers.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + # Install Boost add_custom_command( OUTPUT ${CUSTOM_BOOST_LOCATION}/boost.installed diff --git a/modules/boost/boost_install.cmake b/modules/boost/boost_install.cmake index 21354b1..cfbb91c 100644 --- a/modules/boost/boost_install.cmake +++ b/modules/boost/boost_install.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + # Install Boost # This is not Windows-friendly! add_custom_command( diff --git a/modules/boost/boost_unpack.cmake b/modules/boost/boost_unpack.cmake index 93dc0c7..4bd3169 100644 --- a/modules/boost/boost_unpack.cmake +++ b/modules/boost/boost_unpack.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + # Unpack Boost add_custom_command( OUTPUT ${CUSTOM_BOOST_LOCATION}/boost.unpacked diff --git a/modules/boost/boost_userconfig.cmake b/modules/boost/boost_userconfig.cmake index 73236ee..12ca4ff 100644 --- a/modules/boost/boost_userconfig.cmake +++ b/modules/boost/boost_userconfig.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + # To get boost to compile MPI we need to append "using mpi ;" to the end of the # user-config.jam file. MPI_SENT will be the command we append set(MPI_SENT "") diff --git a/modules/cc.cmake b/modules/cc.cmake index a4f6882..343ca3e 100644 --- a/modules/cc.cmake +++ b/modules/cc.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Adds C support. diff --git a/modules/ccache.cmake b/modules/ccache.cmake index 3979fa2..4a7dcc4 100644 --- a/modules/ccache.cmake +++ b/modules/ccache.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Adds ccache support. diff --git a/modules/code_coverage.cmake b/modules/code_coverage.cmake index 650f983..0493a8e 100644 --- a/modules/code_coverage.cmake +++ b/modules/code_coverage.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Enables code coverage by appending corresponding compiler flags. diff --git a/modules/custom_color_messages.cmake b/modules/custom_color_messages.cmake index 87de6b5..fda4de5 100644 --- a/modules/custom_color_messages.cmake +++ b/modules/custom_color_messages.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Colorize CMake output. diff --git a/modules/cxx.cmake b/modules/cxx.cmake index 3c2c612..faa07d0 100644 --- a/modules/cxx.cmake +++ b/modules/cxx.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Adds C++ support. diff --git a/modules/default_build_paths.cmake b/modules/default_build_paths.cmake index ec50c99..c488407 100644 --- a/modules/default_build_paths.cmake +++ b/modules/default_build_paths.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Sets binary and library output directories to ${PROJECT_BINARY_DIR}/bin diff --git a/modules/definitions.cmake b/modules/definitions.cmake index 23e5fc2..6f38e2b 100644 --- a/modules/definitions.cmake +++ b/modules/definitions.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Add preprocessor definitions (example: --add-definitions="-DTHIS -DTHAT=137"). diff --git a/modules/export_header.cmake b/modules/export_header.cmake index 9eac395..9072554 100644 --- a/modules/export_header.cmake +++ b/modules/export_header.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Generates export header for your API using best practices. diff --git a/modules/fc.cmake b/modules/fc.cmake index 22f6d58..ed1d010 100644 --- a/modules/fc.cmake +++ b/modules/fc.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Adds Fortran support. diff --git a/modules/fc_optional.cmake b/modules/fc_optional.cmake index 2095cc4..5af2002 100644 --- a/modules/fc_optional.cmake +++ b/modules/fc_optional.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Adds optional Fortran support. diff --git a/modules/find/find_include_files.cmake b/modules/find/find_include_files.cmake index 2ef99b9..629df49 100644 --- a/modules/find/find_include_files.cmake +++ b/modules/find/find_include_files.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + include(CheckIncludeFile) function(_find_include_dir _names _hints _result) diff --git a/modules/find/find_libraries.cmake b/modules/find/find_libraries.cmake index 3b060a0..1d9c980 100644 --- a/modules/find/find_libraries.cmake +++ b/modules/find/find_libraries.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + include(CheckFunctionExists) function(_find_library _names _check_function _result) diff --git a/modules/git_info/git_info.cmake b/modules/git_info/git_info.cmake index 6520c5a..6fa3f96 100644 --- a/modules/git_info/git_info.cmake +++ b/modules/git_info/git_info.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Creates git_info.h in the build directory. diff --git a/modules/googletest.cmake b/modules/googletest.cmake index 353acaf..ab167b0 100644 --- a/modules/googletest.cmake +++ b/modules/googletest.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Includes Google Test sources and adds a library "googletest". diff --git a/modules/int64.cmake b/modules/int64.cmake index b8847fa..38b2aae 100644 --- a/modules/int64.cmake +++ b/modules/int64.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Enables 64-bit integer support for Fortran projects. diff --git a/modules/math/accelerate.cmake b/modules/math/accelerate.cmake index 9483e5a..e6daaa4 100644 --- a/modules/math/accelerate.cmake +++ b/modules/math/accelerate.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Find and link to ACCELERATE. diff --git a/modules/math/acml.cmake b/modules/math/acml.cmake index e5c230d..2efabcb 100644 --- a/modules/math/acml.cmake +++ b/modules/math/acml.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Find and link to ACML. diff --git a/modules/math/atlas.cmake b/modules/math/atlas.cmake index 23565fa..1e13b06 100644 --- a/modules/math/atlas.cmake +++ b/modules/math/atlas.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Find and link to ATLAS. diff --git a/modules/math/blas.cmake b/modules/math/blas.cmake index 9014fb7..7ca3280 100644 --- a/modules/math/blas.cmake +++ b/modules/math/blas.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Find and link to BLAS. diff --git a/modules/math/cblas.cmake b/modules/math/cblas.cmake index 86fa49f..16c4382 100644 --- a/modules/math/cblas.cmake +++ b/modules/math/cblas.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Find and link to CBLAS. diff --git a/modules/math/goto.cmake b/modules/math/goto.cmake index 9d5586e..019c918 100644 --- a/modules/math/goto.cmake +++ b/modules/math/goto.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Find and link to Goto BLAS. diff --git a/modules/math/lapack.cmake b/modules/math/lapack.cmake index 7f3ac52..6bb376c 100644 --- a/modules/math/lapack.cmake +++ b/modules/math/lapack.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Find and link to LAPACK. diff --git a/modules/math/lapacke.cmake b/modules/math/lapacke.cmake index 8b89044..d219089 100644 --- a/modules/math/lapacke.cmake +++ b/modules/math/lapacke.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Find and link to LAPACKE. diff --git a/modules/math_libs.cmake b/modules/math_libs.cmake index 6042e6e..0cff139 100644 --- a/modules/math_libs.cmake +++ b/modules/math_libs.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Detects and links to BLAS and LAPACK libraries. diff --git a/modules/mpi.cmake b/modules/mpi.cmake index 418975e..ec66ec9 100644 --- a/modules/mpi.cmake +++ b/modules/mpi.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Enables MPI support. diff --git a/modules/omp.cmake b/modules/omp.cmake index f33dd91..ed32d0a 100644 --- a/modules/omp.cmake +++ b/modules/omp.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Enables OpenMP support. diff --git a/modules/profile.cmake b/modules/profile.cmake index 14a8cca..dfad704 100644 --- a/modules/profile.cmake +++ b/modules/profile.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Enable profiling by appending corresponding compiler flags. diff --git a/modules/python_interpreter.cmake b/modules/python_interpreter.cmake index 6d200ef..cab4781 100644 --- a/modules/python_interpreter.cmake +++ b/modules/python_interpreter.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Detects Python interpreter. diff --git a/modules/python_libs.cmake b/modules/python_libs.cmake index d4e7b81..3f68627 100644 --- a/modules/python_libs.cmake +++ b/modules/python_libs.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Detects Python libraries and headers. diff --git a/modules/safeguards.cmake b/modules/safeguards.cmake index a613896..1aca842 100644 --- a/modules/safeguards.cmake +++ b/modules/safeguards.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Provides safeguards against in-source builds and bad build types. diff --git a/modules/save_flags.cmake b/modules/save_flags.cmake index d3dd677..f57c852 100644 --- a/modules/save_flags.cmake +++ b/modules/save_flags.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Take care of updating the cache for fresh configurations. diff --git a/modules/src.cmake b/modules/src.cmake index 1abaddf..7ff22da 100644 --- a/modules/src.cmake +++ b/modules/src.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Adds ${PROJECT_SOURCE_DIR}/src as subdirectory containing CMakeLists.txt. diff --git a/modules/version.cmake b/modules/version.cmake index 518cfab..643d1e9 100644 --- a/modules/version.cmake +++ b/modules/version.cmake @@ -1,3 +1,6 @@ +# (c) https://github.com/coderefinery/autocmake/blob/master/AUTHORS.md +# licensed under BSD-3: https://github.com/coderefinery/autocmake/blob/master/LICENSE + #.rst: # # Determine program version from file "VERSION" (example: "14.1") diff --git a/requirements.txt b/requirements.txt index 35fd7f8..4d214d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -pep8 +pycodestyle pytest pyyaml diff --git a/update.py b/update.py index ae0c2ad..66ad713 100644 --- a/update.py +++ b/update.py @@ -12,10 +12,20 @@ if sys.version_info[0] == 2 and sys.version_info[1] < 7: AUTOCMAKE_GITHUB_URL = 'https://github.com/coderefinery/autocmake/raw/master/' +def licensing_info(): + return '''The CMake infrastructure for this project is generated using [Autocmake] +by Radovan Bast, Roberto Di Remigio, Jonas Juselius and contributors. +The `update.py` Python script and the contents of the directories `autocmake` and `downloaded` are licensed +under the terms of the [BSD-3-Clause license], unless otherwise stated. + +[Autocmake]: http://autocmake.org +[BSD-3-Clause license]: https://tldrlegal.com/license/bsd-3-clause-license-(revised)''' + + def check_for_yaml(): try: import yaml - except: + except ImportError: sys.stderr.write("ERROR: you need to install the pyyaml package\n") sys.exit(-1) @@ -257,6 +267,10 @@ def main(argv): src='{0}{1}'.format(AUTOCMAKE_GITHUB_URL, f), dst='{0}'.format(f) ) + # finally create a README.md with licensing information + with open('README.md', 'w') as f: + print('- generating licensing information') + f.write(licensing_info()) sys.exit(0) process_yaml(argv)