From: janneke <janneke>
Date: Sat, 27 Sep 2003 13:22:23 +0000 (+0000)
Subject: * cygwin/mknetrel: Next try in building doc on Cygwin natively;
X-Git-Tag: release/2.1.3~57
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7556e55cb106aff5fa5dc68876f62b0a0e480740;p=lilypond.git

* cygwin/mknetrel: Next try in building doc on Cygwin natively;
use addmakeflags again.

* cygwin/lily-wins.py (escape_shell): New function; use it.

* scripts/lilypond.py (escape_shell): Escape quotes and other
spaces too.  Do not escape escaping backslashes.
---

diff --git a/ChangeLog b/ChangeLog
index 6fca1608ef..5364b50823 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2003-09-27  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+	* cygwin/mknetrel: Next try in building doc on Cygwin natively;
+	use addmakeflags again.
+
+	* cygwin/lily-wins.py (escape_shell): New function; use it.
+
+	* scripts/lilypond.py (escape_shell): Escape quotes and other
+	spaces too.  Do not escape escaping backslashes.
+
 	* make/srcdir.make.in (web-install): Must call install-WWW now.
 
 	* mf/GNUmakefile: resolve conflict: %list.ly is a target, not a
diff --git a/cygwin/lily-wins.py b/cygwin/lily-wins.py
index 262fd3b9bc..5612b0b6b0 100644
--- a/cygwin/lily-wins.py
+++ b/cygwin/lily-wins.py
@@ -29,6 +29,10 @@ def strip_extension (f, ext):
 		e = ''
 	return p + e
 
+def escape_shell (x):
+	return re.sub (r'''([^\\])([`'"\\\s])''', r'\1\\\2', x)
+	# help emacs'" broken python mode
+	
 debug (`sys.argv`)
 
 if len (sys.argv) != 2 \
@@ -38,7 +42,7 @@ if len (sys.argv) != 2 \
 	
 native_file = sys.argv[1]
 	
-file = read_pipe ("/usr/bin/cygpath -au '%(native_file)s'" % vars ())
+file = read_pipe ('/usr/bin/cygpath -au %s' % escape_shell (native_file))
 if not file:
 	file = native_file
 
@@ -51,12 +55,14 @@ base = os.path.basename (file)
 stem = strip_extension (base, '.ly')
 print `vars ()`
 
-native_base = read_pipe ('/usr/bin/cygpath -aw %(dir)s/%(stem)s' % vars ())
+native_base = '%(dir)s/%(stem)s' % vars ()
+native_base = read_pipe ('/usr/bin/cygpath -aw %s' % escape_shell (native_base))
+			 
 if not native_base:
 	native_base = '%(dir)s/%(stem)s' % vars ()
 
 pdfname = read_pipe ('/usr/bin/regtool get /root/.pdf/')
-pdfopencommand = read_pipe ("/usr/bin/regtool get '/root/%(pdfname)s/shell/open/command/'" % vars ())
+pdfopencommand = read_pipe ('/usr/bin/regtool get /root/%s/shell/open/command/' % escape_shell (pdfname))
 
 # hmm
 native_view = re.sub ('"([^"]*).*"', '\\1', pdfopencommand)
@@ -64,16 +70,17 @@ if not native_view:
 	native_view = 'acrobat'
 	
 if native_view:
-	pdfview = read_pipe ("/usr/bin/cygpath -au '%(native_view)s'" % vars ())
+	pdfview = read_pipe ('/usr/bin/cygpath -au %s' % escape_shell (native_view))
 if not pdfview:
 	# message box?
 	sys.stderr.write ('no pdf viewer found\n')
 	pdfview = 'xpdf'
 
 os.chdir (dir)
-system ("/usr/bin/lilypond '%(base)s' > '%(stem)s.log' 2>&1" % vars ())
+system ('/usr/bin/lilypond %s > %s.log 2>&1' % (escape_shell (base),
+						escape_shell (stem)))
 if not os.path.exists ('%(stem)s.pdf' % vars ()):
 	# message box?
 	sys.stderr.write ('pdf output not found\n')
 
-system ("'%(pdfview)s' '%(native_base)s.pdf'" % vars ())
+system ('%s %s.pdf' % (escape_shell (pdfview), escape_shell (native_base)))
diff --git a/cygwin/mknetrel b/cygwin/mknetrel
index b054ec12e8..3bab957802 100644
--- a/cygwin/mknetrel
+++ b/cygwin/mknetrel
@@ -103,13 +103,14 @@ prebuild () {
 	cp -pv mf/out-for-build/* mf/out
     fi
 
-    EXTRABUILDARGS="LDFLAGS=$cygwin_root/usr/bin/libpython2.3.dll"
-
     # set LDFLAGS to find the python library
-    # addmakeflags LDFLAGS="$cygwin_root/usr/bin/libpython2.3.dll" ' ' "target=i686-pc-cygwin" ' '
+    # EXTRABUILDARGS="LDFLAGS=$cygwin_root/usr/bin/libpython2.3.dll"
+
+    addmakeflags LDFLAGS="$cygwin_root/usr/bin/libpython2.3.dll" ' ' "target=i686-pc-cygwin" ' '
 
     if iscygwin; then
-	EXTRABUILDARGS="$EXTRABUILDARGS all doc web"
+	# EXTRABUILDARGS="$EXTRABUILDARGS all doc web"
+	addmakeflags all ' ' doc ' ' web ' '
     fi
 }
 
@@ -121,7 +122,8 @@ preinstall () {
 #	EXTRAINSTALLARGS="target=i686-pc-cygwin"
 #    else
     if iscygwin; then
-	EXTRAINSTALLARGS="web-install target=i686-pc-cygwin"
+	#EXTRAINSTALLARGS="web-install target=i686-pc-cygwin"
+	addmakeflags web-install
     fi
 }
 
diff --git a/scripts/lilypond.py b/scripts/lilypond.py
index f75cb4c624..681b8fa231 100644
--- a/scripts/lilypond.py
+++ b/scripts/lilypond.py
@@ -233,12 +233,13 @@ def set_setting (dict, key, val):
 		dict[key] = [val]
 
 
-def escape_path (x):
-	return re.sub ('([ \n\t\\\\])', r'\\\1',x)
+def escape_shell (x):
+	return re.sub (r'''([^\\])([`'"\\\s])''', r'\1\\\2', x)
+	# help emacs'" broken python mode
 
 def run_lilypond (files, dep_prefix):
 	def make_include_option (x):
-		return '-I %s' %   escape_path (x)
+		return '-I %s' %   escape_shell (x)
 
 	opts = ''
 	opts = opts + ' ' + string.join (map (make_include_option, include_path))
@@ -258,7 +259,7 @@ def run_lilypond (files, dep_prefix):
 		if dep_prefix:
 			opts = opts + ' --dep-prefix=%s' % dep_prefix
 
-	fs = string.join (map (escape_path, files))
+	fs = string.join (map (escape_shell, files))
 
 	global verbose_p
 	if verbose_p: