Re: Windows build - Bug fixes for "out of cygwin build".

"David Genest" <[email protected]> Mon, 4 Jun 2007 21:44:46 -0400
Newsgroups gmane.comp.documentation.synopsis
Message-ID <[email protected]>
--===============0036886916==
Content-Type: multipart/alternative; 
	boundary="----=_Part_15100_16860507.1181007886938"

------=_Part_15100_16860507.1181007886938
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

Thanks a lot ! Let me review it to make sure I understand the purpose:
>
>
> > Index: autogen.sh
> > ===================================================================
> > --- autogen.sh        (revision 1825)
> > +++ autogen.sh        (working copy)
> > @@ -1,27 +1,40 @@
> >  #!/bin/sh
> >  #
> >
> > +CLEAN=0
> > +
> > +for opt in "$@"
> > +do
> > +     case $opt in
> > +             -clean) CLEAN=1 ;;
> > +             *) ;;
> > +     esac
> > +done
>
> [...]
>
> OK, you add an option to remove all configure scripts. Why do you want
> that ?
> You still need to run autogen.sh each time one of the configure.ac scripts
> has
> changed.
>
> > +        if [ "$2" == "--with-header" ]; then
> > +                autoheader
> > +        fi
>
> [...]
>
> > -conf_with_header Synopsis/Parsers/IDL
> > +conf Synopsis/Parsers/IDL --with-header
>
> Shouldn't autoheader only do something if the corresponding configure.acfile
> contains a call to AC_CONFIG_HEADERS. In other words, is the above
> addition
> really changing anything ? (I'm just trying to keep things simple...)


Because of my attempt to build on multiple environments in-cygwin,
out-of-cygwin, I was under the impression that the configure scripts of the
last run in one environment was interfering on the other. I wanted to make
sure that it was not the case, thus adding a clean option. While refactoring
this, I felt that the new structure would help expand in the future. The
addition of the option was made to remove code duplication.


> >
> >  case `uname -s` in
> >  CYGWIN*)
> > @@ -91,7 +91,7 @@
> >        if test "$CXX" == "g++"; then
> >          CPPFLAGS="$CPPFLAGS -D PARSE_MSVC"
> >          CFLAGS="-mno-cygwin $CFLAGS"
> > -        CXXFLAGS="-mno-cygwin $CXXFLAGS"
> > +        CXXFLAGS="-mno-cygwin -D_WIN32 $CXXFLAGS"
>
> This looks wrong. The compiler should predefine a platform macro. If it
> isn't _WIN32, we need to check for something else. To see what macros
> are predefined, you can use 'g++ -v -dD -E ...' (just what we do when
> invoking gcc from the Emulator module).


Ok, if this is wrong, where should I put the define ? The Path.cc file needs
to be aware of the correct define in order to select the path-win32.cc or
path-posix.cc . Anyway, as someone is already porting to boost::filesystem,
the problem will go away. But there might be other places where we need this
information. I'm not sure I understand the way you suggest of finding that
out.


> Index: Synopsis/dist/command/build_doc.py
> > ===================================================================
>
> > @@ -43,7 +51,7 @@
> >     def finalize_options (self):
> >
> >        # If no option was given, do all media.
> > -      if not (self.html or self.printable or self.sxr):
> > +      if not ( self.html or self.printable or self.sxr or self.tutorial
> ):
> >           self.html = self.printable = True
>
> I think the logic here was to set all media options to True if none
> was given. 'tutorial' isn't a medium. ' setup.py build_doc --tutorial'
> still doesn't tell whether to generate html or pdf.


You are right, I had changed this in order to debug, and forgot to remove
it.


>        build.build.finalize_options(self)
> >
> > @@ -56,7 +64,7 @@
> >        self.build_lib = '.'
> >
> >        if self.man_page: self.build_man_page()
> > -      if self.ref_manual or self.sxr: self.build_ref_manual()
> > +      if self.ref_manual or self.sxr or self.html:
> self.build_ref_manual()
>
> Similarly here: 'setup.py build_doc --tutorial --html' should build the
> tutorial,
> but not the reference manual.


 same....

