This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 Makefile.am              |    4 ++++
 autogen.sh               |    2 +-
 debian/changelog         |    5 ++++-
 gui/gui.py               |   15 ++++++++-------
 gui/project_assistant.py |    5 +++--
 image-creator            |    2 +-
 libs/InstallImage.py     |    3 ++-
 libs/Makefile.am         |    8 ++++++++
 libs/Platform.py         |    5 +++--
 libs/Project.py          |    7 ++++---
 libs/SDK.py              |    3 ++-
 libs/mic_cfg.py          |    5 +++--
 libs/paths.py            |    4 ++++
 13 files changed, 47 insertions(+), 21 deletions(-)

New commits:
commit a6bedd14363cf919394b47dfba1a33a570594115
Author: Prajwal Mohan <[EMAIL PROTECTED]>
Date:   Tue Aug 26 14:31:49 2008 -0700

    Adding option to set install prefix, sysconfdir, localdatadir etc


Diff in this email is a maximum of 400 lines.
diff --git a/Makefile.am b/Makefile.am
index 46a00d2..d0eb453 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,3 +19,7 @@ desktopdir = ${datadir}/applications
 Desktop_Files = image-creator.desktop.in
 desktop_DATA = $(Desktop_Files:.desktop.in=.desktop)
 @INTLTOOL_DESKTOP_RULE@
+
+# We patch the path for the python modules post installation:
+install-exec-hook:
+       sed -i "s|@PATH_PKGDATADIR@|${pkgdatadir}|g" 
$(DESTDIR)$(bindir)/image-creator
diff --git a/autogen.sh b/autogen.sh
index f6792d7..056c9b0 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -5,4 +5,4 @@ intltoolize --force || exit 1
 aclocal -I m4 || exit 1
 autoconf || exit 1
 automake --add-missing --foreign || exit 1
-./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var || exit 1
+./configure "$@" || exit 1
diff --git a/debian/changelog b/debian/changelog
index ae8297c..9455275 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -156,7 +156,10 @@ moblin-image-creator (0.45) UNRELEASED; urgency=low
   [ Mitsutaka Amano ]
   * Updated Japanese localization.
 
- -- Mitsutaka Amano <[EMAIL PROTECTED]>  Tue, 26 Aug 2008 14:13:48 +0900
+  [ Prajwal Mohan ]
+  * Adding option to set install prefix, sysconfdir, localdatadir etc 
+
+ -- Prajwal Mohan <[EMAIL PROTECTED]>  Tue, 26 Aug 2008 14:31:15 -0700
 
 moblin-image-creator (0.44) gaston; urgency=low
 
diff --git a/gui/gui.py b/gui/gui.py
index 551c660..a75cabf 100644
--- a/gui/gui.py
+++ b/gui/gui.py
@@ -35,6 +35,7 @@ import SDK
 import mic_cfg
 import project_assistant
 import repo_editor
+import paths
 
 debug = False
 if mic_cfg.config.has_option('general', 'debug'):
