Skip to content

Commit

Permalink
improve v2-boost.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jll63 committed Oct 5, 2024
1 parent e7fcabf commit 467981c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ cmake_minimum_required(VERSION 3.5...3.16)

project(boost_openmethod VERSION 1.87.0 LANGUAGES CXX)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_library(boost_openmethod INTERFACE)
add_library(Boost::openmethod ALIAS boost_openmethod)

Expand Down
22 changes: 9 additions & 13 deletions dev/v2-boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from pathlib import Path
import re
from subprocess import check_call
import subprocess
import sys

BOOST_NAME = "openmethod"
BOOST_INCLUDE = Path("include", "boost", BOOST_NAME)
Expand All @@ -21,6 +23,13 @@
("YOMM2_CLASS(ES)?|register_class(es)?", "BOOST_OPENMETHOD_CLASSES"),
)

modified = subprocess.check_output(
"git diff --name-only include/boost test".split(), encoding="ascii"
)

if modified:
sys.exit("Output directories have unstaged changes:\n" + modified)


def skip(path):
for skip in SKIP:
Expand All @@ -30,8 +39,6 @@ def skip(path):
return False


writeable = []

for from_path in list(YOMM2_INCLUDE.rglob("*.hpp")) + list(YOMM2_TESTS.rglob("*.?pp")):
if skip(from_path):
continue
Expand All @@ -54,20 +61,9 @@ def skip(path):

to_path.parent.mkdir(parents=True, exist_ok=True)

if to_path.exists():
if os.access(to_path, os.W_OK):
print("file is writeable, skipping")
writeable.append(to_path)
continue
os.chmod(to_path, 0o744)

with to_path.open("w") as f:
f.write(content)

check_call(["clang-format", "-i", str(to_path)])

os.chmod(to_path, 0o444)
print("done")

if writeable:
print("Skipped because writeable:", *writeable)
2 changes: 1 addition & 1 deletion test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ project
;

# list
run blackbox.cpp ;
run test_blackbox.cpp ;

# quick (for CI)
alias quick : blackbox ;
Expand Down

0 comments on commit 467981c

Please sign in to comment.