>        if self.tutorial : self.build_tutorial()
> >
> >     def build_man_page(self):
> > @@ -100,17 +108,18 @@
> >        self.announce("building API reference manual")
> >
> >        tmp_man_dir = os.path.abspath (os.path.join(self.build_temp,
> > -                                                 'doc/Manual'))
> > +                                                 'Release/doc/Manual'))
>
> I'm not sure about that one. Is the original path wrong ? (I remember
> having seen 'Release/' as part of some path when building on windows, but
> probably only in the compilation of the code, not the doc generation. So
> is
> this for consistency only ? Also, you seem to make this change
> irrespectively
> of the platform. This should be 'nt' only, no ?)


When I  tried debugging,  I saw that the all the outputs were not made at
the same place. There was a Release prefix in my build. I thought it was
needed, but you are right, I was careless about the platform. We should:
remove the Release/ prefix, or add a special case. I prefer the former. I do
not know where the Release/ prefix comes from.

You will probably need the major part of the fix for the multiplatform
support of the doc build.

>        make = os.environ.get('MAKE', 'make')
> >
> >        build_clib = self.distribution.get_command_obj('build_clib')
> >        build_clib.ensure_finalized()
> >
> > -      tmpdir = os.path.join(build_clib.build_ctemp, 'src')
> > +      tmpdir = os.path.abspath (os.path.join(build_clib.build_ctemp,
> 'src'))
> >
> > -      # build the 'doc' target
> > -      spawn([make, '-C', tmpdir, 'doc'])
> > +       # build the 'doc' target
> > +      makecommand = '%s -C %s doc'% (make, makePlatformPath(tmpdir))
> > +      spawn(['sh', '-c', makecommand])
> >
> >        for d in ['cxx.syn', 'cxx-sxr.syn']:
> >           src, dest = os.path.join(tmpdir, d), os.path.join(tmp_man_dir,
> d)
> > @@ -126,19 +135,20 @@
> >              print 'not copying', src
> >
> >        # now run make inside doc/Manual to do the rest
> > -
> > -      srcdir = os.path.abspath('doc/Manual/')
> > -
> >        cwd = os.getcwd()
> >        mkpath(tmp_man_dir, 0777, self.verbose, self.dry_run)
> >
> >        if self.html :
> > -         spawn([make, '-C', tmp_man_dir, 'html'])
> > +         target = 'html'
> >        if self.printable:
> > -         spawn([make, '-C', tmp_man_dir, 'pdf'])
> > +         target = 'pdf'
> >        if self.sxr:
> > -         spawn([make, '-C', tmp_man_dir, 'sxr', 'sxr=%s'%self.sxr])
> > +         target = 'sxr sxr=%s'%self.sxr
> >
> > +      if not target == None:
> > +         command = 'make -C %s %s' % (makePlatformPath(tmp_man_dir),
> target)
> > +         spawn(['sh', '-c', command], self.verbose, self.dry_run )
> > +
>
> Careful here. '--html' and '--printable' aren't exclusive, i.e.
> 'setup.py build_doc --html --printable' is an entirely reasonable command.
> With your change this wouldn't work any more.


Right again. My refactoring introduced a subtle error. Nice catch... Would
the concatenation operation work here (so we can have "make -C html pdf")?


> Index: Synopsis/dist/command/build_ext.py
> > ===================================================================
> > --- Synopsis/dist/command/build_ext.py        (revision 1825)
> > +++ Synopsis/dist/command/build_ext.py        (working copy)
> > @@ -83,7 +83,7 @@
> >
> >          make = os.environ.get('MAKE', 'make')
> >
> > -        command = '%s -C "%s" %s'%(make, path, ext[1])
> > +        command = '%s -C \"%s\" %s'%(make, path, ext[1])
>
> Why is that needed ? (I'm confused: a single '\' will escape the following
> character, in python. That shouldn't be needed. Are you trying to escape
> one level down, i.e. in the command that gets run later ? You'd need '\\'
> for that, no ?)
>
> >          spawn(['sh', '-c', command], self.verbose, self.dry_run)
> >
> >          #The extension may not be compiled. For now just skip it.
> > Index: Synopsis/dist/command/config.py
> > ===================================================================
> > --- Synopsis/dist/command/config.py   (revision 1825)
> > +++ Synopsis/dist/command/config.py   (working copy)
> > @@ -77,8 +77,7 @@
> >              self.config('src/Synopsis/gc', self.build_ctemp,
> self.build_clib)
> >
> >          if os.name == 'nt':
> > -            syn_cxx = '`cygpath -a %s/src`'%os.path.abspath(
> self.build_ctemp)
> > -            syn_cxx = syn_cxx.replace('\\', '\\\\\\\\\\\\\\\\')
> > +            syn_cxx = '`cygpath -a \"%s/src\"`'%os.path.abspath(
> self.build_ctemp)
>
> Same here. I'm surprized this works (though I would love to be able to
> throw away
> all this multi-escaping. It's so ugly.)