@@ -189,12 +190,12 @@ class App(object):
         if self.pygtkOldVersion == True:
             self.show_error_dialog(_("You are using an old version of PyGTK. 
Image Creator required atleast PyGTK 2.12. Some features will be disabled"))
             return
-        if os.path.isfile("/usr/share/pdk/newFeature"):
+        if os.path.isfile(paths.PKGDATADIR + "/newFeature"):
             newFeatureTree = gtk.glade.XML(self.gladefile, 'newFeature')
             newFeatureDialog = newFeatureTree.get_widget('newFeature')
             newFeatureLabel = newFeatureTree.get_widget('newFeatureLabel')
             newFeatureText = ""
-            f = open("/usr/share/pdk/newFeature")
+            f = open(paths.PKGDATADIR + "/newFeature")
             for line in f:
                 newFeatureText += "\n"
                 newFeatureText += line
@@ -202,7 +203,7 @@ class App(object):
             newFeatureDialog.set_size_request(400, 250)
             newFeatureDialog.run()
             newFeatureDialog.destroy()
-            os.unlink("/usr/share/pdk/newFeature")
+            os.unlink(paths.PKGDATADIR + "/newFeature")
 
     def target_view_changed(self, selection):
         num_rows_selected = 
self.targetView.get_selection().count_selected_rows()
@@ -959,7 +960,7 @@ class App(object):
     def on_launch_vm_clicked(self, widget):
         # check whether the shared image exists
         # the path of folder containing this image is fixed and hardcoded
-        kvm_dir = '/var/lib/moblin-image-creator/kvm'
+        kvm_dir = paths.LOCALSTATEDIR + '/lib/moblin-image-creator/kvm'
         kvmimg_file = os.path.join(kvm_dir, 'mic_vm_share.img')
         if os.path.exists (kvm_dir) == False:
             print _("Creating directory %s ... ") % kvm_dir
@@ -997,9 +998,9 @@ class App(object):
             return
         # boot the live usb image in KVM in background
         if mic_cfg.config.get('general', 'package_manager') == 'apt':
-            os.popen("kvm -no-acpi -m 512 -hda " + live_img + " -hdb 
/var/lib/moblin-image-creator/kvm/mic_vm_share.img -boot c &")
+            os.popen("kvm -no-acpi -m 512 -hda " + live_img + " -hdb " + 
paths.LOCALSTATEDIR + "/lib/moblin-image-creator/kvm/mic_vm_share.img -boot c 
&")
         elif mic_cfg.config.get('general', 'package_manager') == 'yum':
-            os.popen("qemu-kvm -no-acpi -m 512 -hda " + live_img + " -hdb 
/var/lib/moblin-image-creator/kvm/mic_vm_share.img -boot c &")
+            os.popen("qemu-kvm -no-acpi -m 512 -hda " + live_img + " -hdb " + 
paths.LOCALSTATEDIR + "/lib/moblin-image-creator/kvm/mic_vm_share.img -boot c 
&")
 
     def getImageName(self, default_name = ".img"):
         """Function to query the user for the name of the image file they want
@@ -1624,7 +1625,7 @@ class CommandHistoryDlg(object):
         clipboard.store()
 
     def on_save_btn_clicked(self, widget):
-        cmds_path = '/var/lib/moblin-image-creator/cmds'
+        cmds_path = paths.LOCALSTATEDIR + '/lib/moblin-image-creator/cmds'
         while True:
             widgets = gtk.glade.XML(self.gladefile, 'save_dlg')
             dialog = widgets.get_widget('save_dlg')
diff --git a/gui/project_assistant.py b/gui/project_assistant.py
index 280cfef..13457ae 100644
--- a/gui/project_assistant.py
+++ b/gui/project_assistant.py
@@ -32,6 +32,7 @@ import traceback
 import pdk_utils
 import SDK
 import mic_cfg
+import paths
 
 _ = gettext.lgettext
 
@@ -69,8 +70,8 @@ class projectAssistant(object):
         self.sdk = sdk
 
         self.checkBoxContainer = None
-        sideImage = 
gtk.gdk.pixbuf_new_from_file("/usr/share/pdk/mic-assistant.xpm")
-        headImage = 
gtk.gdk.pixbuf_new_from_file("/usr/share/pdk/image-creator-32x32.xpm")
+        sideImage = gtk.gdk.pixbuf_new_from_file(paths.PKGDATADIR + 
"/mic-assistant.xpm")
+        headImage = gtk.gdk.pixbuf_new_from_file(paths.PKGDATADIR + 
"/image-creator-32x32.xpm")
         
         #Setting up the Assistant Widget
         self.assistantDialog = gtk.Assistant()        
diff --git a/image-creator b/image-creator
index eb13d34..69c3347 100755
--- a/image-creator
+++ b/image-creator
@@ -29,7 +29,7 @@ import traceback
 
 from optparse import OptionParser
 
-sys.path.insert(0, '/usr/share/pdk/lib')
+sys.path.insert(0, '@PATH_PKGDATADIR@/lib')
 import SDK
 import mic_cfg
 import pdk_utils
diff --git a/libs/InstallImage.py b/libs/InstallImage.py
index 47a9a2d..9a42119 100755
--- a/libs/InstallImage.py
+++ b/libs/InstallImage.py
@@ -23,6 +23,7 @@ import shutil
 import sys
 import tempfile
 import traceback
+import paths
 
 import Project
 import SDK
@@ -375,7 +376,7 @@ class InstallImage(object):
     def create_initramfs(self, initrd_file, kernel_version):
         print _("Creating initramfs for kernel version: %s") % kernel_version
         # copy the platform initramfs stuff into /etc/initramfs-tools/ in the 
target
-        src_path = os.path.join('/usr/share/pdk/platforms', 
self.project.platform.name, 'initramfs')
+        src_path = os.path.join(paths.PKGDATADIR + '/platforms', 
self.project.platform.name, 'initramfs')
         dst_path = os.path.join(self.target.fs_path, 'etc', 'initramfs-tools', 
)
         pdk_utils.rmtree(dst_path, True, callback = self.progress_callback)
         shutil.copytree(src_path, dst_path, True)
diff --git a/libs/Makefile.am b/libs/Makefile.am
index f14fd36..34f92fe 100644
--- a/libs/Makefile.am
+++ b/libs/Makefile.am
@@ -7,6 +7,7 @@ python_script_SCRIPTS = \
        SDK.py \
        fsets.py \
        mic_cfg.py \
+       paths.py \
        pdk_utils.py
 
 python_script_DATA = \
@@ -14,3 +15,10 @@ python_script_DATA = \
        moblin_pkg.py \
        moblin_pkgbase.py \
        moblin_yum.py
+
+install-data-hook:
+       sed -i "s|@PATH_PREFIX@|${prefix}|g" 
$(DESTDIR)$(datadir)/pdk/lib/paths.py
+       sed -i "s|@PATH_PKGDATADIR@|${pkgdatadir}|g" 
$(DESTDIR)$(datadir)/pdk/lib/paths.py
+       sed -i "s|@PATH_SYSCONFDIR@|${sysconfdir}|g" 
$(DESTDIR)$(datadir)/pdk/lib/paths.py
+       sed -i "s|@PATH_LOCALSTATEDIR@|${localstatedir}|g" 
$(DESTDIR)$(datadir)/pdk/lib/paths.py
+
diff --git a/libs/Platform.py b/libs/Platform.py
index d9fb0ed..7fe7cf7 100755
--- a/libs/Platform.py
+++ b/libs/Platform.py
@@ -29,6 +29,7 @@ import fsets
 import mic_cfg
 import moblin_pkg
 import pdk_utils
+import paths
 
 _ = gettext.lgettext
 
@@ -160,7 +161,7 @@ class Platform(object):
         output = []
         # XXX Evil hack
         if not os.path.isfile("/usr/lib/debootstrap/scripts/%s" % codename) 
and not os.path.isfile("/usr/share/debootstrap/scripts/%s" % codename):
-            cmd += " /usr/share/pdk/debootstrap-scripts/%s" % codename
+            cmd += " " + paths.PKGDATADIR + "/debootstrap-scripts/%s" % 
codename
         # Sometimes we see network issues that trigger debootstrap to claim the
         # apt repository is corrupt.  This trick will force up to 10 attempts
         # before bailing out with an error
@@ -332,4 +333,4 @@ releasever=8
 
 if __name__ == '__main__':
     for p in sys.argv[1:]:
-        print Platform('/usr/share/pdk', p)
+        print Platform(paths.PKGDATADIR, p)
diff --git a/libs/Project.py b/libs/Project.py
index 7c03833..0b45dce 100755
--- a/libs/Project.py
+++ b/libs/Project.py
@@ -32,6 +32,7 @@ import moblin_pkg
 import pdk_utils
 import InstallImage
 import SDK
+import paths
 
 debug = False
 if mic_cfg.config.has_option('general', 'debug'):
@@ -120,7 +121,7 @@ ff02::3 ip6-allhosts
     mount_list = [
         # mnt_type, host_dirname, target_dirname, fs_type, device
         ('bind', '/tmp', False, None, None),
-        ('bind', '/usr/share/pdk', False, None, None),
+        ('bind', paths.PKGDATADIR, False, None, None),
         ('host', '/dev/pts', 'dev/pts', 'devpts', 'devpts'),
         ('host', '/proc', False, 'proc', 'proc'),
         ('host', '/sys', False, 'sysfs', 'sysfs'),
@@ -544,7 +545,7 @@ class Callback:
 if __name__ == '__main__':
     if len(sys.argv) != 6:
         print >> sys.stderr, _("USAGE: %s PROJECT_NAME PROJECT_PATH 
PROJECT_DESCRIPTION TARGET_NAME PLATFORM_NAME") % (sys.argv[0])
-        print >> sys.stderr, _("\tPROJECT_NAME: name to call the project.  The 
config file /usr/share/pdk/projects/project_name.proj is used or created")
+        print >> sys.stderr, _("\tPROJECT_NAME: name to call the project.  The 
config file " + paths.PKGDATADIR + "/projects/project_name.proj is used or 
created")
         print >> sys.stderr, _("\tPROJECT_PATH: directory to install the 
project")
         print >> sys.stderr, _("\tPROJECT_DESCRIPTION: Textual description of 
the project")
         print >> sys.stderr, _("\tTARGET_NAME: ???")
@@ -582,7 +583,7 @@ if __name__ == '__main__':
     print _("Name: %s") % proj.name
     print _("Description: %s") % proj.desc
     if existing_project:
-        print _("Used info from config file: /usr/share/pdk/projects/%s.proj") 
% name
+        print _("Used info from config file: " + paths.PKGDATADIR + 
"/projects/%s.proj") % name
         time.sleep(2)
 
     # see if the target exist
diff --git a/libs/SDK.py b/libs/SDK.py
index a20284b..7636f55 100755
--- a/libs/SDK.py
+++ b/libs/SDK.py
@@ -124,12 +124,13 @@ import Platform
 import Project
 import mic_cfg
 import pdk_utils
+import paths
 
 _ = gettext.lgettext
 
 class SDK(object):
     def __init__(self, progress_callback = None, status_label_callback = None,
-            path='/usr/share/pdk', var_dir = '/var/lib/moblin-image-creator/'):
+            path=paths.PKGDATADIR, var_dir = paths.LOCALSTATEDIR + 
'/lib/moblin-image-creator/'):
         self.var_dir = var_dir
         self.path = os.path.realpath(os.path.abspath(os.path.expanduser(path)))
         self.version = "- Undefined"
diff --git a/libs/mic_cfg.py b/libs/mic_cfg.py
index 1981d04..b2e2662 100755
--- a/libs/mic_cfg.py
+++ b/libs/mic_cfg.py
@@ -25,13 +25,14 @@ import platform
 import pwd
 import re
 import sys
+import paths
 
 from ConfigParser import SafeConfigParser
 
 _ = gettext.lgettext
 
 config = None
-DEFAULT_CONFIG_DIR = os.path.expanduser("/usr/share/pdk/default_config/")
+DEFAULT_CONFIG_DIR = os.path.expanduser(paths.PKGDATADIR + "/default_config/")
 CONFIG_DIR = os.path.expanduser("~/.image-creator")
 # List of valid sections for our config file
 BASE_SECTIONS = [ "platform", "installimage", "distribution" ]
@@ -39,7 +40,7 @@ VALID_SECTIONS = BASE_SECTIONS + [ "general" ]
 
 # Default values
 DEFAULTS = [
-    ('general', 'var_dir', '/var/lib/moblin-image-creator'),
+    ('general', 'var_dir', paths.LOCALSTATEDIR + '/lib/moblin-image-creator'),
     ]
 
 
diff --git a/libs/paths.py b/libs/paths.py
new file mode 100644
index 0000000..6e0b27c
--- /dev/null
+++ b/libs/paths.py
@@ -0,0 +1,4 @@
+PREFIX = "@PATH_PREFIX@"
+PKGDATADIR = "@PATH_PKGDATADIR@"
+SYSCONFDIR = "@PATH_SYSCONFDIR@"
+LOCALSTATEDIR = "@PATH_LOCALSTATEDIR@"
_______________________________________________
Commits mailing list
[email protected]
https://www.moblin.org/mailman/listinfo/commits

Reply via email to