Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constants for gpg path now being handled by util.gpg_path_test function #102

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libpius/constants.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# vim:shiftwidth=2:tabstop=2:expandtab:textwidth=80:softtabstop=2:ai:

import os
import util

VERSION = '2.2.6'
HOME = os.environ.get('HOME')
GNUPGHOME = os.environ.get('GNUPGHOME', os.path.join(HOME, '.gnupg'))
DEFAULT_GPG_PATH = '/usr/bin/gpg2'
DEFAULT_GPG_PATH = gpg_path_test()
DEFAULT_KEYRING = os.path.join(GNUPGHOME, 'pubring.gpg')
DEFAULT_TMP_DIR = '/tmp/pius_tmp'
DEFAULT_OUT_DIR = '/tmp/pius_out'
Expand Down
15 changes: 15 additions & 0 deletions libpius/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,19 @@ class MyOption(Option):
'keyid': check_keyid,
})

def which(pgm):
path=os.getenv('PATH')
for p in path.split(os.path.pathsep):
p=os.path.join(p,pgm)
if os.path.exists(p) and os.access(p,os.X_OK):
return p
else:
return ""

def gpg_path_test():
if(which("gpg2") != ""):
return which("gpg2")
else:
return "/usr/bin/gpg2"

# END Stupid python optparse hack.
4 changes: 2 additions & 2 deletions pius-keyring-mgr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ DEFAULT_KEYSERVERS = [
]
HOME = os.environ.get('HOME')
GNUPGHOME = os.environ.get('GNUPGHOME', os.path.join(HOME, '.gnupg'))
DEFAULT_GPG_PATH = '/usr/bin/gpg'
DEFAULT_GPG_PATH = gpg_path_test()
DEFAULT_CSV_DELIMITER = ','
DEFAULT_CSV_NAME_FIELD = 2
DEFAULT_CSV_EMAIL_FIELD = 3
Expand Down Expand Up @@ -453,7 +453,7 @@ Subject: %(party)sPGP Keysignign Party: Can't find your key!''' % interp
util.logcmd(cmd)
ret = subprocess.call(cmd, shell=False)
sys.exit(ret)

# END class KeyringBuilder


Expand Down