Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions ecbundle/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ def cmake_args(self):
return return_cmake_args

def create_scripts(self):
from .util import remove_prefix, remove_suffix

src_dir = self.src_dir()
build_dir = self.build_dir()
install_dir = self.install_dir()
Expand Down Expand Up @@ -517,11 +519,22 @@ def create_scripts(self):
cmake_args += " -DECBUILD_LOG_LEVEL=" + self.log()

options = self.bundle().options()
for opt in options:
arg = self.get(opt.key())
if arg:
if opt.cmake():
cmake_args += " " + " ".join(["-D" + o for o in opt.cmake(arg)])

# Apply bundle options in order given by user:
for posarg in sys.argv[1:]:
if posarg.startswith("--"):
posarg = remove_suffix(remove_prefix(posarg, "--"), "=.*").replace(
"-", "_"
)
for opt in options:
arg = self.get(opt.key())
if opt.key() == posarg:
if arg:
if opt.cmake():
cmake_args += " " + " ".join(
["-D" + o for o in opt.cmake(arg)]
)
break

if self.without_tests():
cmake_args += " -DENABLE_TESTS=OFF"
Expand Down
12 changes: 12 additions & 0 deletions ecbundle/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ def mkdir_p(path):
raise RuntimeError()


def remove_prefix(string, prefix):
import re

return re.sub(r"^{0}".format(prefix), "", string)


def remove_suffix(string, suffix):
import re

return re.sub(r"{0}$".format(suffix), "", string)


def symlink_force(target, link_name):
import errno
import os
Expand Down