Skip to content

Commit

Permalink
fix patch & add warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pet-mit committed Feb 20, 2025
1 parent eee4fd1 commit 2db1d9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 6 additions & 6 deletions patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

full_patch.append(
Addition(
Path.cwd()/'cmake'/'cpp.cmake',
' $<$<BOOL:${USE_SCIP}>:libscip>\n',
' $<$<BOOL:${USE_SIRIUS}>:sirius_solver>\n'))
Path.cwd()/'cmake'/'cpp.cmake',
' ${SCIP_DEPS}\n',
' $<$<BOOL:${USE_SIRIUS}>:sirius_solver>\n'))
full_patch.append(Addition(
Path.cwd()/'cmake'/'cpp.cmake',
'''
Expand Down Expand Up @@ -60,7 +60,7 @@
Path.cwd()/'cmake'/'ortoolsConfig.cmake.in',
'''
if(@USE_SCIP@)
if(NOT scip_FOUND AND NOT TARGET libscip)
if(NOT TARGET libscip)
find_dependency(SCIP REQUIRED)
endif()
endif()
Expand All @@ -81,13 +81,13 @@
Path.cwd()/'examples'/'cpp'/'linear_programming.cc',
' RunLinearProgrammingExample("XPRESS_LP");\n',
' RunLinearProgrammingExample("SIRIUS_LP");\n'
))
))

full_patch.append(Addition(
Path.cwd()/'examples'/'dotnet'/'cslinearprogramming.cs',
' RunLinearProgrammingExample("XPRESS_LP");\n',
' RunLinearProgrammingExample("SIRIUS_LP");\n'
))
))

full_patch.append(Addition(
Path.cwd()/'examples'/'java'/'LinearProgramming.java',
Expand Down
3 changes: 3 additions & 0 deletions patch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
def replace_in_file(filepath, search, replace):
with open(filepath, 'r', encoding="utf8") as file:
data = file.read()
if search not in data:
print(f"File {filepath}: string {search} not found, replace skipped")
return
if replace not in data:
data = data.replace(search, replace)
else:
Expand Down

0 comments on commit 2db1d9d

Please sign in to comment.