-
-
Save artem-kosenko/bb2f104e832b44e43fe5754bfd39e4fd to your computer and use it in GitHub Desktop.
Copy system packages into virtualenv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
/usr/bin/python2.7 syspkg.py bareos /usr/local/pyenv/versions/2.7.15
bareos
- module to copy/usr/local/pyenv
- path, there pyenv is installed