TheLartians / ModernCppStarter

🚀 Kick-start your C++! A template for modern C++ projects using CMake, CI, code coverage, clang-format, reproducible dependency management and much more.
https://thelartians.github.io/ModernCppStarter
The Unlicense
4.45k stars 388 forks source link

the format target does not work? #78

Closed ClausKlein closed 3 years ago

ClausKlein commented 3 years ago
Claus-iMac:ModernCppStarter clausklein$ cmake -B build -S test -G Ninja
-- CPM: adding package Ccache.cmake@1.2.2 (v1.2.2)
-- Using ccache: /usr/local/bin/ccache
-- CPM: adding package Greeter@ (/Users/clausklein/Workspace/cpp/ModernCppStarter/test/..)
-- CPM: Greeter: adding package PackageProject.cmake@1.4 (v1.4)
-- CPM: adding package Format.cmake@1.6 (v1.6)
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/clausklein/Workspace/cpp/ModernCppStarter/build
Claus-iMac:ModernCppStarter clausklein$ ninja -C build 
ninja: Entering directory `build'
[0/2] Re-checking globbed directories...
ninja: no work to do.
Claus-iMac:ModernCppStarter clausklein$ 

Claus-iMac:ModernCppStarter clausklein$ ninja -C build format
ninja: Entering directory `build'
[0/2] Re-checking globbed directories...
[1/2] cd /Users/clausklein/Workspace/cpp/ModernCppStarter/test && /usr/local/Frameworks/Pyt...binary=/usr/local/opt/llvm/bin/clang-format --diff 4b825dc642cb6eb9a060e54bf8d69288fbee490
clang-format did not modify any files
[2/2] cd /Users/clausklein/Workspace/cpp/ModernCppStarter/test && /usr/local/Cellar/cmake/3...s/clausklein/Workspace/cpp/ModernCppStarter/build/_deps/format.cmake-src/cmake-format.cmak
Traceback (most recent call last):
  File "/usr/local/bin/cmake-format", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 633, in main
    return inner_main()
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 616, in inner_main
    onefile_main(infile_path, args, argparse_dict)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 508, in onefile_main
    config_dict = get_config(infile_path, args.config_files)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 359, in get_config
    return get_configdict(configfile_paths)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 312, in get_configdict
    increment_dict = get_one_config_dict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 303, in get_one_config_dict
    return try_get_configdict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 256, in try_get_configdict
    raise RuntimeError("Failed to parse {} as any of yaml, json, or python"
RuntimeError: Failed to parse /Users/clausklein/Workspace/cpp/ModernCppStarter/.cmake-format as any of yaml, json, or python
error: Could not access '/Users/clausklein/Workspace/cpp/ModernCppStarter/build/_deps/format.cmake-build/formatted.cmake'
Traceback (most recent call last):
  File "/usr/local/bin/cmake-format", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 633, in main
    return inner_main()
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 616, in inner_main
    onefile_main(infile_path, args, argparse_dict)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 508, in onefile_main
    config_dict = get_config(infile_path, args.config_files)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 359, in get_config
    return get_configdict(configfile_paths)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 312, in get_configdict
    increment_dict = get_one_config_dict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 303, in get_one_config_dict
    return try_get_configdict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 256, in try_get_configdict
    raise RuntimeError("Failed to parse {} as any of yaml, json, or python"
RuntimeError: Failed to parse /Users/clausklein/Workspace/cpp/ModernCppStarter/.cmake-format as any of yaml, json, or python
error: Could not access '/Users/clausklein/Workspace/cpp/ModernCppStarter/build/_deps/format.cmake-build/formatted.cmake'
Traceback (most recent call last):
  File "/usr/local/bin/cmake-format", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 633, in main
    return inner_main()
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 616, in inner_main
    onefile_main(infile_path, args, argparse_dict)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 508, in onefile_main
    config_dict = get_config(infile_path, args.config_files)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 359, in get_config
    return get_configdict(configfile_paths)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 312, in get_configdict
    increment_dict = get_one_config_dict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 303, in get_one_config_dict
    return try_get_configdict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 256, in try_get_configdict
    raise RuntimeError("Failed to parse {} as any of yaml, json, or python"
RuntimeError: Failed to parse /Users/clausklein/Workspace/cpp/ModernCppStarter/.cmake-format as any of yaml, json, or python
error: Could not access '/Users/clausklein/Workspace/cpp/ModernCppStarter/build/_deps/format.cmake-build/formatted.cmake'
Traceback (most recent call last):
  File "/usr/local/bin/cmake-format", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 633, in main
    return inner_main()
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 616, in inner_main
    onefile_main(infile_path, args, argparse_dict)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 508, in onefile_main
    config_dict = get_config(infile_path, args.config_files)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 359, in get_config
    return get_configdict(configfile_paths)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 312, in get_configdict
    increment_dict = get_one_config_dict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 303, in get_one_config_dict
    return try_get_configdict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 256, in try_get_configdict
    raise RuntimeError("Failed to parse {} as any of yaml, json, or python"
RuntimeError: Failed to parse /Users/clausklein/Workspace/cpp/ModernCppStarter/.cmake-format as any of yaml, json, or python
error: Could not access '/Users/clausklein/Workspace/cpp/ModernCppStarter/build/_deps/format.cmake-build/formatted.cmake'
Traceback (most recent call last):
  File "/usr/local/bin/cmake-format", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 633, in main
    return inner_main()
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 616, in inner_main
    onefile_main(infile_path, args, argparse_dict)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 508, in onefile_main
    config_dict = get_config(infile_path, args.config_files)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 359, in get_config
    return get_configdict(configfile_paths)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 312, in get_configdict
    increment_dict = get_one_config_dict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 303, in get_one_config_dict
    return try_get_configdict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 256, in try_get_configdict
    raise RuntimeError("Failed to parse {} as any of yaml, json, or python"
RuntimeError: Failed to parse /Users/clausklein/Workspace/cpp/ModernCppStarter/.cmake-format as any of yaml, json, or python
error: Could not access '/Users/clausklein/Workspace/cpp/ModernCppStarter/build/_deps/format.cmake-build/formatted.cmake'
Traceback (most recent call last):
  File "/usr/local/bin/cmake-format", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 633, in main
    return inner_main()
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 616, in inner_main
    onefile_main(infile_path, args, argparse_dict)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 508, in onefile_main
    config_dict = get_config(infile_path, args.config_files)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 359, in get_config
    return get_configdict(configfile_paths)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 312, in get_configdict
    increment_dict = get_one_config_dict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 303, in get_one_config_dict
    return try_get_configdict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 256, in try_get_configdict
    raise RuntimeError("Failed to parse {} as any of yaml, json, or python"
RuntimeError: Failed to parse /Users/clausklein/Workspace/cpp/ModernCppStarter/.cmake-format as any of yaml, json, or python
error: Could not access '/Users/clausklein/Workspace/cpp/ModernCppStarter/build/_deps/format.cmake-build/formatted.cmake'
Traceback (most recent call last):
  File "/usr/local/bin/cmake-format", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 633, in main
    return inner_main()
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 616, in inner_main
    onefile_main(infile_path, args, argparse_dict)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 508, in onefile_main
    config_dict = get_config(infile_path, args.config_files)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 359, in get_config
    return get_configdict(configfile_paths)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 312, in get_configdict
    increment_dict = get_one_config_dict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 303, in get_one_config_dict
    return try_get_configdict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 256, in try_get_configdict
    raise RuntimeError("Failed to parse {} as any of yaml, json, or python"
RuntimeError: Failed to parse /Users/clausklein/Workspace/cpp/ModernCppStarter/.cmake-format as any of yaml, json, or python
error: Could not access '/Users/clausklein/Workspace/cpp/ModernCppStarter/build/_deps/format.cmake-build/formatted.cmake'
Claus-iMac:ModernCppStarter clausklein$ 
ClausKlein commented 3 years ago

is is a problem for my host, sorry

it works on Debian stable, with old cmake, python, cmake-lint ...

ClausKlein commented 3 years ago

but on OSX with newest tools not:

bash-3.2$ pip3 install cmakelang
Requirement already satisfied: cmakelang in /usr/local/lib/python3.9/site-packages (0.6.13)
Requirement already satisfied: six>=1.13.0 in /usr/local/Cellar/protobuf/3.14.0/libexec/lib/python3.9/site-packages (from cmakelang) (1.15.0)
bash-3.2$ pip3 check
No broken requirements found.
bash-3.2$ pip3 list
Package      Version
------------ -------
autopep8     1.5.4
builddriver  0.9.0
cmake-format 0.6.13
cmakelang    0.6.13
cmakelint    1.4.1
Jinja2       2.11.3
MarkupSafe   1.1.1
meson        0.56.2
pip          21.0.1
protobuf     3.14.0
pycodestyle  2.6.0
Pygments     2.7.4
setuptools   52.0.0
six          1.15.0
toml         0.10.2
wheel        0.36.2
bash-3.2$ 

bash-3.2$ cmake-format --dump-config
Traceback (most recent call last):
  File "/usr/local/bin/cmake-format", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 633, in main
    return inner_main()
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 587, in inner_main
    config_dict = get_config(os.getcwd(), args.config_files)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 359, in get_config
    return get_configdict(configfile_paths)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 312, in get_configdict
    increment_dict = get_one_config_dict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 303, in get_one_config_dict
    return try_get_configdict(configfile_path)
  File "/usr/local/lib/python3.9/site-packages/cmakelang/format/__main__.py", line 256, in try_get_configdict
    raise RuntimeError("Failed to parse {} as any of yaml, json, or python"
RuntimeError: Failed to parse /Users/clausklein/Workspace/cpp/ModernCppStarter/.cmake-format as any of yaml, json, or python
bash-3.2$ cmake-format --version
0.6.13
bash-3.2$ 
ClausKlein commented 3 years ago

ops: PyYAML was not installed!

With this py modules it works fine now:

Package            Version
------------------ -------
autopep8           1.5.4
builddriver        0.9.0
cmake-format       0.6.13
cmakelang          0.6.13
cmakelint          1.4.1
Jinja2             2.11.3
MarkupSafe         1.1.1
meson              0.56.2
pip                21.0.1
protobuf           3.14.0
pycodestyle        2.6.0
Pygments           2.7.4
PyYAML             5.4.1
setuptools         52.0.0
six                1.15.0
toml               0.10.2
wheel              0.36.2
yaml-configuration 0.2.5
bash-3.2$