[Getan-commits] [PATCH 4 of 5] Rename getan-eval.py to getaneval.py

Wald Commits scm-commit at wald.intevation.org
Thu Jun 28 16:29:46 CEST 2018


# HG changeset patch
# User Magnus Schieder <mschieder at intevation.de>
# Date 1530191179 -7200
# Node ID 40dd1e33c1ddc9bb3d349c76762e26066f8dfe00
# Parent  d47e32e6b7e79e7443e7267de0569b08f1d8093b
Rename getan-eval.py to getaneval.py

getaneval.py is now installed as a script.

diff -r d47e32e6b7e7 -r 40dd1e33c1dd CHANGES
--- a/CHANGES	Thu Jun 28 12:01:16 2018 +0200
+++ b/CHANGES	Thu Jun 28 15:06:19 2018 +0200
@@ -1,12 +1,20 @@
 2.x 20xx-xx-xx UNRELEASED
 
+ * getaneval.py (before getan-eval.py) can now be run directly without
+   PYTHONPATH.
+   getaneval.py is now installed as a script. More information can be found in
+   ./doc/old_issues.txt -20170504 BER
+   Patch by Magnus Schieder
+
  * The logging can now be switched on and off. The default value is off.
    If logging is off, no log file is created.
    More information can be found in ./doc/old_issues.txt -20170504 BER
+   Patch by Magnus Schieder
 
  * Add a redraw function on key Control-L.
    The screen is completely redrawn. More information can be found in
    ./doc/old_issues.txt -20180321 BER
+   Patch by Magnus Schieder
 
  * Better fix for the multiple selection bug.
    The multiple selection is deleted when deleting or moving is confirmed or
diff -r d47e32e6b7e7 -r 40dd1e33c1dd TODO
--- a/TODO	Thu Jun 28 12:01:16 2018 +0200
+++ b/TODO	Thu Jun 28 15:06:19 2018 +0200
@@ -20,9 +20,6 @@
     So ent1 and ent2 should not highlighted anymore.
 
 
-20170709 BER: Give scripts/getan-eval.py a more specific name and add
-  it as a script to be installed.
-
 20160912 BER: Better code: states.py: classes EditEntryState and
   AdjustEntryState have same methods exit() and set_focus(), maybe join them?
 
diff -r d47e32e6b7e7 -r 40dd1e33c1dd doc/old_issues.txt
--- a/doc/old_issues.txt	Thu Jun 28 12:01:16 2018 +0200
+++ b/doc/old_issues.txt	Thu Jun 28 15:06:19 2018 +0200
@@ -1,3 +1,6 @@
+20170709 BER: Give scripts/getan-eval.py a more specific name and add
+  it as a script to be installed.
+
 20170504 BER: Some multi-user installations do not want a logfile by default.
   We could solve this requirement by making it configurable.
 
