From: Jan Nieuwenhuizen Date: Sun, 23 Oct 2005 18:54:34 +0000 (+0000) Subject: * scm/lily.scm: Remove horrendous running-from-gui? kludge. X-Git-Tag: release/2.7.15~29 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=546afcd721b65be0463dd1242b066bfd64364959;p=lilypond.git * scm/lily.scm: Remove horrendous running-from-gui? kludge. (lilypond-main): Redirect to gui-main if 'gui is set. Backportme. * scripts/midi2ly.py (datadir): Add libdir iso datadir to path, for alternative installations kludging s/share/lib/g LILYPONDPREFIX. Backportme. * SConstruct (libdir_package_version): Define. * python/SConscript: * python/GNUmakefile (INSTALLATION_OUT_DIR): Install binary .so module in libdir. Backportme. --- diff --git a/ChangeLog b/ChangeLog index 76129c1300..b3f04a4727 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2005-10-23 Jan Nieuwenhuizen + + * scm/lily.scm: Remove horrendous running-from-gui? kludge. + (lilypond-main): Redirect to gui-main if 'gui is set. + Backportme. + + * scripts/midi2ly.py (datadir): Add libdir iso datadir to path, + for alternative installations kludging s/share/lib/g + LILYPONDPREFIX. Backportme. + + * SConstruct (libdir_package_version): Define. + + * python/SConscript: + * python/GNUmakefile (INSTALLATION_OUT_DIR): Install binary .so + module in libdir. Backportme. + 2005-10-22 Han-Wen Nienhuys * lily/main.cc: clarify --safe. diff --git a/SConstruct b/SConstruct index c12ee970be..9e7c40b103 100644 --- a/SConstruct +++ b/SConstruct @@ -248,6 +248,8 @@ prefix = env['prefix'] bindir = os.path.join (prefix, 'bin') sharedir = os.path.join (prefix, 'share') libdir = os.path.join (prefix, 'lib') +libdir_package = os.path.join (libdir, package.name) +lidbir_package_version = os.path.join (libdir_package, version) localedir = os.path.join (sharedir, 'locale') sharedir_doc_package = os.path.join (sharedir, 'doc', package.name) sharedir_package = os.path.join (sharedir, package.name) diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index ab5de83410..501eb2023c 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -8,15 +8,16 @@ #include +#include "file-name-map.hh" #include "file-name.hh" #include "file-path.hh" -#include "main.hh" -#include "lily-parser.hh" -#include "warn.hh" -#include "source.hh" #include "lily-lexer.hh" +#include "lily-parser.hh" #include "ly-module.hh" -#include "file-name-map.hh" +#include "main.hh" +#include "program-option.hh" +#include "source.hh" +#include "warn.hh" /* Do not append `!' suffix, since 1st argument is not modified. */ LY_DEFINE (ly_set_point_and_click, "ly:set-point-and-click", @@ -52,7 +53,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", /* When running from gui, generate output in .ly source directory. */ if (output_name_global.is_empty () - && scm_call_0 (ly_lily_module_constant ("running-from-gui?")) == SCM_BOOL_T) + && ly_get_option (ly_symbol2scm ("gui")) == SCM_BOOL_T) { File_name f (file); f.base_ = ""; diff --git a/python/GNUmakefile b/python/GNUmakefile index 8c0791d7b1..b8a8a913a2 100644 --- a/python/GNUmakefile +++ b/python/GNUmakefile @@ -10,7 +10,7 @@ CONFIG_LDFLAGS= INSTALLATION_OUT_SUFFIXES=1 INSTALLATION_OUT_FILES=$(OUT_SO_MODULES) -INSTALLATION_OUT_DIR=$(local_lilypond_datadir)/python +INSTALLATION_OUT_DIR=$(local_lilypond_libdir)/python INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/python INSTALLATION_OUT_FILES1=$(OUT_PY_MODULES) $(OUT_PYC_MODULES) diff --git a/python/SConscript b/python/SConscript index a621d146d0..d0c94df0cf 100644 --- a/python/SConscript +++ b/python/SConscript @@ -11,3 +11,4 @@ pym cm install (cm + pym, env['sharedir_package_version'] + '/python') +install (cm, env['libdir_package_version'] + '/python') diff --git a/scm/lily.scm b/scm/lily.scm index 9b93992e24..197936b3e4 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -356,7 +356,9 @@ The syntax is the same as `define*-public'." (define (no-files-handler) (ly:usage) (exit 2)) - + + (if (ly:get-option 'gui) + (gui-main files)) (if (null? files) (no-files-handler)) @@ -392,29 +394,12 @@ The syntax is the same as `define*-public'." (use-modules (scm editor)) -(define-public (running-from-gui?) - (let ((have-tty? (isatty? (current-input-port)))) - ;; If no TTY and not using safe, assume running from GUI. - (cond - ((eq? PLATFORM 'windows) - ;; Always write to .log file. - (if DOS #t - ;; This only works for i586-mingw32msvc-gcc -mwindows - (not (string-match "standard input" - (format #f "~S" (current-input-port)))))) - ;; FIXME: using -dgui would be nice, but it does not work - ((eq? PLATFORM 'foo-windows) - (ly:get-option 'gui)) - ((eq? PLATFORM 'darwin) #f) - (else - (not have-tty?))))) - (define-public (gui-main files) (if (null? files) (gui-no-files-handler)) (let* ((base (basename (car files) ".ly")) (log-name (string-append base ".log"))) - (if (not (running-from-gui?)) + (if (not (ly:get-option 'gui)) (ly:message (_ "Redirecting output to ~a...") log-name)) (ly:stderr-redirect log-name "w") (ly:message "# -*-compilation-*-") @@ -437,7 +422,3 @@ The syntax is the same as `define*-public'." (ly:message (_ "Invoking `~a'...") cmd) (system cmd) (exit 1))) - -(or (not (running-from-gui?)) - (ly:get-option 'safe) - (define lilypond-main gui-main)) diff --git a/scripts/midi2ly.py b/scripts/midi2ly.py index 8726c8d59f..369e6df4cb 100644 --- a/scripts/midi2ly.py +++ b/scripts/midi2ly.py @@ -30,12 +30,18 @@ import sys ################################################################ # Users of python modules should include this snippet. # -# This soon to be removed for: import lilypond.lilylib as ly libdir = '@local_lilypond_libdir@' if not os.path.isdir (libdir): libdir = '@lilypond_libdir@' -sys.path.insert (0, os.path.join (libdir, 'python')) +# ugh +if os.environ.has_key ('LILYPONDPREFIX'): + datadir = os.environ['LILYPONDPREFIX'] + while datadir[-1] == os.sep: + datadir= datadir[:-1] + libdir = datadir.replace ('/share/', '/lib/') + +sys.path.insert (0, os.path.join (libdir, 'python')) ################################################################