framed-data/mcv — pull request #19 by elliot42 (2014-07-11 06:09:20+00:00)
Title: Add `mcv.file.link` symlink utility

This commit adds `mcv.file.link()`, which enables idempotent
symlinking, and atomic symlink moving.

You can use this to set up a symlink `link_name` that points
at `source`:

mcv.file.link('/home/source', '/opt/framed/target')

You can re-run the function with the same input and it will happily
no-op. If you re-run the function again with a different target, it
will automatically swap the symlink sources.

If the target already exists, it'll exception out unless you
specify force=True, in which case it'll delete the existing thing
and set up the new requested symlink.

This helps us deploy, because a pretty conventional way of deploying
it just maintaining a `latest` symlink to the latest export of
a codebase.