[pkg-boinc-commits] r332 - in trunk/boinc/debian: . extra

Frank S. Thomas fst-guest at costa.debian.org
Fri Jan 13 10:57:31 UTC 2006


Author: fst-guest
Date: 2006-01-13 10:57:31 +0000 (Fri, 13 Jan 2006)
New Revision: 332

Added:
   trunk/boinc/debian/extra/boinc_applinks
Removed:
   trunk/boinc/debian/extra/boinc_mk_app_links.py
Modified:
   trunk/boinc/debian/boinc-client.install
   trunk/boinc/debian/control
Log:
Renamed boinc_mk_app_links.py to boinc_applinks and added
command line options to it.


Modified: trunk/boinc/debian/boinc-client.install
===================================================================
--- trunk/boinc/debian/boinc-client.install	2006-01-13 00:03:01 UTC (rev 331)
+++ trunk/boinc/debian/boinc-client.install	2006-01-13 10:57:31 UTC (rev 332)
@@ -1,3 +1,3 @@
-debian/extra/gui_rpc_auth.cfg       etc/boinc-client
-debian/extra/boinc_mk_app_links.py  usr/bin
-debian/tmp/usr/bin/boinc_cmd        usr/bin
+debian/extra/gui_rpc_auth.cfg   etc/boinc-client
+debian/extra/boinc_applinks     usr/bin
+debian/tmp/usr/bin/boinc_cmd    usr/bin

Modified: trunk/boinc/debian/control
===================================================================
--- trunk/boinc/debian/control	2006-01-13 00:03:01 UTC (rev 331)
+++ trunk/boinc/debian/control	2006-01-13 10:57:31 UTC (rev 332)
@@ -9,7 +9,7 @@
 Package: boinc-client
 Section: net
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6)
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, adduser, lsb-base (>= 3.0-6)
 Suggests: boinc-manager | kboincspy
 Description: BOINC core client
  This package contains the BOINC core client program, that is required to

Copied: trunk/boinc/debian/extra/boinc_applinks (from rev 330, trunk/boinc/debian/extra/boinc_mk_app_links.py)
===================================================================
--- trunk/boinc/debian/extra/boinc_mk_app_links.py	2006-01-12 23:48:17 UTC (rev 330)
+++ trunk/boinc/debian/extra/boinc_applinks	2006-01-13 10:57:31 UTC (rev 332)
@@ -0,0 +1,88 @@
+#!/usr/bin/python2.3
+# -*- coding: utf-8 -*-
+#
+# This script creates symlinks for anonymous BOINC applications.
+# Copyright © 2006 Debian BOINC Maintainers
+#                  <pkg-boinc-devel at lists.alioth.debian.org>
+#
+# This file is licensed under the terms of the GNU General Public License,
+# Version 2 or any later version published by the Free Software Foundation.
+#
+# $Id$
+
+import optparse
+import os
+import sys
+
+app_info_dir = '/usr/share/boinc-client/app_info/'
+
+def main():
+    if not os.path.isdir(app_info_dir):
+        sys.exit(0)
+
+    opts = parse_options()
+
+    projects = {}
+
+    for file in os.listdir(app_info_dir):
+        if file.endswith('.py'):
+            if opts.project == '' or file == opts.project+'.py':
+                execfile(app_info_dir + file)
+
+    for project in projects:
+        for url in projects[project]['urls']:
+            project_dir = opts.data_dir + '/projects/' + url + '/'
+
+            if opts.create_symlink == True:
+                try:
+                    os.makedirs(project_dir)
+                except OSError:
+                    pass
+
+            renew_or_remove_symlink(projects[project]['app_info'],
+                project_dir + 'app_info.xml', opts.create_symlink)
+
+            for app in projects[project]['apps']:
+                renew_or_remove_symlink(app,
+                    project_dir + os.path.basename(app), opts.create_symlink)
+    return
+
+def renew_or_remove_symlink(src, dst, create_symlink):
+    if os.path.isfile(dst) and not os.path.islink(dst):
+        return
+    elif os.path.islink(dst):
+        os.remove(dst)
+
+    if create_symlink == True:
+        os.symlink(src, dst)
+
+    return
+
+def parse_options():
+    parser = optparse.OptionParser()
+
+    parser.add_option('--create', action='store_true',
+        dest='create_symlink',
+        help='create symlinks and project directories')
+
+    parser.add_option('--remove', action='store_false',
+        dest='create_symlink', help='remove symlinks')
+
+    parser.add_option('--data-dir', dest='data_dir',
+        default='', metavar='DIR',
+        help='destination directory for the symlinks')
+
+    parser.add_option('--project', dest='project',
+        default='', metavar='PROJECT',
+        help='create only symlinks for project PROJECT')
+
+    parser.set_defaults(create_symlink=True)
+    (opts, args) = parser.parse_args()
+
+    if opts.data_dir == '':
+        parser.error("option '--data-dir' is mandatory")
+
+    return opts
+
+if __name__ == '__main__':
+    main()

Deleted: trunk/boinc/debian/extra/boinc_mk_app_links.py
===================================================================
--- trunk/boinc/debian/extra/boinc_mk_app_links.py	2006-01-13 00:03:01 UTC (rev 331)
+++ trunk/boinc/debian/extra/boinc_mk_app_links.py	2006-01-13 10:57:31 UTC (rev 332)
@@ -1,57 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-# This script creates symlinks for anonymous BOINC applications.
-# Copyright © 2006 Debian BOINC Maintainers
-#                  <pkg-boinc-devel at lists.alioth.debian.org>
-#
-# This file is licensed under the terms of the GNU General Public License,
-# Version 2 or any later version published by the Free Software Foundation.
-#
-# $Id$
-
-import os
-import sys
-
-app_info_dir = '/usr/share/boinc-client/app_info/'
-
-def main():
-    if not os.path.isdir(app_info_dir):
-        sys.exit(0)
-
-    if len(sys.argv) < 2:
-        print >> sys.stderr, 'Error: missing path argument'
-        sys.exit(1)
-
-    projects = {}
-
-    for file in os.listdir(app_info_dir):
-        if file.endswith('.py'):
-            execfile(app_info_dir + file)
-
-    for project in projects:
-        for url in projects[project]['urls']:
-            project_dir = sys.argv[1] + '/projects/' + url + '/'
-            try:
-                os.makedirs(project_dir)
-            except OSError:
-                pass
-
-            renew_symlink(projects[project]['app_info'],
-                project_dir + 'app_info.xml')
-
-            for app in projects[project]['apps']:
-                renew_symlink(app, project_dir + os.path.basename(app))
-    return
-
-def renew_symlink(src, dst):
-    if os.path.isfile(dst) and not os.path.islink(dst):
-        return
-    elif os.path.exists(dst):
-        os.remove(dst)
-
-    os.symlink(src, dst)
-    return
-
-if __name__ == '__main__':
-    main()




More information about the pkg-boinc-commits mailing list