drivemounts /

Filename Size Date modified Message
28 B
1.4 KB
1.6 KB
992 B
Drivemounts is a short script I wrote. When it is imported, it will open
/proc/mounts and find all the "real" filesystems on your computer. Then, it
will scan the root of each for .pth files, each line of which should have a
relative path from the root of the drive. For every .pth file it finds, it will
join the relative paths in the .pth file with the drive's base and add that to
sys.path. For example, if you had a drive at ``/media/flashdrive`` with this
``python.pth`` file::


Then ``/media/flashdrive/Projects/Foo/lib``,
``/media/flashdrive/Projects/Spam/lib``, and ``/media/flashdrive/Sandbox``
will be added to your sys.path if they exist.

This only works on Linux, unless you have some flavor of UNIX with a
/proc/mounts file with the exact same syntax and semantics as Linux's. The
best way to use it is to put it somewhere on your existing ``sys.path`` and
put an ``import drivemounts`` line in a ``.pth`` file in your system or
personal ``site-packages`` directory. If the ``DRIVEMOUNTS_DEBUG`` environment
variable is set, it will print useful debug information.

If you want to install drivemounts, you can run ```` and
drivemounts and an appropriate .pth file will be copied to your ``USER_SITE``,
which is generally something like ``~/.local/lib/python2.6/site-packages``.
Specify another folder on the command line if you want it somewhere else.

Oh, and this is MIT licensed.