/usr/bin/gjots2 is in gjots2 2.4.1-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | #! /usr/bin/python
import sys, os, getopt
import linecache
def traceit(frame, event, arg):
if event == "line" or event == "call":
lineno = frame.f_lineno
filename = frame.f_globals["__file__"]
if (filename.endswith(".pyc") or
filename.endswith(".pyo")):
filename = filename[:-1]
name = frame.f_globals["__name__"]
line = linecache.getline(filename, lineno)
print "%s:%s:%s: %s" % (event, name, lineno, line.rstrip())
return traceit
def ver2str(ver):
return ".".join(map(str,ver))
#from Gjots.gui import *
#from Gjots.version import version
def usage():
print _("""Usage: gjots [OPTIONS] [FILENAME]
A gtk/X11 jotter
OPTIONS:
-h, --help: this help
-d, --debug: debug to stdout
-2, --glade2: use glade-2 gui if available
-t, --trace: trace lines as they execute
-g 123x456, --geometry=123x456: initial geometry (X x Y)
-p, --purge-password don't remember password
-r, --readonly: no editing (or locking)
-V, --version: print the version and exit
FILENAME:
gjots data filename (default is $HOME/.gjotsfile)
""")
if __name__ == '__main__':
pyver = (2,5)
pygtkver = (2,16,0)
# gjots2 might be: 'prefix' is then
# /usr/bin/gjots2 /usr
# /bin/gjots2 (fedora-18) /usr
# /usr/local/bin/gjots2 /usr/local
# /foo/bar/gjots2 /foo
# ./gjots2 ./
dirName, progName = os.path.split(sys.argv[0])
# prefix, bin = os.path.split(dirName)
prefix = dirName
# fedora-18 puts things in /usr/bin but arg0 is /bin/gjots2 !!!!
if dirName == "/bin" and os.access("/usr" + sys.argv[0], os.F_OK):
prefix = "/usr/bin"
prefix, junk = os.path.split(prefix)
#
# Add the library path to the system load path
#
# developer should use local version executed from the current directory:
localdir = os.curdir + "/lib"
if os.access(localdir, os.F_OK) and os.access("ui/gjots.ui", os.F_OK):
prefix = localdir
sys.path = [ localdir ] + sys.path
sys.stderr.write("%s: Warning: running modules from %s\n" % (progName, localdir))
else:
sys.path = [ prefix + '/lib/gjots2' ] + sys.path
# i18n support
import gettext
import locale
# Locale setting in gtk.Builder appears somewhat broken under Python. See:
# https://bugzilla.gnome.org/show_bug.cgi?id=574520
locale_domain = "gjots2"
locale_dir = prefix + "/share/locale"
gettext.bindtextdomain(locale_domain, locale_dir)
locale.setlocale(locale.LC_ALL, '')
gettext.textdomain(locale_domain)
gettext.install(locale_domain, localedir=locale_dir, unicode=True)
try:
locale.bindtextdomain(locale_domain, locale_dir)
locale.bind_textdomain_codeset(locale_domain, 'UTF-8')
except locale.Error:
print "Couldn't bind the translation domain. Some translations won't work."
_ = gettext.gettext
#
# python version
#
if sys.version_info[:2] < pyver:
sys.stderr.write(_("%s requires python%s or higher.") % (progName, ver2str(pyver)))
sys.exit(1)
#
# pygtk version
#
try:
import pygtk
except ImportError, err:
print err
sys.stderr.write(_("%s requires pygtk-%s.\n") % (progName, ver2str(pygtkver)))
sys.exit(1)
else:
pygtk.require("2.0")
from gui import *
from version import *
try:
opts, args = getopt.getopt(sys.argv[1:], "2hdrtg:V", ["help", "glade2", "debug", "readonly", "trace", "geometry=", "version"])
except getopt.GetoptError, errmsg:
sys.stderr.write("%s: %s\n" % (progName, errmsg))
sys.stderr.write(_("Use -h for help\n"))
sys.exit(2)
readonly = 0
output = None
geometry = ""
prefs = ""
debug = 0
purge_password = 0
use_glade2 = 0
for o, a in opts:
if o in ("-h", "--help"):
usage()
sys.exit(0)
if o in ("-V", "--version"):
print _("%s version %s") % (progName, gjots_version)
sys.exit(0)
if o in ("-2", "--glade2"):
use_glade2 = 1
if o in ("-p", "--purge-password"):
purge_password = 1
if o in ("-r", "--readonly"):
readonly = 1
if o in ("-g", "--geometry"):
geometry = a
if o in ("-d", "--debug"):
debug = 1
if o in ("-t", "--trace"):
sys.settrace(traceit)
if len(args):
filename = args[0]
else:
filename = os.environ["HOME"]+"/.gjotsfile"
if not os.access(filename, os.R_OK):
os.system("touch " + filename)
gui = gjots_gui(prefix, progName, geometry, filename, readonly, debug, purge_password, use_glade2)
gtk.main()
# Local variables:
# eval:(setq compile-command "./gjots2 test.gjots")
# eval:(setq-default indent-tabs-mode 1)
# eval:(setq tab-width 4)
# eval:(setq python-indent 4)
# End:
|