public
Created

Copy system packages into virtualenv

  • Download Gist
syspkg.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import os
import sys
import shutil
 
pkgname = sys.argv[1]
venv = sys.argv[2]
pyversion = '%s.%s' % (sys.version_info[0], sys.version_info[1])
 
try:
pkgobj = __import__(pkgname)
except Exception as e:
print e
sys.exit(1)
 
pkgdir = os.path.dirname(pkgobj.__file__)
dst = '%s/lib/python%s/site-packages/%s' % (venv, pyversion, pkgname)
shutil.copytree(pkgdir, dst)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.