--- a/pvl/args.py Mon Apr 01 16:27:30 2013 +0300
+++ b/pvl/args.py Mon Apr 22 00:17:41 2013 +0300
@@ -9,11 +9,16 @@
import logging; log = logging.getLogger('pvl.args')
-def parser (parser) :
+def parser (parser, setuid=None) :
"""
Return an optparse.OptionGroup.
"""
+ if setuid is None :
+ # autodetect: only if we will be capable of
+ # XXX: use linux capabilities?
+ setuid = (os.geteuid() == 0)
+
general = optparse.OptionGroup(parser, "General options")
general.add_option('-q', '--quiet', dest='loglevel', action='store_const', const=logging.ERROR, help="Less output")
@@ -23,8 +28,9 @@
general.add_option('--debug-module', action='append', metavar='MODULE',
help="Enable logging for the given logger/module name")
- general.add_option('--uid', help="Change uid")
- general.add_option('--gid', help="Change gid")
+ if setuid :
+ general.add_option('--uid', help="Change uid")
+ general.add_option('--gid', help="Change gid")
# defaults
parser.set_defaults(
--- a/setup.py Mon Apr 01 16:27:30 2013 +0300
+++ b/setup.py Mon Apr 22 00:17:41 2013 +0300
@@ -2,7 +2,7 @@
from glob import glob
-__version__ = '0.1'
+__version__ = '0.2-dev'
setup(
name = 'pvl-common',