shlex for windows
Project description
shlex for windows
Free software: Apache Software License 2.0
Documentation: https://mslex.readthedocs.io.
Features
This is the missing shlex package for windows shell quoting. It provides three functions – split, quote, and join – just like shlex.
Windows Quoting
Since time immemorial, windows quoting behavior has been strange. Prior to (I think) Visual Studio 2005, it exhibited the extremely strange modulo 3 periodic behavior which is emulated here in split_msvcrt(). Programs compiled with the C runtime from Visual Studio 2005 and later exhibit the somewhat less strange behavior emulated in split_ucrt().
Microsoft still ships a dll called msvcrt.dll as part of Windows, for compatibility reasons. And even though they have been very clear in their documentation that nobody should ever link against this dll, people still do, either for compatibility reasons of their own, or because it is universally available on any version of windows you might care about without needing to run an installer. And msvcrt.dll preserves the extremely strange argument parsing behavior from prior to VS 2005.
You can can download the latest version of msys2 today and build an executable linking msvcrt.dll on Windows 11, and it will parse arguments like Windows 95.
mslex will produce quoted strings that will be parsed correctly by either modern C runtimes or by msvcrt.dll. When parsing, mslex parses it both ways and raises an error if they disagree. This can be overridden by passing ucrt=True or ucrt=False to split.
See also:
Automatic selection between mslex and shlex
If you want to automatically use mslex on Windows, and shlex otherwise, check out the oslex package.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mslex-1.3.0.tar.gz
.
File metadata
- Download URL: mslex-1.3.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 641c887d1d3db610eee2af37a8e5abda3f70b3006cdfd2d0d29dc0d1ae28a85d |
|
MD5 | 2af2a4af241887361a6823223daf6fee |
|
BLAKE2b-256 | e0977022667073c99a0fe028f2e34b9bf76b49a611afd21b02527fbfd92d4cd5 |
File details
Details for the file mslex-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: mslex-1.3.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7074b347201b3466fc077c5692fbce9b5f62a63a51f537a53fbbd02eff2eea4 |
|
MD5 | 55d1b149f74043c95a4b49cdc9a2f15e |
|
BLAKE2b-256 | 64f266bd65ca0139675a0d7b18f0bada6e12b51a984e41a76dbe44761bf1b3ee |