Skip to main content

Wrapper around sys/mount.h

Project description

PyPI - Python Version PyPI - License black

lint mypy

Simple python wrapper around sys/mount.h’s mount and umount2 libc functions.

Installation

This package is available on PyPI, so it can be installed with pip or another regular package manager you use:

python3 -m pip install mount

Usage

This library is a tiny wrapper around mount and umount2 functions, so most information about them you can find in man 2 mount and man 2 umount.

Generally there are only 4 objects provided by this package:

  • mount.mount function that is wrapper around mount libc function.

  • mount.umount function that is wrapper around umount2 libc function.

  • mount.MountFlag enum with available mount flags.

  • mount.UmountFlag enum with available umount flags.

mount and umount functions raises OSError on errors.

Here is a simple script that will mount in-memory 1G temporary filesystem with NOEXEC and NOSYMFOLLOW flags in temporary created directory:

from tempfile import TemporaryDirectory
from mount import mount, MountFlag


if __name__ == "__main__":
    target = TemporaryDirectory()
    mount("tmpfs", target.name, "tmpfs", MountFlag.NOEXEC | MountFlag.NOSYMFOLLOW, "size=1G")
    print("Mounted to: ", target)

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

mount-1.0.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

mount-1.0.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file mount-1.0.0.tar.gz.

File metadata

  • Download URL: mount-1.0.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Linux/5.15.0-1035-azure

File hashes

Hashes for mount-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4510eaf4282a9634ace9982705da7c70857d1b09f73f589118f5a0c648e71ece
MD5 522ee3a0550e08895bd3dc8cb9a0fade
BLAKE2b-256 2b1d573e15d724b3a8dedec8ef07d48df03c0283a903c4bfcb18e2e42c0b53c3

See more details on using hashes here.

File details

Details for the file mount-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mount-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Linux/5.15.0-1035-azure

File hashes

Hashes for mount-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed87c97be0e49afc04f7e973fc7dfb23155f7865eaac312db4b47bc1fada9f39
MD5 3389017f5fe225b4d02701f3b6971db6
BLAKE2b-256 521bb0c4b0ebb3a8f0673b3596befd820836a2529f8495d5fa99455708782c6b

See more details on using hashes here.

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