It turns out that the \ is not needed (because escaping " with \" does
nothing: ie: print 'this is \"a test\"' yields the same as: print 'this is
"a test"'). But the double quote is.
for example, without the double quotes, when I encounter this (taken from
the python setup.py setup output):
C:\bin\cygwin\bin\sh.exe -c "../../../src/configure --prefix=\"`cygpath -a
c:\bin\Python25`\" --with-python=\"`cygpath -a c:\bin\Python25`/python.exe\"

later, the script dies saying that "../../../src/configure: line 4294:
/cygdrive/c/binPython25/python.exe: No such file or directory". Someone is
clearly using the backslashes as escapes. If you use my change (without
escaping), this error goes away, and you don't need the ugly \\\\\\\\\\\\\
patch.

 I added locally the quotes fix on the latest revision (1827)  of
setup.pyand everything builds. The "| tr" fix does the job, and no
other change is
needed in the .ac files.

D.

------=_Part_15100_16860507.1181007886938
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi, <br><br><div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Thanks a lot ! Let me review it to make sure I understand the purpose:
<br><br><br>&gt; Index: autogen.sh<br>&gt; ===================================================================<br>&gt; --- autogen.sh&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(revision 1825)<br>&gt; +++ autogen.sh&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(working copy)<br>&gt; @@ -1,27 +1,40 @@
<br>&gt;&nbsp;&nbsp;#!/bin/sh<br>&gt;&nbsp;&nbsp;#<br>&gt;<br>&gt; +CLEAN=0<br>&gt; +<br>&gt; +for opt in &quot;$@&quot;<br>&gt; +do<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp; case $opt in<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -clean) CLEAN=1 ;;<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *) ;;<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp; esac
<br>&gt; +done<br><br>[...]<br><br>OK, you add an option to remove all configure scripts. Why do you want that ?<br>You still need to run autogen.sh each time one of the <a href="http://configure.ac" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

configure.ac</a> scripts has
<br>changed.<br><br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if [ &quot;$2&quot; == &quot;--with-header&quot; ]; then<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;autoheader<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi<br><br>[...]<br><br>&gt; -conf_with_header Synopsis/Parsers/IDL<br>&gt; +conf Synopsis/Parsers/IDL --with-header
<br><br>Shouldn&#39;t autoheader only do something if the corresponding <a href="http://configure.ac" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">configure.ac</a> file<br>contains a call to AC_CONFIG_HEADERS. In other words, is the above addition
<br>really changing anything ? (I&#39;m just trying to keep things simple...)
</blockquote><div><br>Because of my attempt to build on multiple environments in-cygwin, out-of-cygwin, I was under the impression that the configure scripts of the last run in one environment was interfering on the other. I wanted to make sure that it was not the case, thus adding a clean option. While refactoring this, I felt that the new structure would help expand in the future. The addition of the option was made to remove code duplication. 
<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&gt;<br>&gt;&nbsp;&nbsp;case `uname -s` in<br>&gt;&nbsp;&nbsp;CYGWIN*)<br>&gt; @@ -91,7 +91,7 @@<br>

&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if test &quot;$CXX&quot; == &quot;g++&quot;; then
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CPPFLAGS=&quot;$CPPFLAGS -D PARSE_MSVC&quot;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CFLAGS=&quot;-mno-cygwin $CFLAGS&quot;<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CXXFLAGS=&quot;-mno-cygwin $CXXFLAGS&quot;<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CXXFLAGS=&quot;-mno-cygwin -D_WIN32 $CXXFLAGS&quot;
<br><br>This looks wrong. The compiler should predefine a platform macro. If it<br>isn&#39;t _WIN32, we need to check for something else. To see what macros<br>are predefined, you can use &#39;g++ -v -dD -E ...&#39; (just what we do when
<br>invoking gcc from the Emulator module).</blockquote><div><br>Ok, if this is wrong, where should I put the define ? The Path.cc file needs to be aware of the correct define in order to select the path-win32.cc or path-posix.cc


. Anyway, as someone is already porting to boost::filesystem, the problem will go away. But there might be other places where we need this information. I&#39;m not sure I understand the way you suggest of finding that out.
<br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&gt; Index: Synopsis/dist/command/build_doc.py<br>&gt; ===================================================================
<br><br>&gt; @@ -43,7 +51,7 @@<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; def finalize_options (self):<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# If no option was given, do all media.<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if not (self.html or self.printable or self.sxr):<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if not (
self.html or self.printable or self.sxr or self.tutorial):<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.html = self.printable = True<br><br>I think the logic here was to set all media options to True if none<br>was given. &#39;tutorial&#39; isn&#39;t a medium. &#39;
setup.py build_doc --tutorial&#39;<br>still doesn&#39;t tell whether to generate html or pdf.</blockquote><div><br>You are right, I had changed this in order to debug, and forgot to remove it.<br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;build.build.finalize_options(self)<br>&gt;<br>&gt; @@ -56,7 +64,7 @@<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.build_lib = &#39;.&#39;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if self.man_page: self.build_man_page()<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if self.ref_manual


 or self.sxr: self.build_ref_manual()<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if self.ref_manual or self.sxr or self.html: self.build_ref_manual()<br><br>Similarly here: &#39;setup.py build_doc --tutorial --html&#39; should build the tutorial,<br>


but not the reference manual.</blockquote><div><br>&nbsp;same....</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if self.tutorial


: self.build_tutorial()<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; def build_man_page(self):<br>&gt; @@ -100,17 +108,18 @@<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.announce(&quot;building API reference manual&quot;)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmp_man_dir = os.path.abspath


(os.path.join(self.build_temp,<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;doc/Manual&#39;))<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;Release/doc/Manual&#39;))<br><br>I&#39;m not sure about that one. Is the original path wrong ? (I remember
<br>having seen &#39;Release/&#39; as part of some path when building on windows, but<br>probably only in the compilation of the code, not the doc generation. So is<br>this for consistency only ? Also, you seem to make this change irrespectively
<br>of the platform. This should be &#39;nt&#39; only, no ?)</blockquote><div><br>When I&nbsp; tried debugging,&nbsp; I saw that the all the outputs were not made at the same place. There was a Release prefix in my build. I thought it was needed, but you are right, I was careless about the platform. We should: remove the Release/ prefix, or add a special case. I prefer the former. I do not know where the Release/ prefix comes from. 
<br><br>You will probably need the major part of the fix for the multiplatform support of the doc build.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;make = os.environ.get(&#39;MAKE&#39;, &#39;make&#39;)<br>&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;build_clib = 
self.distribution.get_command_obj(&#39;build_clib&#39;)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;build_clib.ensure_finalized()<br>&gt;<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmpdir = os.path.join(build_clib.build_ctemp, &#39;src&#39;)<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmpdir = os.path.abspath


(os.path.join(build_clib.build_ctemp, &#39;src&#39;))<br>&gt;<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# build the &#39;doc&#39; target<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spawn([make, &#39;-C&#39;, tmpdir, &#39;doc&#39;])<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # build the &#39;doc&#39; target
<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;makecommand = &#39;%s -C %s doc&#39;% (make, makePlatformPath(tmpdir))<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spawn([&#39;sh&#39;, &#39;-c&#39;, makecommand])<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for d in [&#39;cxx.syn&#39;, &#39;cxx-sxr.syn&#39;]:
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; src, dest = os.path.join(tmpdir, d), os.path.join(tmp_man_dir, d)<br>&gt; @@ -126,19 +135,20 @@<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &#39;not copying&#39;, src<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# now run make inside doc/Manual to do the rest
<br>&gt; -<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;srcdir = os.path.abspath(&#39;doc/Manual/&#39;)<br>&gt; -<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cwd = os.getcwd()<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mkpath(tmp_man_dir, 0777, self.verbose, self.dry_run)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if self.html


:<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spawn([make, &#39;-C&#39;, tmp_man_dir, &#39;html&#39;])<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; target = &#39;html&#39;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if self.printable:<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spawn([make, &#39;-C&#39;, tmp_man_dir, &#39;pdf&#39;])
<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; target = &#39;pdf&#39;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if self.sxr:<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spawn([make, &#39;-C&#39;, tmp_man_dir, &#39;sxr&#39;, &#39;sxr=%s&#39;%self.sxr])<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; target = &#39;sxr sxr=%s&#39;%self.sxr
<br>&gt;<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if not target == None:<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command = &#39;make -C %s %s&#39; % (makePlatformPath(tmp_man_dir), target)<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spawn([&#39;sh&#39;, &#39;-c&#39;, command], self.verbose, self.dry_run


)<br>&gt; +<br><br>Careful here. &#39;--html&#39; and &#39;--printable&#39; aren&#39;t exclusive, i.e.<br>&#39;setup.py build_doc --html --printable&#39; is an entirely reasonable command.<br>With your change this wouldn&#39;t work any more.
</blockquote><div><br>Right again. My refactoring introduced a subtle error. Nice catch... Would the concatenation operation work here (so we can have &quot;make -C html pdf&quot;)?<br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


&gt; Index: Synopsis/dist/command/build_ext.py<br>&gt; ===================================================================<br>&gt; --- Synopsis/dist/command/build_ext.py&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(revision 1825)<br>&gt; +++ Synopsis/dist/command/build_ext.py&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(working copy)
<br>&gt; @@ -83,7 +83,7 @@<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;make = os.environ.get(&#39;MAKE&#39;, &#39;make&#39;)<br>&gt;<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command = &#39;%s -C &quot;%s&quot; %s&#39;%(make, path, ext[1])<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command = &#39;%s -C \&quot;%s\&quot; %s&#39;%(make, path, ext[1])
<br><br>Why is that needed ? (I&#39;m confused: a single &#39;\&#39; will escape the following<br>character, in python. That shouldn&#39;t be needed. Are you trying to escape<br>one level down, i.e. in the command that gets run later ? You&#39;d need &#39;\\&#39;
<br>for that, no ?)<br><br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spawn([&#39;sh&#39;, &#39;-c&#39;, command], self.verbose, self.dry_run)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#The extension may not be compiled. For now just skip it.<br>&gt; Index: Synopsis/dist/command/config.py
<br>&gt; ===================================================================<br>&gt; --- Synopsis/dist/command/config.py&nbsp;&nbsp; (revision 1825)<br>&gt; +++ Synopsis/dist/command/config.py&nbsp;&nbsp; (working copy)<br>&gt; @@ -77,8 +77,7 @@
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.config(&#39;src/Synopsis/gc&#39;, self.build_ctemp, self.build_clib)<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if <a href="http://os.name" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

os.name</a> == &#39;nt&#39;:<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;syn_cxx = &#39;`cygpath -a %s/src`&#39;%os.path.abspath(
self.build_ctemp)<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;syn_cxx = syn_cxx.replace(&#39;\\&#39;, &#39;\\\\\\\\\\\\\\\\&#39;)<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;syn_cxx = &#39;`cygpath -a \&quot;%s/src\&quot;`&#39;%os.path.abspath(self.build_ctemp)<br><br>


Same here. I&#39;m surprized this works (though I would love to be able to throw away<br>all this multi-escaping. It&#39;s so ugly.)</blockquote><div><br>It turns out that the \ is not needed (because escaping &quot; with \&quot; does nothing: ie: print &#39;this is \&quot;a test\&quot;&#39; yields the same as: print &#39;this is &quot;a test&quot;&#39;). But the double quote is.
<br>for example, without the double quotes, when I encounter this (taken from the python setup.py setup output): <br>C:\bin\cygwin\bin\sh.exe -c &quot;../../../src/configure --prefix=\&quot;`cygpath -a c:\bin\Python25`\&quot; --with-python=\&quot;`cygpath -a c:\bin\Python25`/python.exe\&quot; 
<br>later, the script dies saying that &quot;../../../src/configure: line 4294: /cygdrive/c/binPython25/python.exe: No such file or directory&quot;. Someone is clearly using the backslashes as escapes. If you use my change (without escaping), this error goes away, and you don&#39;t need the ugly \\\\\\\\\\\\\ patch.
<br><br>&nbsp;I added locally the quotes fix on the latest revision (1827)&nbsp; of setup.py and everything builds. The &quot;| tr&quot; fix does the job, and no other change is needed in the .ac files.<br><br>D.<br></div></div><br>


------=_Part_15100_16860507.1181007886938--

--===============0036886916==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Synopsis-devel mailing list
[email protected]
http://lists.fresco.org/cgi-bin/listinfo/synopsis-devel

--===============0036886916==--