Menu

#302 Windows batch wrapper could be better

v1.0_(example)
open
nobody
None
5
2019-01-23
2019-01-23
Zachary L
No

I usually run tools from the command-line because I'm apparently a weirdo. When I run the "quex" command, the qeux.bat script is run (which was added to my PATH from the installer). However, the batch script will do this: IF NOT ERRORLEVEL 0 EXIT 1. The problem with this is it exits the shell entirely. Looking at the rest of the script, it looks like there's an attempt to keep MS-DOS compatibility. If that is the case, I'd really suggest splitting the scripts into two, maybe quex.bat and quex-dos.bat. In order to keep my prompt open, I'm currently using my own script which looks like this:

@echo off
setlocal ENABLEEXTENSIONS

if "%QUEX_PATH%"=="" set QUEX_PATH=%~dp0
py -2 "%QUEX_PATH%\quex-exe.py" %*

This uses setlocal so it doesn't taint the environment and also makes sure that extensions are enabled in any scenario. The variables %~dp0 and %* depend on extensions.

In addition, I use the python launcher that comes with most python distributions which should help select a specific version of python to run quex with. This helps me in particular since I have various versions of python distributions and the default python in my PATH is a python3 installation.
https://www.python.org/dev/peps/pep-0397/

This should work from Windows NT 3.1 (or realistically Windows 2000) and above.

Anyways, I'm fine with using my own script to start quex but figured I'd share my experience where quex didn't start out of the box and annoyingly closed my cmd shell everytime I started it and it failed in some way.

Discussion

  • Zachary L

    Zachary L - 2019-01-23

    As an alternative, perhaps a distributed version on Windows would be more useful. For instance, attached is an experimental standalone quex executable I made using PyInstaller in a few minutes packaged with Python 2.7. I haven't really tested it but it seems to work well enough.

     
  • Frank-Rene Schäfer

    Thanks,

    would you, please, briefly compare the two solutions with respect to availabilty?
    Could you send the command lines to pack Quex with all the files?

     
  • Zachary L

    Zachary L - 2019-01-23

    Here's a basic chart to indicate support to my knowledge.

    The command line with PyInstaller is simple: pyinstaller -F quex-exe.py which I used on the latest release tarball. I haven't tried with py2exe.

     

    Last edit: Zachary L 2019-01-23

Log in to post a comment.