Closed SYury closed 1 week ago
I have no doubt that the script can be improved in many ways.
The fact is I have no computer with Windows running on it, so I tried to adapt it from the shell file I use (fzn-choco.sh
file) using Copilot and a plugin from IntelliJ 😄.
I could possibly look around for a PC and really test the script.
Hello I started to study an alternative in Python. The main problem was due to MiniZincIDE that only support executable MiniZinc doc.
But Nuitka makes possible to turn a Python app into an executable. It seems quite straightforward.
I suggest using the Python script instead of the bash script. This lets you run choco-solver with MiniZinc options outside MiniZincIDE. You can also integrate the executable you create with Nuitka directly into MiniZincIDE.
I pushed some changes.
You can have a look (master
branch) at MINIZINC.md that explains hopefully clearly enough how to generate the executable for MiniZinc.
Would you accept to test the solution?
Thank you, I'll test it when I have time.
I tested the script and I have two comments:
-cp .:{args.jar_file}
and I had to remove .:
to make it work on Windowsset "PY=%~dp0fzn-choco.py"
python3 %PY% %*
and passing this bat script to minizinc works. Maybe it should be added somewhere in the docs.
It seems a simpler alternative to maintain. I will simply remove the nuitka steps and add 2 files:
#!/bin/bash
# Call the python script with the arguments passed to this script
python3 fzn-choco.py "$@"
@echo off
:: Call the python script with the arguments passed to this script
set "PY=%~dp0fzn-choco.py"
python3 %PY% %*
and update the documentation and remove the .:
from fzn-choco.py
.
Describe the bug I tried adding Choco to MiniZinc IDE on Windows and encountered several problems with
fzn-choco.exe
script:.exe
extension it's actually a bat script, so the execution fails.The syntax of the command is incorrect.
. And even if it's fixed, there also is a logical error in the parsing, it considers path to flatzinc file as unrecognized argument.I'm not sure if the script is just wrong or some problems are caused by my Windows installation,
To Reproduce Try adding Choco to MiniZinc on Windows.
Expected behavior Everything should work.
Possible solution I managed to make it work with trial and error. It's quite ugly and I'm not sure I found every possible bug, but I can make a pull request if you want.
Environment (please complete the following information):