From e9f9eb6aa3feaf063161641e4543bea4196e871e Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 26 Nov 2001 00:35:45 +0000 Subject: [PATCH] Handling of intlxx.so better. svn: r584 --- gramps/configure | 287 +++++++++++++++++++++++++----- gramps/configure.in | 70 ++++++-- gramps/gramps.spec | 6 +- gramps/src/Date.py | 220 +++++++++++++---------- gramps/src/Makefile.in | 22 ++- gramps/src/intl.c | 16 +- gramps/src/plugins/WriteGedcom.py | 83 ++++++++- 7 files changed, 534 insertions(+), 170 deletions(-) diff --git a/gramps/configure b/gramps/configure index eb8b24655..f0f1b8e28 100755 --- a/gramps/configure +++ b/gramps/configure @@ -560,10 +560,150 @@ else echo "$ac_t""no" 1>&6 fi +# Extract the first word of "python1.5", so it can be a program name with args. +set dummy python1.5; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:567: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_PYTHON15'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$PYTHON15" in + /*) + ac_cv_path_PYTHON15="$PYTHON15" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_PYTHON15="$PYTHON15" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_PYTHON15="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +PYTHON15="$ac_cv_path_PYTHON15" +if test -n "$PYTHON15"; then + echo "$ac_t""$PYTHON15" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "python2.0", so it can be a program name with args. +set dummy python2.0; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:602: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_PYTHON20'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$PYTHON20" in + /*) + ac_cv_path_PYTHON20="$PYTHON20" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_PYTHON20="$PYTHON20" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_PYTHON20="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +PYTHON20="$ac_cv_path_PYTHON20" +if test -n "$PYTHON20"; then + echo "$ac_t""$PYTHON20" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "python2.1", so it can be a program name with args. +set dummy python2.1; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:637: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_PYTHON21'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$PYTHON21" in + /*) + ac_cv_path_PYTHON21="$PYTHON21" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_PYTHON21="$PYTHON21" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_PYTHON21="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +PYTHON21="$ac_cv_path_PYTHON21" +if test -n "$PYTHON21"; then + echo "$ac_t""$PYTHON21" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "python2.2", so it can be a program name with args. +set dummy python2.2; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:672: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_PYTHON22'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$PYTHON22" in + /*) + ac_cv_path_PYTHON22="$PYTHON22" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_PYTHON22="$PYTHON22" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_PYTHON22="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +PYTHON22="$ac_cv_path_PYTHON22" +if test -n "$PYTHON22"; then + echo "$ac_t""$PYTHON22" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + # Extract the first word of "zip", so it can be a program name with args. set dummy zip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:567: checking for $ac_word" >&5 +echo "configure:707: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ZIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -604,7 +744,6 @@ PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"` - ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -636,7 +775,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:640: checking for a BSD compatible install" >&5 +echo "configure:779: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -689,7 +828,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:693: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:832: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -719,7 +858,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:723: checking for $ac_word" >&5 +echo "configure:862: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -749,7 +888,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:753: checking for $ac_word" >&5 +echo "configure:892: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -800,7 +939,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:804: checking for $ac_word" >&5 +echo "configure:943: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -832,7 +971,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:836: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:975: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -843,12 +982,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 847 "configure" +#line 986 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -874,12 +1013,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:878: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1017: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:883: checking whether we are using GNU C" >&5 +echo "configure:1022: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -888,7 +1027,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -907,7 +1046,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:911: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1050: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -940,7 +1079,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:944: checking how to run the C preprocessor" >&5 +echo "configure:1083: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -955,13 +1094,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1104: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -972,13 +1111,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:982: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -989,13 +1128,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:999: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1138: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1021,17 +1160,17 @@ echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:1025: checking for libintl.h" >&5 +echo "configure:1164: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1054,7 +1193,7 @@ fi echo $ac_n "checking for textdomain in -lc""... $ac_c" 1>&6 -echo "configure:1058: checking for textdomain in -lc" >&5 +echo "configure:1197: checking for textdomain in -lc" >&5 ac_lib_var=`echo c'_'textdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1062,7 +1201,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1092,7 +1231,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for textdomain in -lintl""... $ac_c" 1>&6 -echo "configure:1096: checking for textdomain in -lintl" >&5 +echo "configure:1235: checking for textdomain in -lintl" >&5 ac_lib_var=`echo intl'_'textdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1100,7 +1239,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1140,7 +1279,7 @@ fi # Extract the first word of "gnome-config", so it can be a program name with args. set dummy gnome-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1144: checking for $ac_word" >&5 +echo "configure:1283: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_HAVE_GNOME_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1171,7 +1310,7 @@ GNOMEHELP=`gnome-config --prefix` echo $ac_n "checking Python bindings for sax/xml""... $ac_c" 1>&6 -echo "configure:1175: checking Python bindings for sax/xml" >&5 +echo "configure:1314: checking Python bindings for sax/xml" >&5 cat > conftest.py <&6 echo $ac_n "checking Python bindings for gtk+""... $ac_c" 1>&6 -echo "configure:1208: checking Python bindings for gtk+" >&5 +echo "configure:1347: checking Python bindings for gtk+" >&5 cat > conftest.py <&6 echo $ac_n "checking Python bindings for GNOME""... $ac_c" 1>&6 -echo "configure:1234: checking Python bindings for GNOME" >&5 +echo "configure:1373: checking Python bindings for GNOME" >&5 cat > conftest.py <&6 echo $ac_n "checking Python/libglade bindings""... $ac_c" 1>&6 -echo "configure:1260: checking Python/libglade bindings" >&5 +echo "configure:1399: checking Python/libglade bindings" >&5 cat > conftest.py <&6 echo $ac_n "checking Python/GNOME bindings for libglade""... $ac_c" 1>&6 -echo "configure:1286: checking Python/GNOME bindings for libglade" >&5 +echo "configure:1425: checking Python/GNOME bindings for libglade" >&5 cat > conftest.py <&6 echo $ac_n "checking for headers required to compile python extensions""... $ac_c" 1>&6 -echo "configure:1314: checking for headers required to compile python extensions" >&5 -py_prefix=`$PYTHON -c "import sys; print sys.prefix"` -py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` -PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" -if test "$py_prefix" != "$py_exec_prefix"; then - PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" +echo "configure:1453: checking for headers required to compile python extensions" >&5 + +echo $PYTHON15 +if test "$PYTHON15" != ""; then + py_prefix=`$PYTHON15 -c "import sys; print sys.prefix"` + py_exec_prefix=`$PYTHON15 -c "import sys; print sys.exec_prefix"` + P15_INCLUDES="-I${py_prefix}/include/python1.5" + if test -f "${py_exec_prefix}/include/python1.5/Python.h" + then + INTLLIBS="intl15.so " + fi fi -if test -f "${py_exec_prefix}/include/python${PYTHON_VERSION}/Python.h" -then - echo "$ac_t""ok" 1>&6 -else - { echo "configure: error: not found" 1>&2; exit 1; } + +if test "$PYTHON20" != ""; then + py_prefix=`$PYTHON20 -c "import sys; print sys.prefix"` + py_exec_prefix=`$PYTHON20 -c "import sys; print sys.exec_prefix"` + P20_INCLUDES="-I${py_prefix}/include/python2.0" + if test -f "${py_exec_prefix}/include/python2.0/Python.h" + then + INTLLIBS="${INTLLIBS}intl20.so " + fi fi +if test "$PYTHON21" != ""; then + py_prefix=`$PYTHON21 -c "import sys; print sys.prefix"` + py_exec_prefix=`$PYTHON21 -c "import sys; print sys.exec_prefix"` + P21_INCLUDES="-I${py_prefix}/include/python2.1" + if test "$py_prefix" != "$py_exec_prefix"; then + P21_INCLUDES="$P21_INCLUDES -I${py_exec_prefix}/include/python2.1" + fi + if test -f "${py_exec_prefix}/include/python2.1/Python.h" + then + INTLLIBS="${INTLLIBS}intl21.so " + fi +fi + + +if test "$PYTHON22" != ""; then + INTLLIBS="${INTLLIBS}intl22.so " + py_prefix=`$PYTHON22 -c "import sys; print sys.prefix"` + py_exec_prefix=`$PYTHON22 -c "import sys; print sys.exec_prefix"` + P22_INCLUDES="-I${py_prefix}/include/python2.2" + if test "$py_prefix" != "$py_exec_prefix"; then + P22_INCLUDES="$P22_INCLUDES -I${py_exec_prefix}/include/python2.2" + fi + if test -f "${py_exec_prefix}/include/python2.2/Python.h" + then + INTLLIBS="${INTLLIBS}intl22.so " + fi +fi + + + + +echo "$ac_t""ok" 1>&6 + + trap '' 1 2 15 cat > confcache <<\EOF @@ -1478,11 +1660,14 @@ s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@PYTHON@%$PYTHON%g +s%@PYTHON15@%$PYTHON15%g +s%@PYTHON20@%$PYTHON20%g +s%@PYTHON21@%$PYTHON21%g +s%@PYTHON22@%$PYTHON22%g s%@ZIP@%$ZIP%g s%@PYTHON_VERSION@%$PYTHON_VERSION%g s%@PACKAGE@%$PACKAGE%g s%@GNOMEHELP@%$GNOMEHELP%g -s%@INCS@%$INCS%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g @@ -1490,7 +1675,11 @@ s%@SET_MAKE@%$SET_MAKE%g s%@CC@%$CC%g s%@CPP@%$CPP%g s%@HAVE_GNOME_CONFIG@%$HAVE_GNOME_CONFIG%g -s%@PYTHON_INCLUDES@%$PYTHON_INCLUDES%g +s%@P15_INCLUDES@%$P15_INCLUDES%g +s%@P20_INCLUDES@%$P20_INCLUDES%g +s%@P21_INCLUDES@%$P21_INCLUDES%g +s%@P22_INCLUDES@%$P22_INCLUDES%g +s%@INTLLIBS@%$INTLLIBS%g CEOF EOF diff --git a/gramps/configure.in b/gramps/configure.in index 6adb17175..2459ef356 100644 --- a/gramps/configure.in +++ b/gramps/configure.in @@ -6,6 +6,10 @@ dnl Checks for programs. PACKAGE=gramps AC_PATH_PROG(PYTHON, python) +AC_PATH_PROG(PYTHON15, python1.5) +AC_PATH_PROG(PYTHON20, python2.0) +AC_PATH_PROG(PYTHON21, python2.1) +AC_PATH_PROG(PYTHON22, python2.2) AC_PATH_PROG(ZIP, zip) changequote(<<, >>)dnl @@ -175,20 +179,62 @@ dnl Checks for libraries. dnl Checks for header files. AC_MSG_CHECKING(for headers required to compile python extensions) -py_prefix=`$PYTHON -c "import sys; print sys.prefix"` -py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` -PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" -if test "$py_prefix" != "$py_exec_prefix"; then - PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" + +echo $PYTHON15 +if test "$PYTHON15" != ""; then + py_prefix=`$PYTHON15 -c "import sys; print sys.prefix"` + py_exec_prefix=`$PYTHON15 -c "import sys; print sys.exec_prefix"` + P15_INCLUDES="-I${py_prefix}/include/python1.5" + if test -f "${py_exec_prefix}/include/python1.5/Python.h" + then + INTLLIBS="intl15.so " + fi fi -AC_SUBST(PYTHON_INCLUDES) -dnl check if the headers exist: -if test -f "${py_exec_prefix}/include/python${PYTHON_VERSION}/Python.h" -then - AC_MSG_RESULT(ok) -else - AC_MSG_ERROR([not found]) +AC_SUBST(P15_INCLUDES) + +if test "$PYTHON20" != ""; then + py_prefix=`$PYTHON20 -c "import sys; print sys.prefix"` + py_exec_prefix=`$PYTHON20 -c "import sys; print sys.exec_prefix"` + P20_INCLUDES="-I${py_prefix}/include/python2.0" + if test -f "${py_exec_prefix}/include/python2.0/Python.h" + then + INTLLIBS="${INTLLIBS}intl20.so " + fi fi +AC_SUBST(P20_INCLUDES) + +if test "$PYTHON21" != ""; then + py_prefix=`$PYTHON21 -c "import sys; print sys.prefix"` + py_exec_prefix=`$PYTHON21 -c "import sys; print sys.exec_prefix"` + P21_INCLUDES="-I${py_prefix}/include/python2.1" + if test "$py_prefix" != "$py_exec_prefix"; then + P21_INCLUDES="$P21_INCLUDES -I${py_exec_prefix}/include/python2.1" + fi + if test -f "${py_exec_prefix}/include/python2.1/Python.h" + then + INTLLIBS="${INTLLIBS}intl21.so " + fi +fi +AC_SUBST(P21_INCLUDES) + +if test "$PYTHON22" != ""; then + INTLLIBS="${INTLLIBS}intl22.so " + py_prefix=`$PYTHON22 -c "import sys; print sys.prefix"` + py_exec_prefix=`$PYTHON22 -c "import sys; print sys.exec_prefix"` + P22_INCLUDES="-I${py_prefix}/include/python2.2" + if test "$py_prefix" != "$py_exec_prefix"; then + P22_INCLUDES="$P22_INCLUDES -I${py_exec_prefix}/include/python2.2" + fi + if test -f "${py_exec_prefix}/include/python2.2/Python.h" + then + INTLLIBS="${INTLLIBS}intl22.so " + fi +fi + +AC_SUBST(P22_INCLUDES) +AC_SUBST(INTLLIBS) + +AC_MSG_RESULT(ok) dnl Checks for typedefs, structures, and compiler characteristics. diff --git a/gramps/gramps.spec b/gramps/gramps.spec index c3b76a808..9495707df 100644 --- a/gramps/gramps.spec +++ b/gramps/gramps.spec @@ -1,4 +1,4 @@ -%define ver 0.6.2 +%define ver 0.7.0pre %define rel 1 %define prefix /usr @@ -13,10 +13,10 @@ BuildRoot: /var/tmp/%{name}-%{version}-root URL: http://gramps.sourceforge.net -Requires: python = 1.5.2 +Requires: python >= 1.5.2 Requires: pygnome >= 1.0.53 Requires: pygnome-libglade -Requires: PyXML +Requires: pyexpat.so %description gramps (Genealogical Research and Analysis Management Programming diff --git a/gramps/src/Date.py b/gramps/src/Date.py index 19011a911..4c093120a 100644 --- a/gramps/src/Date.py +++ b/gramps/src/Date.py @@ -53,15 +53,18 @@ _fmonth2num = { "ther" :10, "fruc" :11, "extr" : 12,"nivô" : 3 } _hmonth = [ - "", "Tishri", "Heshvan", "Kislev", "Tevet", "Shevat", "AdarI", + "Tishri", "Heshvan", "Kislev", "Tevet", "Shevat", "AdarI", "AdarII", "Nisan", "Iyyar", "Sivan", "Tammuz", "Av", "Elul" ] _hmonth2num = { - "Tishri" : 0, "Heshvan" : 1, "Kislev" : 2, "Tevet" : 3, - "Shevat" : 4, "AdarI" : 5, "AdarII" : 6, "Nisan" : 7, - "Iyyar" : 8, "Sivan" : 9, "Tammuz" :10, "Av" : 11, - "Elul" : 12 + "tishri" : 0, "heshvan" : 1, "kislev" : 2, "tevet" : 3, + "shevat" : 4, "adari" : 5, "adarii" : 6, "nisan" : 7, + "iyyar" : 8, "sivan" : 9, "tammuz" :10, "av" : 11, + "elul" : 12,"tsh" : 0, "csh" : 1, "ksl" : 2, + "tvt" : 3, "shv" : 4, "adr" : 5, "ads" : 6, + "nsn" : 7, "iyr" : 8, "svn" : 9, "tmz" : 10, + "aav" :11, "ell" :12, } _mname = [ _("January"), _("February"), _("March"), _("April"), @@ -82,7 +85,7 @@ _m2num = { string.lower(_mname[0][0:3]) : 0, string.lower(_mname[11][0:3]) : 11 } -_UNDEF = -999999 +UNDEF = -999999 #------------------------------------------------------------------------- # @@ -227,7 +230,7 @@ class Date: elif self.calendar == JULIAN: return self.get_quote_date(_mname,_("Julian")) elif self.calendar == HEBREW: - return self.get_quote_date(_hmonth,_("French")) + return self.get_quote_date(_hmonth,_("Hebrew")) else: return self.get_quote_date(_fmonth,_("French")) @@ -269,10 +272,10 @@ class Date: def isEmpty(self): s = self.start - return s.year==_UNDEF and s.month==_UNDEF and s.day==_UNDEF + return s.year==UNDEF and s.month==UNDEF and s.day==UNDEF def isValid(self): - return self.range != -1 + return self.range != -1 def isRange(self): return self.range == 1 @@ -363,9 +366,9 @@ class SingleDate: self.mode = source.mode self.calendar = source.calendar else: - self.month = _UNDEF - self.day = _UNDEF - self.year = _UNDEF + self.month = UNDEF + self.day = UNDEF + self.year = UNDEF self.mode = SingleDate.exact self.calendar = GREGORIAN @@ -378,7 +381,7 @@ class SingleDate: def setMonth(self,val): if val > 12 or val < 0: - self.month = _UNDEF + self.month = UNDEF else: self.month = val - 1 @@ -387,21 +390,21 @@ class SingleDate: val = int(s) self.month = val - 1 except ValueError: - self.month = _UNDEF + self.month = UNDEF def setDayVal(self,s): try: val = int(s) self.day = val except ValueError: - self.day = _UNDEF + self.day = UNDEF def setYearVal(self,s): try: val = int(s) self.year = val except ValueError: - self.year = _UNDEF + self.year = UNDEF def getMonth(self): return self.month + 1 @@ -428,24 +431,24 @@ class SingleDate: try: self.month = SingleDate.em2num[string.lower(text[0:3])] except KeyError: - self.month = _UNDEF + self.month = UNDEF def getMonthStr(self): return _mname[self.month] def getIsoDate(self): - if self.year == _UNDEF: + if self.year == UNDEF: y = "????" else: y = "%04d" % self.year - if self.month == _UNDEF: - if self.day == _UNDEF: + if self.month == UNDEF: + if self.day == UNDEF: m = "" else: m = "-??" else: m = "-%02d" % (self.month+1) - if self.day == _UNDEF: + if self.day == UNDEF: d = '' else: d = "-%02d" % self.day @@ -454,20 +457,20 @@ class SingleDate: def getSaveDate(self): retval = "" - if self.month == _UNDEF and self.day == _UNDEF and self.year == _UNDEF : + if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : pass - elif self.day == _UNDEF: - if self.month == _UNDEF: + elif self.day == UNDEF: + if self.month == UNDEF: retval = str(self.year) - elif self.year == _UNDEF: + elif self.year == UNDEF: retval = SingleDate.emname[self.month] else: retval = "%s %d" % (SingleDate.emname[self.month],self.year) - elif self.month == _UNDEF: + elif self.month == UNDEF: retval = str(self.year) else: month = SingleDate.emname[self.month] - if self.year == _UNDEF: + if self.year == UNDEF: retval = "%d %s ????" % (self.day,month) else: retval = "%d %s %d" % (self.day,month,self.year) @@ -483,20 +486,20 @@ class SingleDate: def getFmt1(self): - if self.month == _UNDEF and self.day == _UNDEF and self.year == _UNDEF : + if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : return "" - elif self.day == _UNDEF: - if self.month == _UNDEF: + elif self.day == UNDEF: + if self.month == UNDEF: retval = str(self.year) - elif self.year == _UNDEF: + elif self.year == UNDEF: retval = _mname[self.month] else: retval = "%s %d" % (_mname[self.month],self.year) - elif self.month == _UNDEF: + elif self.month == UNDEF: retval = str(self.year) else: month = _mname[self.month] - if self.year == _UNDEF: + if self.year == UNDEF: retval = "%s %d, ????" % (month,self.day) else: retval = "%s %d, %d" % (month,self.day,self.year) @@ -511,18 +514,18 @@ class SingleDate: return retval def getFmt2(self): - if self.month == _UNDEF and self.day == _UNDEF and self.year == _UNDEF : + if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : return "" - elif self.month != _UNDEF and self.month != _UNDEF: + elif self.month != UNDEF and self.month != UNDEF: month = _mname[self.month] - if self.year == _UNDEF: + if self.year == UNDEF: retval = "%s %d, ????" % (string.upper(month[0:3]),self.day) else: retval = "%s %d, %d" % (string.upper(month[0:3]),self.day,self.year) - elif self.day == _UNDEF: - if self.month == _UNDEF: + elif self.day == UNDEF: + if self.month == UNDEF: retval = str(self.year) - elif self.year == _UNDEF: + elif self.year == UNDEF: month = _mname[self.month] retval = string.upper(month[0:3]) else: @@ -541,22 +544,22 @@ class SingleDate: return retval def getFmt3(self): - if self.month == _UNDEF and self.day == _UNDEF and self.year == _UNDEF : + if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : return "" - elif self.day == _UNDEF: - if self.month == _UNDEF: + elif self.day == UNDEF: + if self.month == UNDEF: retval = str(self.year) - elif self.year == _UNDEF: + elif self.year == UNDEF: month = _mname[self.month] retval = string.upper(month[0:3]) else: month = _mname[self.month] retval = "%s %d" % (string.upper(month[0:3]),self.year) - elif self.month == _UNDEF: + elif self.month == UNDEF: retval = str(self.year) else: month = _mname[self.month] - if self.year == _UNDEF: + if self.year == UNDEF: retval = "%d %s ????" % (self.day,string.upper(month[0:3])) else: retval = "%d %s %d" % (self.day,string.upper(month[0:3]),self.year) @@ -571,21 +574,21 @@ class SingleDate: return retval def getFmt10(self): - if self.month == _UNDEF and self.day == _UNDEF and self.year == _UNDEF : + if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : return "" - elif self.day == _UNDEF: - if self.month == _UNDEF: + elif self.day == UNDEF: + if self.month == UNDEF: retval = str(self.year) - elif self.year == _UNDEF: + elif self.year == UNDEF: retval = _mname[self.month] else: month = _mname[self.month] retval = "%s %d" % (month,self.year) - elif self.month == _UNDEF: + elif self.month == UNDEF: retval = str(self.year) else: month = _mname[self.month] - if self.year == _UNDEF: + if self.year == UNDEF: retval = "%d. %s ????" % (self.day,month) else: retval = "%d. %s %d" % (self.day,month,self.year) @@ -600,19 +603,19 @@ class SingleDate: return retval def get_mmddyyyy(self,sep): - if self.month == _UNDEF and self.day == _UNDEF and self.year == _UNDEF : + if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : return "" - elif self.day == _UNDEF: - if self.month == _UNDEF: + elif self.day == UNDEF: + if self.month == UNDEF: retval = str(self.year) - elif self.year == _UNDEF: + elif self.year == UNDEF: retval = "%02d%s??%s??" % (self.month+1,sep,sep) else: retval = "%02d%s??%s%04d" % (self.month+1,sep,sep,self.year) - elif self.month == _UNDEF: + elif self.month == UNDEF: retval = "??%s%02d%s%04d" % (sep,self.day,sep,self.year) else: - if self.year == _UNDEF: + if self.year == UNDEF: retval = "%02d%s%02d%s????" % (self.month+1,sep,self.day,sep) else: retval = "%02d%s%02d%s%04d" % (self.month+1,sep,self.day,sep,self.year) @@ -629,19 +632,19 @@ class SingleDate: def get_yyyymmdd(self,sep): retval = "" - if self.month == _UNDEF and self.day == _UNDEF and self.year == _UNDEF : + if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : pass - elif self.day == _UNDEF: - if self.month == _UNDEF: + elif self.day == UNDEF: + if self.month == UNDEF: retval = str(self.year) - elif self.year == _UNDEF: + elif self.year == UNDEF: retval = "????%s%02d%s??" % (sep,self.month+1,sep) else: retval = "%04d%s%02d" % (self.year,sep,self.month+1) - elif self.month == _UNDEF: + elif self.month == UNDEF: retval = "%04d%s??%s%02d" % (self.year,sep,sep,self.day) else: - if self.year == _UNDEF: + if self.year == UNDEF: retval = "????%02d%s%02d%s" % (self.month+1,sep,self.day,sep) else: retval = "%02d%s%02d%s%02d" % (self.year,sep,self.month+1,sep,self.day) @@ -668,19 +671,19 @@ class SingleDate: def get_ddmmyyyy(self,sep): retval = "" - if self.month == _UNDEF and self.day == _UNDEF and self.year == _UNDEF : + if self.month == UNDEF and self.day == UNDEF and self.year == UNDEF : pass - elif self.day == _UNDEF: - if self.month == _UNDEF: + elif self.day == UNDEF: + if self.month == UNDEF: retval = str(self.year) - elif self.year == _UNDEF: + elif self.year == UNDEF: retval = "??%s%02d%s??" % (sep,self.month+1,sep) else: retval = "??%s%02d%s%04d" % (sep,self.month+1,sep,self.year) - elif self.month == _UNDEF: + elif self.month == UNDEF: retval = "%02d%s??%s%04d" % (self.day,sep,sep,self.year) else: - if self.year == _UNDEF: + if self.year == UNDEF: retval = "%02d%s%02d%s????" % (self.day,sep,self.month+1,sep) else: retval = "%02d%s%02d%s%04d" % (self.day,sep,self.month+1,sep,self.year) @@ -722,16 +725,16 @@ class SingleDate: getFmt13] def display_calendar(self,month_map): - if self.year==_UNDEF: - if self.month == _UNDEF: + if self.year==UNDEF: + if self.month == UNDEF: return "" - elif self.day == _UNDEF: + elif self.day == UNDEF: return month_map[self.month] else: return "%02 %s" % (self.day,month_map[self.month]) - elif self.month == _UNDEF: + elif self.month == UNDEF: return str(self.year) - elif self.day == _UNDEF: + elif self.day == UNDEF: return "%s %d" % (month_map[self.month],self.year) else: return "%02d %s %d" % (self.day,month_map[self.month],self.year) @@ -802,19 +805,40 @@ class SingleDate: return else: self.setYear(int(matches[3])) - self.setMonth(_UNDEF) - self.setDay(_UNDEF) + self.setMonth(UNDEF) + self.setDay(UNDEF) return match = SingleDate.fmt3.match(text) if match: matches = match.groups() self.setYearVal(matches[3]) self.setMonthVal(matches[2]) - self.setDayVal(matches[1]) - else: - self.year = _UNDEF - self.month = _UNDEF - self.day = _UNDEF + self.setDayVal(matches[1]) + return + + match = SingleDate.fmt4.match(text) + if match: + matches = match.groups() + if l == 0: + mon = string.lower(matches[1]) + else: + mon = string.lower(matches[1])[0:l] + self.setYearVal(matches[2]) + self.setMonth(month_map[mon]+1) + self.day = UNDEF + return + + match = SingleDate.fmt5.match(text) + if match: + matches = match.groups() + self.setYearVal(matches[1]) + self.month = UNDEF + self.day = UNDEF + return + + self.year = UNDEF + self.month = UNDEF + self.day = UNDEF def set_gregorian(self,text): match = SingleDate.fmt2.match(text) @@ -822,21 +846,21 @@ class SingleDate: matches = match.groups() self.getMode(matches[0]) self.setMonthStr(matches[2]) - if self.month == _UNDEF: + if self.month == UNDEF: raise Date.Error,text self.day = int(matches[1]) if len(matches) == 4: self.setYearVal(matches[3]) else: - self.year = _UNDEF + self.year = UNDEF return 1 match = SingleDate.fmt5.match(text) if match != None: matches = match.groups() self.getMode(matches[0]) - self.month = _UNDEF - self.day = _UNDEF + self.month = UNDEF + self.day = UNDEF self.year = int(matches[1]) return 1 @@ -875,13 +899,13 @@ class SingleDate: matches = match.groups() self.getMode(matches[0]) self.setMonthStr(matches[1]) - if self.month == _UNDEF: + if self.month == UNDEF: raise Date.Error,text val = matches[2] if val: self.day = int(string.replace(val,',','')) else: - self.day = _UNDEF + self.day = UNDEF self.setYearVal(matches[3]) return 1 @@ -890,9 +914,9 @@ class SingleDate: matches = match.groups() self.getMode(matches[0]) self.setMonthStr(matches[1]) - if self.month == _UNDEF: + if self.month == UNDEF: raise Date.Error,text - self.day = _UNDEF + self.day = UNDEF if len(matches) == 4: self.setYearVal(matches[3]) return 1 @@ -902,20 +926,20 @@ class SingleDate: matches = match.groups() self.getMode(matches[0]) self.setMonthVal(matches[1]) - self.day = _UNDEF - self.year = _UNDEF + self.day = UNDEF + self.year = UNDEF return 1 raise Date.Error,text def get_sdn(self): - if self.year == _UNDEF: + if self.year == UNDEF: return 0 - if self.month == _UNDEF: + if self.month == UNDEF: month = 1 else: month = self.month + 1 - if self.day == _UNDEF: + if self.day == UNDEF: day = 1 else: day = self.day @@ -936,7 +960,7 @@ class SingleDate: elif val == JULIAN: self.convert_calendar(sdn_to_julian,val) elif val == HEBREW: - self.convert_calendar(sdn_to_hebrew,val) + self.convert_calendar(sdn_to_jewish,val) else: self.convert_calendar(sdn_to_french,val) @@ -945,9 +969,9 @@ class SingleDate: (y,m,d) = func(sdn) self.calendar = mode if y == 0 and m == 0 and d == 0: - self.year = _UNDEF - self.month = _UNDEF - self.day = _UNDEF + self.year = UNDEF + self.month = UNDEF + self.day = UNDEF else: self.year = y self.month = m-1 diff --git a/gramps/src/Makefile.in b/gramps/src/Makefile.in index d7b951e8c..548e3cfc6 100644 --- a/gramps/src/Makefile.in +++ b/gramps/src/Makefile.in @@ -4,19 +4,33 @@ bindir = @bindir@ datadir = @datadir@/@PACKAGE@ INSTALL = @INSTALL@ srcdir = @top_srcdir@ +intl_libs = @INTLLIBS@ +p15_inc = @P15_INCLUDES@ +p20_inc = @P20_INCLUDES@ +p21_inc = @P21_INCLUDES@ +p22_inc = @P22_INCLUDES@ pycomp = ${srcdir}/py-compile -CFLAGS = -fPIC -shared -O @PYTHON_INCLUDES@ @CFLAGS@ @CPPFLAGS@ -I@includedir@ +CFLAGS = -fPIC -shared -O @CFLAGS@ @CPPFLAGS@ -I@includedir@ LDFLAGS = @LDFLAGS@ -L@libdir@ @LIBS@ LANG = sv de fr es @SET_MAKE@ -all: intl.so +all: ${intl_libs} chmod +x ${pycomp} ${pycomp} *.py -intl.so: intl.c - $(CC) $(CFLAGS) $(LDFLAGS) -o intl.so intl.c +intl15.so: intl.c + $(CC) $(CFLAGS) $(LDFLAGS) $(p15_inc) -DVER15 -o $@ intl.c + +intl20.so: intl.c + $(CC) $(CFLAGS) $(LDFLAGS) $(p20_inc) -DVER20 -o $@ intl.c + +intl21.so: intl.c + $(CC) $(CFLAGS) $(LDFLAGS) $(p21_inc) -DVER21 -o $@ intl.c + +intl22.so: intl.c + $(CC) $(CFLAGS) $(LDFLAGS) $(p22_inc) -DVER22 -o $@ intl.c install: ${INSTALL} -d ${datadir} diff --git a/gramps/src/intl.c b/gramps/src/intl.c index 94723ce49..dc5e68330 100644 --- a/gramps/src/intl.c +++ b/gramps/src/intl.c @@ -124,10 +124,22 @@ static struct PyMethodDef PyIntl_Methods[] = { }; void -initintl() +#ifdef VER15 +initintl15() +#elif VER20 +initintl20() +#elif VER21 +initintl21() +#endif { PyObject *m,*d; - m=Py_InitModule("intl",PyIntl_Methods); +#ifdef VER15 + m=Py_InitModule("intl15",PyIntl_Methods); +#elif VER20 + m=Py_InitModule("intl20",PyIntl_Methods); +#elif VER21 + m=Py_InitModule("intl21",PyIntl_Methods); +#endif d = PyModule_GetDict(m); PyDict_SetItemString(d,"LC_CTYPE",PyInt_FromLong(LC_CTYPE)); PyDict_SetItemString(d,"LC_NUMERIC",PyInt_FromLong(LC_NUMERIC)); diff --git a/gramps/src/plugins/WriteGedcom.py b/gramps/src/plugins/WriteGedcom.py index 7cafd0af8..a59fed0a9 100644 --- a/gramps/src/plugins/WriteGedcom.py +++ b/gramps/src/plugins/WriteGedcom.py @@ -27,6 +27,7 @@ import time import const import utils import intl +import Date _ = intl.gettext from gtk import * @@ -48,6 +49,17 @@ family_list = [] source_list = [] adopt_mode = 1 +_hmonth = [ "", "ELUL", "TSH", "CSH", "KSL", "TVT", "SHV", "ADR", + "ADS", "NSN", "IYR", "SVN", "TMZ", "AAV", "ELL" ] + +_fmonth = [ + "", "VEND", "BRUM", "FRIM", "NIVO", "PLUV", "VENT", + "GERM", "FLOR", "PRAI", "MESS", "THER", "FRUC", "EXTR"] + +_month = [ + "", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", + "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ] + #------------------------------------------------------------------------- # # @@ -304,8 +316,11 @@ def write_long_text(g,tag,level,note): # #------------------------------------------------------------------------- def dump_event_stats(g,event): - if event.getSaveDate() != "": - g.write("2 DATE %s\n" % cnvtxt(event.getSaveDate())) + dateobj = event.getDateObj() + if not dateobj.isEmpty(): + print_date(g,"2 DATE",dateobj) + elif dateobj.getText() != "": + g.write("2 DATE %s\n" % cnvtxt(dateobj.getText())) if event.getPlaceName() != "": g.write("2 PLAC %s\n" % cnvtxt(event.getPlaceName())) if event.getCause() != "": @@ -314,6 +329,70 @@ def dump_event_stats(g,event): write_long_text(g,"NOTE",2,event.getNote()) for srcref in event.getSourceRefList(): write_source_ref(g,2,srcref) + +def print_date(g,prefix,date): + if date.get_calendar() == Date.GREGORIAN: + cal = '' + if date.isRange(): + val = "FROM %s TO %s" % (make_date(date.get_start_date(),_month), + make_date(date.get_stop_date(),_month)) + else: + val = make_date(date.get_start_date(),_month) + elif date.get_calendar() == Date.HEBREW: + cal = '@#HEBREW@ ' + if date.isRange(): + val = "FROM %s TO %s" % (make_date(date.get_start_date(),_hmonth), + make_date(date.get_stop_date(),_hmonth)) + else: + val = make_date(date.get_start_date(),_hmonth) + elif date.get_calendar() == Date.FRENCH: + cal = '@#FRENCH R@ ' + if date.isRange(): + val = "FROM %s TO %s" % (make_date(date.get_start_date(),_fmonth), + make_date(date.get_stop_date(),_fmonth)) + else: + val = make_date(date.get_start_date(),_fmonth) + else: + cal = '@#JULIAN@ ' + if date.isRange(): + val = "FROM %s TO %s" % (make_date(date.get_start_date(),_month), + make_date(date.get_stop_date(),_month)) + else: + val = make_date(date.get_start_date(),_month) + g.write("%s %s%s\n" % (prefix,cal,val)) + +def make_date(subdate,mmap): + retval = "" + day = subdate.getDay() + mon = subdate.getMonth() + year = subdate.getYear() + mode = subdate.getModeVal() + + print day,mon,year + if day == Date.UNDEF: + if mon == Date.UNDEF: + retval = str(year) + elif year == Date.UNDEF: + retval = mmap[mon] + else: + retval = "%s %d" % (mmap[mon],year) + elif mon == Date.UNDEF: + retval = str(year) + else: + month = mmap[mon] + if year == Date.UNDEF: + retval = "%d %s ????" % (day,month) + else: + retval = "%d %s %d" % (day,month,year) + + if mode == Date.SingleDate.about: + retval = "ABT %s" % retval + elif mode == Date.SingleDate.before: + retval = "BEFORE" + " " + retval + elif mode == Date.SingleDate.after: + retval = "AFTER" + " " + retval + + return retval def fmtline(text,limit,level): new_text = []