issue: #1210 hangul_keyboard_list should be moved
authorChoe Hwanjin <choe.hwanjin@gmail.com>
Fri, 4 Mar 2011 15:48:56 +0000 (00:48 +0900)
committerChoe Hwanjin <choe.hwanjin@gmail.com>
Fri, 4 Mar 2011 15:48:56 +0000 (00:48 +0900)
hangul_keyboard_list is architecture dependent file, so it should be
installed in ${pkglibdir} or its subdir. I made it installed in
${pkglibdir}/setup.

config.py will be created by Makefile not configure. Variable ${pkglibdir}
is suitable for Make, but python will not expand it correctly. It's better
for Make to generate config.py so that Make expand the variables.

configure.ac
setup/Makefile.am
setup/config.py.in
setup/main.py

index 043e150..f23faba 100644 (file)
@@ -84,7 +84,6 @@ src/Makefile
 src/hangul.xml.in
 setup/Makefile
 setup/ibus-setup-hangul
-setup/config.py
 icons/Makefile
 data/Makefile
 m4/Makefile
index b9b00b3..cc003bb 100644 (file)
@@ -19,6 +19,7 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 setup_hangul_PYTHON = \
+       config.py \
        main.py \
        keycapturedialog.py \
        setup.ui \
@@ -26,11 +27,12 @@ setup_hangul_PYTHON = \
 
 nodist_setup_hangul_PYTHON = config.py
 
-setup_hanguldir = $(datadir)/ibus-hangul/setup
+setup_hanguldir = $(pkgdatadir)/setup
 
 libexec_SCRIPTS = ibus-setup-hangul
 
-setup_hangul_PROGRAMS = hangul_keyboard_list
+setuplibdir = $(pkglibdir)/setup
+setuplib_PROGRAMS = hangul_keyboard_list
 
 hangul_keyboard_list_SOURCES = hangul_keyboard_list.c
 hangul_keyboard_list_CFLAGS = $(HANGUL_CFLAGS)
@@ -38,10 +40,12 @@ hangul_keyboard_list_LDADD = $(HANGUL_LIBS)
 
 
 CLEANFILES = \
+       config.py \
        *.pyc \
        $(NULL)
 
 EXTRA_DIST = \
+       config.py.in \
        ibus-setup-hangul.in \
        $(NULL)
 
@@ -50,3 +54,9 @@ test:
               PYTHONPATH=$(abs_top_srcdir):$(pyexecdir) \
               $(PYTHON) $(srcdir)/main.py
 
+config.py: config.py.in Makefile
+       sed -e 's&@SETUP_LOCALEDIR@&$(localedir)&g' \
+           -e 's&@SETUP_PKGDATADIR@&$(pkgdatadir)&g' \
+           -e 's&@SETUP_PKGLIBDIR@&$(pkglibdir)&g' $< > $@
+
+ibus-setup-hangul: config.py
index ab99924..d317fcb 100644 (file)
@@ -18,7 +18,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-prefix = "@prefix@"
-datadir = "@prefix@/share"
-localedir = "@prefix@/share/locale"
-setupdir = datadir + "/ibus-hangul/setup"
+localedir = '@SETUP_LOCALEDIR@'
+pkgdatadir = '@SETUP_PKGDATADIR@'
+pkglibdir = '@SETUP_PKGLIBDIR@'
+setupdatadir = pkgdatadir + '/setup'
+setuplibdir = pkglibdir + '/setup'
index 8164543..ba5b0de 100644 (file)
@@ -46,7 +46,7 @@ class Setup ():
        self.__builder.add_from_file(ui_file)
 
        # Hangul tab
-       pipe = subprocess.Popen([config.setupdir + '/hangul_keyboard_list'], stdout = subprocess.PIPE)
+       pipe = subprocess.Popen([config.setuplibdir + '/hangul_keyboard_list'], stdout = subprocess.PIPE)
        list = pipe.communicate()[0].split('\n')
        
        self.__hangul_keyboard = self.__builder.get_object("HangulKeyboard")
@@ -100,7 +100,7 @@ class Setup ():
 
        # setup dialog
        self.__window = self.__builder.get_object("SetupDialog")
-       icon_file = os.path.join(config.datadir, "ibus-hangul", "icons", "ibus-hangul.svg")
+       icon_file = os.path.join(config.pkgdatadir, "icons", "ibus-hangul.svg")
        self.__window.set_icon_from_file(icon_file)
        self.__window.connect("response", self.on_response, None)
        self.__window.show()