[Python-apps-commits] r5769 - in packages/pyrit/trunk/debian (3 files)

chrisk-guest at users.alioth.debian.org chrisk-guest at users.alioth.debian.org
Tue Jul 6 19:39:39 UTC 2010


    Date: Tuesday, July 6, 2010 @ 19:39:26
  Author: chrisk-guest
Revision: 5769

Add patch to support custom config file

Added:
  packages/pyrit/trunk/debian/patches/0006-custom-config-file.patch
Modified:
  packages/pyrit/trunk/debian/changelog
  packages/pyrit/trunk/debian/patches/series

Modified: packages/pyrit/trunk/debian/changelog
===================================================================
--- packages/pyrit/trunk/debian/changelog	2010-07-06 19:36:40 UTC (rev 5768)
+++ packages/pyrit/trunk/debian/changelog	2010-07-06 19:39:26 UTC (rev 5769)
@@ -7,5 +7,6 @@
     - 0003-Add-man-page-for-pyrit-1
     - 0004-Fixed-deprecation-warning-generated-by-sql-alchemy
     - 0005-Link-against-libcrypto-not-libssl
+    - 0006-custom-config-file
 
  -- Christian Kastner <debian at kvr.at>  Thu, 20 May 2010 14:43:26 +0200

Added: packages/pyrit/trunk/debian/patches/0006-custom-config-file.patch
===================================================================
--- packages/pyrit/trunk/debian/patches/0006-custom-config-file.patch	                        (rev 0)
+++ packages/pyrit/trunk/debian/patches/0006-custom-config-file.patch	2010-07-06 19:39:26 UTC (rev 5769)
@@ -0,0 +1,38 @@
+From: Christian Kastner <debian at kvr.at>
+Date: Tue, 6 Jul 2010 21:26:16 +0200
+Subject: [PATCH] Support custom config file location
+
+This patch adds the ability to specify a custom config file via the environment
+variable PYRIT_CONFIG_PATH.
+
+Forwarded: yes 
+Last-Update: 2010-07-06
+Index: pyrit-0.3.0/cpyrit/config.py
+===================================================================
+--- pyrit-0.3.0.orig/cpyrit/config.py	2010-07-06 21:25:49.757926753 +0200
++++ pyrit-0.3.0/cpyrit/config.py	2010-07-06 21:26:41.385840773 +0200
+@@ -56,10 +56,18 @@
+ configpath = os.path.expanduser(os.path.join('~', '.pyrit'))
+ default_configfile = os.path.join(configpath, 'config')
+ 
+-if os.path.exists(default_configfile):
+-    cfg = read_configfile(default_configfile)
++if 'PYRIT_CONFIG_FILE' in os.environ:
++    custom_config = os.environ['PYRIT_CONFIG_FILE']
++    if not os.path.exists(custom_config):
++        print >> sys.stderr, \
++            "WARNING: custom config file %s does not exist" % custom_config
++    else:
++        cfg = read_configfile(custom_config)
+ else:
+-    cfg = default_config()
+-    if not os.path.exists(configpath):
+-        os.makedirs(configpath)
+-    write_configfile(cfg, default_configfile)
++    if os.path.exists(default_configfile):
++        cfg = read_configfile(default_configfile)
++    else:
++        cfg = default_config()
++        if not os.path.exists(configpath):
++            os.makedirs(configpath)
++        write_configfile(cfg, default_configfile)

Modified: packages/pyrit/trunk/debian/patches/series
===================================================================
--- packages/pyrit/trunk/debian/patches/series	2010-07-06 19:36:40 UTC (rev 5768)
+++ packages/pyrit/trunk/debian/patches/series	2010-07-06 19:39:26 UTC (rev 5769)
@@ -3,3 +3,4 @@
 0003-Add-man-page-for-pyrit-1.patch
 0004-Fixed-deprecation-warning-generated-by-sql-alchemy.patch
 0005-Link-against-libcrypto-not-libssl.patch
+0006-custom-config-file.patch




More information about the Python-apps-commits mailing list