-
-
Save nZac/5b672bbc76bc1bd630f2 to your computer and use it in GitHub Desktop.
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 | |
from os import path as osp | |
import sys | |
import keyring | |
paths_to_link = ( | |
'/usr/lib/python2.7/dist-packages/dbus', | |
'/usr/lib/python2.7/dist-packages/_dbus_bindings.so', | |
'/usr/lib/python2.7/dist-packages/_dbus_glib_bindings.so', | |
) | |
def main(): | |
venv_dpath = os.environ.get('VIRTUAL_ENV') | |
if venv_dpath is None: | |
print >> sys.stderr, 'Error: not in a virtualenv' | |
venv_site_packages = os.path.join(venv_dpath, 'lib', 'python%s' % sys.version[:3], | |
'site-packages') | |
for dpath in paths_to_link: | |
base_name = osp.basename(dpath) | |
link_fpath = osp.join(venv_site_packages, base_name) | |
if not osp.exists(link_fpath): | |
os.symlink(dpath, link_fpath) | |
from keyring.backends.SecretService import Keyring as SSKeyring | |
keyring_backend = keyring.get_keyring() | |
if isinstance(keyring_backend, SSKeyring): | |
print 'OK: all done, you are good to go. Don\'t forget to install the SecreteStorage python package.' | |
else: | |
print >> sys.stderr, 'Error: expected SecretService keyring backend, but got {0}' \ | |
.format(keyring_backend) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment