kang / Python Keyring Lib
This project is aimed to provide a general OS independent python keyring lib.
Clone this repository (size: 148.2 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/kang/python-keyring-lib/
| commit 61: | 66d909b2208f |
| parent 60: | eb002fd21c53 |
| branch: | default |
Fix the bug for kdeui lib detection.
Changed (Δ646 bytes):
raw changeset »
extensions.py (25 lines added, 4 lines removed)
Up to file-list extensions.py:
| … | … | @@ -4,6 +4,7 @@ build_ext.py |
4 |
4 |
Created by Kang Zhang on 2009-08-07 |
5 |
5 |
""" |
6 |
6 |
|
7 |
import os |
|
7 |
8 |
import sys |
8 |
9 |
import commands |
9 |
10 |
|
| … | … | @@ -32,6 +33,23 @@ def pkg_config(packages): |
32 |
33 |
|
33 |
34 |
return keywords |
34 |
35 |
|
36 |
def kde_exec(option): |
|
37 |
dirs = commands.getoutput("kde4-config %s" % option).split(':') |
|
38 |
if len(dirs) == 0: |
|
39 |
dirs = commands.getoutput("kde-config %s" % option).split(':') |
|
40 |
return dirs |
|
41 |
||
42 |
def kde_check(headfiles): |
|
43 |
includes = kde_exec('--install include') |
|
44 |
for filename in headfiles: |
|
45 |
# generate all possible paths for the headfile |
|
46 |
paths = [dir + filename for dir in includes] |
|
47 |
# check if any file exists |
|
48 |
exists = any([ os.path.exists(path) for path in paths]) |
|
49 |
if not exists: |
|
50 |
return False |
|
51 |
return True |
|
52 |
||
35 |
53 |
def kde_config(keywords): |
36 |
54 |
"""Add the compile parameter for kdelibs |
37 |
55 |
""" |
| … | … | @@ -41,10 +59,12 @@ def kde_config(keywords): |
41 |
59 |
# http://lists.kde.org/?t=109647896600005&r=1&w=2 |
42 |
60 |
|
43 |
61 |
keywords.setdefault('libraries', []).append('kdeui') |
44 |
libs = commands.getoutput("kde4-config --path lib").split(':') |
|
45 |
if len(libs) == 0: |
|
46 |
libs = commands.getoutput("kde-config --path lib").split(':') |
|
62 |
||
63 |
libs = kde_exec('--path lib') |
|
64 |
includes = kde_exec('--install include') |
|
65 |
||
47 |
66 |
keywords.setdefault('library_dirs', []).extend(libs) |
67 |
keywords.setdefault('include_dirs', []).extend(includes) |
|
48 |
68 |
return keywords |
49 |
69 |
|
50 |
70 |
def get_extensions(): |
| … | … | @@ -73,7 +93,8 @@ def get_extensions(): |
73 |
93 |
exts.append(gnome_keychain_module) |
74 |
94 |
|
75 |
95 |
kde_kwallet_libs = ['dbus-1', 'glib-2.0', 'QtGui'] |
76 |
|
|
96 |
kde_kwallet_headfiles = ['kwallet.h'] |
|
97 |
if pkg_check(kde_kwallet_libs) and kde_check(kde_kwallet_headfiles): |
|
77 |
98 |
# KDE Kwallet is installed. |
78 |
99 |
kde_kwallet_module = Extension('kde_kwallet', |
79 |
100 |
sources = ['keyring/backends/kde_kwallet.cpp'], |
