Skip to main content

Add support for `os.chmod('script.sh', 'ug+x')` syntax style.

Project description

python-chmod-monkey

PyPI PyPI - Python Version PyPI - License Build Status Code coverage

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('ug+x'))  # For serious people.

History

1.0.0 (2020-05-11)

  • First version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chmod-monkey-1.0.0.tar.gz (13.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page