python-chmod-monkey
Add support for os.chmod('script.sh', 'ug+x') syntax style.
Almost any expression supported by GNU Coreutils chmod should be supported by this module.
[ugoa]*([-+=]([rwx]*|[ugo]))+|[-+=][0-7]+
Xst flags are not supported though.
Install
pip install chmod-monkey
Usage
There are two ways to use chmod-monkey.
Using os.chmod MonkeyPatch
import os
import chmod_monkey
chmod_monkey.install() # Install monkeypatch because we are evil !
os.chmod('script.sh', 'ug+x') # Magic :)
Using to_mode converter
import os
from chmod_monkey import to_mode
os.chmod('script.sh', to_mode('script.sh', 'ug+x')) # For serious people.
Other features
Context manager
You may use the following syntax to temporary change a file mode.
from chmod_monkey import tmp_chmod
with tmp_chmod('script.sh', "+w"):
pass # File permissions are modified in this block only
# File permissions are restored here
History
1.1.1 (2020-05-12)
- Add
exception_in_contextoption totmp_chmodand more data in context manager.
1.1.0 (2020-05-12)
- Add
tmp_chmodfunction to temporary apply a permission on a file in awithstatement.
1.0.0 (2020-05-11)
- First version
Metadata
Release files for chmod-monkey 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| chmod-monkey-1.1.1.tar.gz | 13.9 kB | Without provenance | Details |
Release files / chmod-monkey-1.1.1.tar.gz
| Download URL | chmod-monkey-1.1.1.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21e62bec91f1d671867a8f7a35f577c73d34ec24b2e14a6f309f2a882633b647
|
|
BLAKE2b-256 checksum How to use checksums |
c51deaab8765ea1c00676e0ad6e82ed5aa05b02e7a686f92f10211e981d3fcd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|
Security for chmod-monkey 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.