Skip to content

Instantly share code, notes, and snippets.

@mmulich
Created February 24, 2015 17:18
Show Gist options
  • Select an option

  • Save mmulich/dde3a0b8b603391915f7 to your computer and use it in GitHub Desktop.

Select an option

Save mmulich/dde3a0b8b603391915f7 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
"""\
Symbolically links a virtualenv's site-packages to
the globaly Python's user site-packages directory.
This should be run with the global Python.
"""
import os
import site
import argparse
def main(argv=None):
"""Main process"""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('location', help="location of the virtualenv")
args = parser.parse_args(argv)
location = os.path.abspath(args.location)
# FIXME hard coded version.
location = os.path.join(location, 'lib/python2.7/site-packages')
site_packages = site.getusersitepackages()
os.unlink(site_packages)
os.symlink(location, site_packages)
return 0
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment