[pitivi] Simplify the _in_devel() convenience methods



commit 9de2a2624af1dd758355ad09fc580602d3a786ad
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Thu Nov 29 20:34:00 2012 -0500

    Simplify the _in_devel() convenience methods

 bin/pitivi.in        |   16 ++++++----------
 pitivi/utils/misc.py |    4 ++--
 2 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/bin/pitivi.in b/bin/pitivi.in
index 4571926..5c59124 100644
--- a/bin/pitivi.in
+++ b/bin/pitivi.in
@@ -32,16 +32,6 @@ CONFIGURED_GST_PLUGIN_PATH = '@CONFIGURED_GST_PLUGIN_PATH@'
 LIBDIR = '@LIBDIR@'
 localedir = ""
 
-# Check if we're in development or installed version
-# Add the path of pitivi stuff
-# TODO : change it when it's finally in cvs
-
-def _get_root_dir():
-    return '/'.join(os.path.dirname(os.path.abspath(__file__)).split('/')[:-1])
-
-def _in_devel():
-    rd = _get_root_dir()
-    return os.path.exists(os.path.join(rd, '.git'))
 
 def _prepend_env_path(name, value):
     os.environ[name] = os.pathsep.join(value +
@@ -53,6 +43,12 @@ def jump_through_hoops():
     os.execv(sys.argv[0], sys.argv)
 
 
+# Check if we're in development or installed version and set paths properly
+def _in_devel():
+    root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+    return os.path.exists(os.path.join(root_dir, '.git'))
+
+
 def _add_pitivi_path():
     global localedir
     dir = os.path.dirname(os.path.abspath(__file__))
diff --git a/pitivi/utils/misc.py b/pitivi/utils/misc.py
index c22bc29..af235e7 100644
--- a/pitivi/utils/misc.py
+++ b/pitivi/utils/misc.py
@@ -106,8 +106,8 @@ def in_devel():
     """
     try:
         # This code is the same as in the configure files
-        rd = '/'.join(os.path.dirname(os.path.abspath(__file__)).split('/')[:-1])
-        return os.path.exists(os.path.join(rd, '.git'))
+        root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+        return os.path.exists(os.path.join(root_dir, '.git'))
     except:
         return False
 



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