diff -r d47e32e6b7e7 -r 40dd1e33c1dd scripts/getan-eval.py
--- a/scripts/getan-eval.py	Thu Jun 28 12:01:16 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# (c) 2013, 2014 by Björn Ricks <bjoern.ricks at intevation.de>
-#
-# This is Free Software licensed under the terms of GPLv3 or later.
-# For details see LICENSE coming with the source of 'getan'.
-
-import codecs
-import locale
-import sys
-
-from datetime import date, datetime, timedelta
-import argparse
-
-from getan.template import render
-
-
-def main():
-    usage='getan-eval.py [options]'
-    parser = argparse.ArgumentParser(prog='getan', usage=usage)
-
-    parser.add_argument('-d', '--database', dest='database',metavar="DATABASE",
-                        help='metavar="DATABASE')
-    parser.add_argument('-t', '--template', dest='template',
-                        metavar='TEMPLATE', help='name of getan template')
-    parser.add_argument('-u', '--user', dest='user', help='name of user')
-    parser.add_argument('-p', '--project', dest='project',
-                        help='key of output project')
-    parser.add_argument('-w', '--week', type=int, dest='week',
-                        help='week of year')
-    parser.add_argument('-y', '--year', type=int, dest='year', help='year')
-    parser.add_argument('-c', '--lastweek', dest='lastweek',
-                        help='entries of last working week',
-                        action='store_true')
-    parser.add_argument('-m', '--empty', dest='empty',
-                        help='show projects without an entries',
-                        action="store_true")
-    parser.add_argument('--encoding', dest='encoding',
-                        help='encoding of output', metavar='ENCODING')
-
-    args = parser.parse_args()
-
-    if args.lastweek:
-        week = (datetime.now() - timedelta(7)).isocalendar()[1]
-        year = int(date.today().strftime("%Y"))
-    else:
-        year = args.year
-        week = args.week
-
-    template_name = args.template or "wochenbericht"
-
-    if not args.encoding:
-        encoding = locale.getdefaultlocale()[1] or "utf-8"
-
-    sys.stdout = codecs.getwriter(encoding)(sys.stdout.detach())
-
-    user = None
-    if args.user:
-        user = args.user.decode(encoding)
-
-    print(render(database=args.database, user=user,
-                 template=template_name, year=year, week=week,
-                 project=args.project, empty_projects=args.empty))
-
-
-if __name__ == '__main__':
-    main()
-
-# vim:set ts=4 sw=4 si et sta sts=4 :
diff -r d47e32e6b7e7 -r 40dd1e33c1dd scripts/getaneval.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/getaneval.py	Thu Jun 28 15:06:19 2018 +0200
@@ -0,0 +1,70 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# (c) 2013, 2014 by Björn Ricks <bjoern.ricks at intevation.de>
+#
+# This is Free Software licensed under the terms of GPLv3 or later.
+# For details see LICENSE coming with the source of 'getan'.
+
+import codecs
+import locale
+import sys
+
+from datetime import date, datetime, timedelta
+import argparse
+
+from getan.template import render
+
+
+def main():
+    usage='getan-eval.py [options]'
+    parser = argparse.ArgumentParser(prog='getan', usage=usage)
+
+    parser.add_argument('-d', '--database', dest='database',metavar="DATABASE",
+                        help='metavar="DATABASE')
+    parser.add_argument('-t', '--template', dest='template',
+                        metavar='TEMPLATE', help='name of getan template')
+    parser.add_argument('-u', '--user', dest='user', help='name of user')
+    parser.add_argument('-p', '--project', dest='project',
+                        help='key of output project')
+    parser.add_argument('-w', '--week', type=int, dest='week',
+                        help='week of year')
+    parser.add_argument('-y', '--year', type=int, dest='year', help='year')
+    parser.add_argument('-c', '--lastweek', dest='lastweek',
+                        help='entries of last working week',
+                        action='store_true')
+    parser.add_argument('-m', '--empty', dest='empty',
+                        help='show projects without an entries',
+                        action="store_true")
+    parser.add_argument('--encoding', dest='encoding',
+                        help='encoding of output', metavar='ENCODING')
+
+    args = parser.parse_args()
+
+    if args.lastweek:
+        week = (datetime.now() - timedelta(7)).isocalendar()[1]
+        year = int(date.today().strftime("%Y"))
+    else:
+        year = args.year
+        week = args.week
+
+    template_name = args.template or "wochenbericht"
+
+    if not args.encoding:
+        encoding = locale.getdefaultlocale()[1] or "utf-8"
+
+    sys.stdout = codecs.getwriter(encoding)(sys.stdout.detach())
+
+    user = None
+    if args.user:
+        user = args.user
+
+    print(render(database=args.database, user=user,
+                 template=template_name, year=year, week=week,
+                 project=args.project, empty_projects=args.empty))
+
+
+if __name__ == '__main__':
+    main()
+
+# vim:set ts=4 sw=4 si et sta sts=4 :
diff -r d47e32e6b7e7 -r 40dd1e33c1dd setup.py
--- a/setup.py	Thu Jun 28 12:01:16 2018 +0200
+++ b/setup.py	Thu Jun 28 15:06:19 2018 +0200
@@ -54,6 +54,7 @@
        os.path.join(scripts_dir, "convert-projects")],
       entry_points={"console_scripts":
                     ["getan=getan.main:main",
+                     "getaneval=scripts.getaneval:main",
                      ]},
       classifiers=[
           "Development Status :: 5 - Production/Stable",


More information about the Getan-commits mailing list