[med-svn] r13657 - trunk/packages/gnuhealth/trunk/debian

Emilien Klein e2jk-guest at alioth.debian.org
Sun May 19 18:35:08 UTC 2013


Author: e2jk-guest
Date: 2013-05-19 18:35:08 +0000 (Sun, 19 May 2013)
New Revision: 13657

Added:
   trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.install
   trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.links
   trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.py
Modified:
   trunk/packages/gnuhealth/trunk/debian/rules
Log:
New Python script that provides the `gnuhealth` command. It is a wrapper around tryton-client that takes care of seeding the user's installation with config files adapted for Debian's GNU Health server (which itself is a Tryton server automatically set up for use with GNU Health)


Added: trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.install
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.install	                        (rev 0)
+++ trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.install	2013-05-19 18:35:08 UTC (rev 13657)
@@ -0,0 +1,4 @@
+debian/gnuhealth-client.py usr/share/gnuhealth-client
+debian/gnuhealth-client.tryton.conf etc/gnuhealth
+debian/gnuhealth-client.profiles.cfg etc/gnuhealth
+

Added: trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.links
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.links	                        (rev 0)
+++ trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.links	2013-05-19 18:35:08 UTC (rev 13657)
@@ -0,0 +1,2 @@
+/usr/share/gnuhealth-client/gnuhealth-client.py /usr/bin/gnuhealth
+

Added: trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.py
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.py	                        (rev 0)
+++ trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.py	2013-05-19 18:35:08 UTC (rev 13657)
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+### BEGIN LICENSE
+# Copyright (C) 2013 Emilien Klein <emilien _PLUS_ debian _AT_ klein _DOT_ st>
+# 
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+# 
+# This program is distributed in the hope that it will be useful, but 
+# WITHOUT ANY WARRANTY; without even the implied warranties of 
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
+# PURPOSE.  See the GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License along 
+# with this program.  If not, see <http://www.gnu.org/licenses/>.
+### END LICENSE
+
+# This script is a wrapper around tryton-client.
+# If a config and/or a profiles file wasn't found, it will create a new default
+# config and/or profiles file that is configured for a server running on the
+# same machine.
+# In case the server is not on the same machine, the user will have to change
+# the server name at the first login, but port number, database name and user
+# will already be defaulted in.
+# After the default files are created, or if those files already exist,
+# tryton-client will be run.
+
+import os
+import subprocess
+import shutil
+
+if __name__ == "__main__":
+    #TODO: detect installed version of Tryton automatically
+    tryton_version = "2.6"
+    base_config_path = os.path.expanduser("~/.config/tryton/%s/" % tryton_version)
+    config_file = os.path.join(base_config_path, "tryton.conf")
+    default_config_file = "/etc/gnuhealth/gnuhealth-client.tryton.conf"
+    profiles_file = os.path.join(base_config_path, "profiles.cfg")
+    default_profiles_file = "/etc/gnuhealth/gnuhealth-client.profiles.cfg"
+
+    # Check if there already is a config file
+    if not os.path.isfile(config_file):
+        # Copy the default config file
+        shutil.copyfile(default_config_file, config_file)
+        # Make sure permissions are set appropriately
+        os.chmod(config_file, 0644)
+    # Check if there already is a profiles file
+    if not os.path.isfile(profiles_file):
+        # Copy the default profiles file
+        shutil.copyfile(default_profiles_file, profiles_file)
+        # Make sure permissions are set appropriately
+        os.chmod(profiles_file, 0644)
+
+    # Call the Tryton client
+    #TODO: pass the arguments given to gnuhealth-server to tryton-server
+    args = ["tryton-client"]
+    subprocess.Popen(args)
+


Property changes on: trunk/packages/gnuhealth/trunk/debian/gnuhealth-client.py
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/packages/gnuhealth/trunk/debian/rules
===================================================================
--- trunk/packages/gnuhealth/trunk/debian/rules	2013-05-19 18:32:48 UTC (rev 13656)
+++ trunk/packages/gnuhealth/trunk/debian/rules	2013-05-19 18:35:08 UTC (rev 13657)
@@ -23,6 +23,8 @@
 	find debian -name "health_qrcodes" -type d -prune -execdir rm -r \{\} \;
 	# Mark all the Python scripts non-executable
 	find debian -name "*.py"  -type f -executable -exec chmod a-x \{\} \;
+	# Mark the gnuhealth-client script executable
+	chmod a+x debian/gnuhealth-client.py
 	# Remove all the tests folders from the binary package
 	find debian -name "tests" -type d -prune -execdir rm -r \{\} \;
 	# Remove empty directories (locale folder of ICU module)




More information about the debian-med-commit mailing list