[billreminder] Make sure we can handle copying configuration files when running from a checkout. Copy the django ap



commit 2ffe5395b6afec5b3d8ff6d627c0a0ac1701da61
Author: Og B. Maciel <ogmaciel gnome org>
Date:   Thu Jul 23 15:44:06 2009 -0400

    Make sure we can handle copying configuration files when running from a checkout. Copy the django app itself as well.

 src/webreminder.py |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/webreminder.py b/src/webreminder.py
index e6a4683..28d9e45 100644
--- a/src/webreminder.py
+++ b/src/webreminder.py
@@ -1,10 +1,13 @@
 # -*- coding: utf-8 -*-
 
 import os
+import sys
 import shutil
 from lib.common import APPNAME
 from xdg.BaseDirectory import *
 
+runningfrom = ''
+''
 def main():
 
     # Configuration files
@@ -20,10 +23,16 @@ def main():
             configfiles = os.path.join(xdg_config_dirs, APPNAME.lower())
             shutil.copytree(configfiles, conf_dir)
         except Exception, e:
-            src = os.path.join(os.path.realpath(os.curdir), "manage.py")
-            dest = os.path.join(conf_dir, "manage.py")
+            # Create the directory
             os.mkdir(conf_dir)
-            shutil.copyfile(src, dest)
+            # Get the location of where the source code lives
+            curDir = os.path.abspath(os.path.dirname(sys.argv[0]))
+            for f in ["manage.py", "settings.py", "urls.py"]:
+                src = os.path.join(os.path.realpath(curDir), f)
+                dest = os.path.join(conf_dir, f)
+                shutil.copyfile(src, dest)
+            # Copy the django app itself
+            shutil.copytree(os.path.join(curDir, "bills"), os.path.join(conf_dir, "bills"))
 
     # Data storage
     data_dir = os.path.join(xdg_data_home, APPNAME.lower())
@@ -34,4 +43,4 @@ def main():
     # Are all the django files in place?
 
 if __name__ == "__main__":
-    main()
+    main()
\ No newline at end of file



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