<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">Index: contrib/hook-scripts/svn2rss.py
===================================================================
--- contrib/hook-scripts/svn2rss.py	(revision 20465)
+++ contrib/hook-scripts/svn2rss.py	(working copy)
@@ -59,7 +59,22 @@
       usage_and_exit("svn2rss.py: Invalid url '%s' is specified for " \
                      "'%s' option" % (url, opt))
 
+def get_svn_path():
+    """ Scan the PATH environment variable and locate svnlook
+    command.  If it is not found in any of those directories, throw
+    an error and suggest the user to pass --svn-path option """
 
+    paths = os.environ['PATH']
+    paths = paths.split (":")
+
+    for path in paths:
+        svnlook = path + "/svnlook"
+        if (os.path.exists (svnlook)):
+            return path
+
+    usage_and_exit ("svn2rss.py: Unable to find 'svnlook' command in your PATH.\n" +
+                    "                   Please specify the path using --svn-path option.")
+
 class SVN2RSS:
     def __init__(self, svn_path, revision, repos_path, item_url, rss_file, 
                  max_items, feed_url):
@@ -70,9 +85,8 @@
         self.max_items = max_items
         self.feed_url = feed_url
         self.svnlook_cmd = 'svnlook'
-        if svn_path is not None:
-            self.svnlook_cmd = os.path.join(svn_path, 'svnlook')
 
+        self.svnlook_cmd = os.path.join(svn_path, 'svnlook')
         self.rss_item_desc = self.make_rss_item_desc()
         (file, ext) = os.path.splitext(self.rss_file)
         self.pickle_file = file + ".pickle"
@@ -190,8 +204,9 @@
     
     if (commit_rev == None):
         svnlook_cmd = 'svnlook'
-        if svn_path is not None:
-            svnlook_cmd = os.path.join(svn_path, 'svnlook')
+        if svn_path is None:
+            svn_path = get_svn_path()
+        svnlook_cmd = os.path.join(svn_path, 'svnlook')
         out, x, y = popen2.popen3([svnlook_cmd, 'youngest', repos_path])
         cmd_out = out.readlines()
         revisions = [int(cmd_out[0])]
</pre></body></html>