Skip to content

Commit

Permalink
Apply black pre-commit changes
Browse files Browse the repository at this point in the history
  pre-commit run -a black
  • Loading branch information
dbarbier committed Sep 22, 2021
1 parent 7760873 commit db9911b
Show file tree
Hide file tree
Showing 178 changed files with 20,721 additions and 10,938 deletions.
87 changes: 51 additions & 36 deletions builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,24 @@ def build_cmake_extension(self, ext: CMakeExtension) -> None:
"""

# Get the absolute path to the build folder
build_folder = str(Path('.').absolute() / f"{self.build_temp}_{ext.name}")
build_folder = str(Path(".").absolute() / f"{self.build_temp}_{ext.name}")

# Make sure the build folder exists
Path(build_folder).mkdir(exist_ok=True, parents=True)

configure_command = ['cmake', '-S', ext.source_dir, '-B', build_folder] + configure_args
configure_command = [
"cmake",
"-S",
ext.source_dir,
"-B",
build_folder,
] + configure_args

build_command = ['cmake', '--build', build_folder] + build_args
build_command = ["cmake", "--build", build_folder] + build_args

install_command = ['cmake', '--install', build_folder]
install_command = ["cmake", "--install", build_folder]
if ext.cmake_component is not None:
install_command.extend(['--component', ext.cmake_component])
install_command.extend(["--component", ext.cmake_component])

print(f"$ {' '.join(configure_command)}")
print(f"$ {' '.join(build_command)}")
Expand All @@ -143,7 +149,8 @@ def build_cmake_extension(self, ext: CMakeExtension) -> None:
def copy_extensions_to_source(self):
original_extensions = list(self.extensions)
self.extensions = [
ext for ext in self.extensions
ext
for ext in self.extensions
if not isinstance(ext, CMakeExtension) or not ext.disable_editable
]
super().copy_extensions_to_source()
Expand All @@ -159,37 +166,45 @@ def build(setup_kwargs: Dict[str, Any]) -> None:
source_dir="cpp",
install_prefix="",
cmake_configure_options=[
f"-DPYTHON_EXECUTABLE={Path(sys.executable)}",
f"-DONLY_PYTHON=ON",
]),
f"-DPYTHON_EXECUTABLE={Path(sys.executable)}",
f"-DONLY_PYTHON=ON",
],
),
]
if 'SKDECIDE_SKIP_DEPS' not in os.environ or os.environ['SKDECIDE_SKIP_DEPS'] == '0':
cmake_modules.extend([
CMakeExtension(
name="chuffed",
disable_editable=True,
source_dir="cpp/deps/chuffed",
install_prefix="skdecide/hub",
cmake_configure_options=[
f"-DBISON_EXECUTABLE=false",
f"-DFLEX_EXECUTABLE=false",
]),
CMakeExtension(
name="gecode",
disable_editable=True,
source_dir="cpp/deps/gecode",
install_prefix="skdecide/hub",
cmake_configure_options=[
]),
CMakeExtension(
name="libminizinc",
disable_editable=True,
source_dir="cpp/deps/libminizinc",
install_prefix="skdecide/hub",
cmake_configure_options=[
f"-DBUILD_SHARED_LIBS:BOOL=OFF",
]),
])
if (
"SKDECIDE_SKIP_DEPS" not in os.environ
or os.environ["SKDECIDE_SKIP_DEPS"] == "0"
):
cmake_modules.extend(
[
CMakeExtension(
name="chuffed",
disable_editable=True,
source_dir="cpp/deps/chuffed",
install_prefix="skdecide/hub",
cmake_configure_options=[
f"-DBISON_EXECUTABLE=false",
f"-DFLEX_EXECUTABLE=false",
],
),
CMakeExtension(
name="gecode",
disable_editable=True,
source_dir="cpp/deps/gecode",
install_prefix="skdecide/hub",
cmake_configure_options=[],
),
CMakeExtension(
name="libminizinc",
disable_editable=True,
source_dir="cpp/deps/libminizinc",
install_prefix="skdecide/hub",
cmake_configure_options=[
f"-DBUILD_SHARED_LIBS:BOOL=OFF",
],
),
]
)
ext_modules = cython_modules + cmake_modules

f = "cpp/deps/gecode/CMakeLists.txt"
Expand Down
Loading

0 comments on commit db9911b

Please sign in to comment.