Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python cmdline parser for variants #180

Merged
merged 5 commits into from
Sep 25, 2024
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
matrix:
# windows-latest async does not support it for now
operating-system: [macos-latest, ubuntu-latest]
ocaml-version: [ '4.14.0', '4.08.1' ]
ocaml-version: [ '5.2.0', '4.14.0' ]
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Cache pip
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Install Python dependencies
run: pip install pylint pycodestyle
- name: Install OCaml
uses: ocaml/setup-ocaml@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-version }}
- name: Install OCaml dependencies
Expand Down
6 changes: 4 additions & 2 deletions src/lib/pythongen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ class ListAction(argparse.Action):

let compat_block =
[ Line "get_str = str"
; Line "if sys.version_info[0] > 2:"
; Block [ Line "long = int"; Line "unicode = str"; Line "str = bytes" ]
; Line "long = int"
; Line "unicode = str"
; Line "str = bytes"
; Line ""
]

Expand Down Expand Up @@ -699,6 +700,7 @@ let commandline_parse _ (BoxedFunction m) =
| Basic Int32 -> ", type=int"
| Basic Bool -> ", type=lambda x: json.loads(x.lower())"
| Basic Float -> ", type=float"
| Variant _ -> ", type=json.loads"
| _ -> "")))
inputs
@ [ Line "return vars(parser.parse_args())" ])
Expand Down
Loading