changeset 1541:70e646b2806a beta

fixes rhodecode upgrade problem that caused setuptool to crash on importing sqlalchemy models
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 11 Oct 2011 02:14:42 +0200
parents 191f3f08236d
children 238b2805851f ada6926c374f
files rhodecode/__init__.py rhodecode/lib/__init__.py rhodecode/lib/utils.py
diffstat 3 files changed, 24 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/__init__.py	Tue Oct 11 01:08:23 2011 +0200
+++ b/rhodecode/__init__.py	Tue Oct 11 02:14:42 2011 +0200
@@ -35,7 +35,7 @@
 PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD', 'OpenBSD', 'SunOS')
 
 try:
-    from rhodecode.lib.utils import get_current_revision
+    from rhodecode.lib import get_current_revision
     _rev = get_current_revision()
 except ImportError:
     #this is needed when doing some setup.py operations
--- a/rhodecode/lib/__init__.py	Tue Oct 11 01:08:23 2011 +0200
+++ b/rhodecode/lib/__init__.py	Tue Oct 11 02:14:42 2011 +0200
@@ -23,6 +23,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import os
+
 def __get_lem():
     from pygments import lexers
     from string import lower
@@ -379,3 +381,24 @@
         from rhodecode.lib.utils import EmptyChangeset
         cs = EmptyChangeset(requested_revision=rev)
     return cs
+
+
+def get_current_revision():
+    """
+    Returns tuple of (number, id) from repository containing this package
+    or None if repository could not be found.
+    """
+
+    try:
+        from vcs import get_repo
+        from vcs.utils.helpers import get_scm
+        from vcs.exceptions import RepositoryError, VCSError
+        repopath = os.path.join(os.path.dirname(__file__), '..', '..')
+        scm = get_scm(repopath)[0]
+        repo = get_repo(path=repopath, alias=scm)
+        tip = repo.get_changeset()
+        return (tip.revision, tip.short_id)
+    except (ImportError, RepositoryError, VCSError), err:
+        print ("Cannot retrieve rhodecode's revision. Original error "
+               "was: %s" % err)
+        return None
--- a/rhodecode/lib/utils.py	Tue Oct 11 01:08:23 2011 +0200
+++ b/rhodecode/lib/utils.py	Tue Oct 11 02:14:42 2011 +0200
@@ -445,26 +445,6 @@
             beaker.cache.cache_regions[region] = region_settings
 
 
-def get_current_revision():
-    """Returns tuple of (number, id) from repository containing this package
-    or None if repository could not be found.
-    """
-
-    try:
-        from vcs import get_repo
-        from vcs.utils.helpers import get_scm
-        from vcs.exceptions import RepositoryError, VCSError
-        repopath = os.path.join(os.path.dirname(__file__), '..', '..')
-        scm = get_scm(repopath)[0]
-        repo = get_repo(path=repopath, alias=scm)
-        tip = repo.get_changeset()
-        return (tip.revision, tip.short_id)
-    except (ImportError, RepositoryError, VCSError), err:
-        logging.debug("Cannot retrieve rhodecode's revision. Original error "
-                      "was: %s" % err)
-        return None
-
-
 #==============================================================================
 # TEST FUNCTIONS AND CREATORS
 #==============================================================================