commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8787 - in trunk/gnue-common: . src/setup src/utils


From: reinhard
Subject: [gnue] r8787 - in trunk/gnue-common: . src/setup src/utils
Date: Sun, 15 Oct 2006 18:58:17 -0500 (CDT)

Author: reinhard
Date: 2006-10-15 18:58:16 -0500 (Sun, 15 Oct 2006)
New Revision: 8787

Modified:
   trunk/gnue-common/setup.py
   trunk/gnue-common/src/setup/GSetup.py
   trunk/gnue-common/src/utils/version.py
Log:
Fix for running the commands outside the source directory.


Modified: trunk/gnue-common/setup.py
===================================================================
--- trunk/gnue-common/setup.py  2006-10-15 23:40:05 UTC (rev 8786)
+++ trunk/gnue-common/setup.py  2006-10-15 23:58:16 UTC (rev 8787)
@@ -166,7 +166,7 @@
 
     print "building svnrev.py"
     output = open(filename, 'w')
-    output.write('svnrev = %s' % version.get_svn_revision())
+    output.write('svnrev = %s' % version.get_svn_revision('src'))
     output.close()
 
 

Modified: trunk/gnue-common/src/setup/GSetup.py
===================================================================
--- trunk/gnue-common/src/setup/GSetup.py       2006-10-15 23:40:05 UTC (rev 
8786)
+++ trunk/gnue-common/src/setup/GSetup.py       2006-10-15 23:58:16 UTC (rev 
8787)
@@ -253,7 +253,7 @@
 
       print "building svnrev.py"
       output = open(filename, 'w')
-      output.write('svnrev = %s' % version.get_svn_revision())
+      output.write('svnrev = %s' % version.get_svn_revision('src'))
       output.close()
 
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-common/src/utils/version.py
===================================================================
--- trunk/gnue-common/src/utils/version.py      2006-10-15 23:40:05 UTC (rev 
8786)
+++ trunk/gnue-common/src/utils/version.py      2006-10-15 23:58:16 UTC (rev 
8787)
@@ -27,6 +27,7 @@
 __all__ = ['get_svn_revision', 'Version']
 
 import os
+import sys
 import tempfile
 
 
@@ -34,7 +35,7 @@
 # Find out current SVN revision
 # =============================================================================
 
-def get_svn_revision():
+def get_svn_revision(directory):
     """
     Find out the SVN revision of the last change in the current directory.
 
@@ -45,6 +46,8 @@
     "unknown".
 
     If the environment variable "GNUE_BUILD" is set, the function returns 0.
+
+    @param directory: Source directory to check the revision for.
     """
 
     if os.environ.has_key('GNUE_BUILD'):
@@ -53,8 +56,8 @@
     if os.name != 'posix':
         return 'unknown'
 
-    cmd = "LANG=C svn info | grep 'Last Changed Rev:' " + \
-            "| sed -e 's/Last Changed Rev: //'"
+    cmd = ("LANG=C svn info %s | grep 'Last Changed Rev:' " + \
+            "| sed -e 's/Last Changed Rev: //'") % dir
 
     filename = tempfile.mktemp('svnrev')
     os.system(cmd + '> %s' % filename)
@@ -137,7 +140,8 @@
         self.svn = svn
 
         if self.svn is None:
-            self.svn = get_svn_revision()
+            caller_file = sys._getframe(1).f_code.co_filename
+            self.svn = get_svn_revision(os.path.dirname(caller_file))
 
 
     # -------------------------------------------------------------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]