Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-10

Using the "build_html.sh" script on Mac OS X doesn't work [solution inside]

13 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

John Stoneham

Well, I think I've fixed the script with two simple lines.

The original build_lcl_html.sh (and build_gtkintf_html.sh as well) have the following around line 30 or so:
-----------------------------------
# create description file list
DescrFiles=''
for unit in $UnitList; do
ShortFile=`echo $unit | sed -e 's/\.pp\b//g' -e 's/\.pas\b//g'` DescrFiles="$DescrFiles --descr=../$XMLSrcDir$ShortFile.xml" done
-----------------------------------

ShortFile is the problem. It contains the extension of the unit files, however the actual .xml filenames don't. So I added the following two lines to remove either .pp or .pas extension, and the documentation is now built with the script on OS X:
-----------------------------------
# create description file list
DescrFiles=''
for unit in $UnitList; do
ShortFile=`echo $unit | sed -e 's/\.pp\b//g' -e 's/\.pas\b//g'` ShortFile=${ShortFile%.pp}
ShortFile=${ShortFile%.pas}
DescrFiles="$DescrFiles --descr=../$XMLSrcDir$ShortFile.xml" done
-----------------------------------

_| ( ) |-| |\| -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081008/e01b980b/attachment-0001.html

Reply by email

Vincent Snijders
to John Stoneham
John Stoneham wrote 27 lines
Well, I think I've fixed the script with two simple lines. The original build_lcl_html.sh (and build_gtkintf_html.sh as well) have the following around line 30 or so: ----------------------------------- # create description file list DescrFiles='' for unit in $UnitList; do ShortFile=`echo $unit | sed -e 's/\.pp\b//g' -e 's/\.pas\b//g'` DescrFiles="$DescrFiles --descr=../$XMLSrcDir$ShortFile.xml" done ----------------------------------- ShortFile is the problem. It contains the extension of the unit files, however the actual .xml filenames don't. So I added the following two lines to remove either .pp or .pas extension, and the documentation is now built with the script on OS X: ----------------------------------- # create description file list DescrFiles='' for unit in $UnitList; do ShortFile=`echo $unit | sed -e 's/\.pp\b//g' -e 's/\.pas\b//g'` ShortFile=${ShortFile%.pp} ShortFile=${ShortFile%.pas} DescrFiles="$DescrFiles --descr=../$XMLSrcDir$ShortFile.xml" done -----------------------------------

Maybe sed works differently on your computer, as far as I can tell, the sed -e command is there to strip the .pp or .pas extentsion.

Vincent

Reply by email

Henry Vermaak
to Vincent Snijders

2008/10/15 Vincent Snijders :

Show quoted text 31 lines
John Stoneham schreef: > Well, I think I've fixed the script with two simple lines. > > The original build_lcl_html.sh (and build_gtkintf_html.sh as well) have > the following around line 30 or so: > ----------------------------------- > # create description file list > DescrFiles='' > for unit in $UnitList; do > ShortFile=`echo $unit | sed -e 's/\.pp\b//g' -e 's/\.pas\b//g'` > DescrFiles="$DescrFiles --descr=../$XMLSrcDir$ShortFile.xml" > done > ----------------------------------- > > ShortFile is the problem. It contains the extension of the unit files, > however the actual .xml filenames don't. So I added the following two > lines to remove either .pp or .pas extension, and the documentation is > now built with the script on OS X: > ----------------------------------- > # create description file list > DescrFiles='' > for unit in $UnitList; do > ShortFile=`echo $unit | sed -e 's/\.pp\b//g' -e 's/\.pas\b//g'` > ShortFile=${ShortFile%.pp} > ShortFile=${ShortFile%.pas} > DescrFiles="$DescrFiles --descr=../$XMLSrcDir$ShortFile.xml" > done > ----------------------------------- Maybe sed works differently on your computer, as far as I can tell, the sed -e command is there to strip the .pp or .pas extentsion.

yes, maybe it's getting confused by the multiple -e. have you tried sed 's/\(\.pp\|\.pas\)\b//g'? that sed should probably only run once, too (on the output of the ls).

henry

Reply by email

John Stoneham
to Henry Vermaak
Henry Vermaak wrote
yes, maybe it's getting confused by the multiple -e. have you tried sed 's/\(\.pp\|\.pas\)\b//g'? that sed should probably only run once, too (on the output of the ls).

Yeah, I figured it was the sed command that was the problem. The thing is, there is no need to use sed there anyway, since bash string processing handles removing those two extensions in a much simpler manner, as my "fix" shows.

_| ( ) |-| |\| -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081015/fa09b6a2/attachment.html

Reply by email

John Stoneham
to John Stoneham
John Stoneham wrote 16 lines
On Wed, Oct 15, 2008 at 10:10 AM, Henry Vermaak wrote: > yes, maybe it's getting confused by the multiple -e. have you tried > sed 's/\(\.pp\|\.pas\)\b//g'? that sed should probably only run once, > too (on the output of the ls). > Yeah, I figured it was the sed command that was the problem. The thing is, there is no need to use sed there anyway, since bash string processing handles removing those two extensions in a much simpler manner, as my "fix" shows. -- _| ( ) |-| |\|

Alright, I don't know what the deal is with sed on OS X, if it's behaving properly or what (sed syntax has always eluded me). Anyway I've attached two patch files that correct build_lcl_html.sh and build_gtkintf_html.sh to work on OS X (and linux, too -- they may have worked on linux before the patch, but they work with the patch too, so I believe this should be the preferred solution on both platforms). Instead of adding two lines, I replaced the line that used sed with the built-in bash string processing to remove the .pp, and added one line to remove any .pas as well. Sed is just overkill here, and besides it doesn't work as written on OS X. And the new version is shorter by 12 bytes, too. :)

_| ( ) |-| |\| -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081015/d1e55789/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: build_gtkintf_html.patch Type: application/octet-stream Size: 421 bytes Desc: not available Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081015/d1e55789/attachment-0002.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: build_lcl_html.patch Type: application/octet-stream Size: 1403 bytes Desc: not available Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081015/d1e55789/attachment-0003.obj

Reply by email

Vincent Snijders
to John Stoneham: Yeah, I figured it was the sed command that was the problem. The thing is, there is no…
John Stoneham wrote 12 lines
On Wed, Oct 15, 2008 at 10:10 AM, Henry Vermaak < <mailto:>> wrote: yes, maybe it's getting confused by the multiple -e. have you tried sed 's/\(\.pp\|\.pas\)\b//g'? that sed should probably only run once, too (on the output of the ls). Yeah, I figured it was the sed command that was the problem. The thing is, there is no need to use sed there anyway, since bash string processing handles removing those two extensions in a much simpler manner, as my "fix" shows.

I did not notice that, because you change still did contain the sed call:

# create description file list
DescrFiles=''
for unit in $UnitList; do
ShortFile=`echo $unit | sed -e 's/\.pp\b//g' -e 's/\.pas\b//g'` ShortFile=${ShortFile%.pp}
ShortFile=${ShortFile%.pas}
DescrFiles="$DescrFiles --descr=../$XMLSrcDir$ShortFile.xml" done

Vincent

Reply by email

Henry Vermaak
to John Stoneham: Yeah, I figured it was the sed command that was the problem. The thing is, there is no…
John Stoneham wrote 12 lines
On Wed, Oct 15, 2008 at 10:10 AM, Henry Vermaak wrote: > yes, maybe it's getting confused by the multiple -e. have you tried > sed 's/\(\.pp\|\.pas\)\b//g'? that sed should probably only run once, > too (on the output of the ls). > Yeah, I figured it was the sed command that was the problem. The thing is, there is no need to use sed there anyway, since bash string processing handles removing those two extensions in a much simpler manner, as my "fix" shows.

yes, i know about that way, since i use bash, but i thought it was bash specific? have you tested with other shells? you can also use "basename" to remove suffixes.

henry

Reply by email

John Stoneham
to Vincent Snijders: I did not notice that, because you change still did contain the sed call: # create…

On Wed, Oct 15, 2008 at 2:42 PM, Vincent Snijders <

Show quoted text 16 lines
wrote: John Stoneham schreef: I did not notice that, because you change still did contain the sed call: # create description file list DescrFiles='' for unit in $UnitList; do ShortFile=`echo $unit | sed -e 's/\.pp\b//g' -e 's/\.pas\b//g'` ShortFile=${ShortFile%.pp} ShortFile=${ShortFile%.pas} DescrFiles="$DescrFiles --descr=../$XMLSrcDir$ShortFile.xml" done

The patch in my previous email removes the sed call, so the loop now looks like this:
DescrFiles=''
for unit in $UnitList; do
ShortFile=${unit%.pp}
ShortFile=${ShortFile%.pas}
DescrFiles="$DescrFiles --descr=../$XMLSrcDir$ShortFile.xml" done

_| ( ) |-| |\| -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081015/30020c62/attachment.html

Reply by email

John Stoneham
to John Stoneham: Alright, I don't know what the deal is with sed on OS X, if it's behaving properly or…
John Stoneham wrote 15 lines
Alright, I don't know what the deal is with sed on OS X, if it's behaving properly or what (sed syntax has always eluded me). Anyway I've attached two patch files that correct build_lcl_html.sh and build_gtkintf_html.sh to work on OS X (and linux, too -- they may have worked on linux before the patch, but they work with the patch too, so I believe this should be the preferred solution on both platforms). Instead of adding two lines, I replaced the line that used sed with the built-in bash string processing to remove the .pp, and added one line to remove any .pas as well. Sed is just overkill here, and besides it doesn't work as written on OS X. And the new version is shorter by 12 bytes, too. :) -- _| ( ) |-| |\|

Sorry, but something happened when I created the diff patch for one of the files. The two attached here should be the correct patch files (I actually double-checked them this time :)

_| ( ) |-| |\| -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081015/5b22667c/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: build_gtkintf_html.patch Type: application/octet-stream Size: 421 bytes Desc: not available Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081015/5b22667c/attachment.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: build_lcl_html.patch Type: application/octet-stream Size: 413 bytes Desc: not available Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081015/5b22667c/attachment-0001.obj

Reply by email

John Stoneham
to Henry Vermaak: yes, i know about that way, since i use bash, but i thought it was bash specific? have…
Henry Vermaak wrote 5 lines
yes, i know about that way, since i use bash, but i thought it was bash specific? have you tested with other shells? you can also use "basename" to remove suffixes.

Well, the script invokes bash to run itself (the she-bang on the first line causes this), so it doesn't matter if the user is calling it from some other shell.

Also "basename" is overkill for removing suffixes (it's actually a separate program, like sed), and you'd still need to call it twice to remove both suffixes.

_| ( ) |-| |\| -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081015/5ec8f4c5/attachment.html

Reply by email

Henry Vermaak
to John Stoneham

2008/10/15 John Stoneham :

Show quoted text 10 lines
On Wed, Oct 15, 2008 at 3:25 PM, Henry Vermaak wrote: > > yes, i know about that way, since i use bash, but i thought it was > bash specific? have you tested with other shells? you can also use > "basename" to remove suffixes. Well, the script invokes bash to run itself (the she-bang on the first line causes this), so it doesn't matter if the user is calling it from some other shell.

and what if bash is a symlink to something else? it's not uncommon at all to have different shells point at the one that's installed. certain versions of osx runs zsh (luckily that also supports ${name%pattern}).

Also "basename" is overkill for removing suffixes (it's actually a separate program, like sed), and you'd still need to call it twice to remove both suffixes.

that's why i said sed should be run _once_ over the whole output of ls. either way, i really don't care. if it works it works, it's not like we're worrying about performance.

henry

Reply by email

Vincent Snijders
to John Stoneham: Sorry, but something happened when I created the diff patch for one of the files. The two…
John Stoneham wrote 27 lines
On Wed, Oct 15, 2008 at 2:33 PM, John Stoneham < <mailto:>> wrote: Alright, I don't know what the deal is with sed on OS X, if it's behaving properly or what (sed syntax has always eluded me). Anyway I've attached two patch files that correct build_lcl_html.sh and build_gtkintf_html.sh to work on OS X (and linux, too -- they may have worked on linux before the patch, but they work with the patch too, so I believe this should be the preferred solution on both platforms). Instead of adding two lines, I replaced the line that used sed with the built-in bash string processing to remove the .pp, and added one line to remove any .pas as well. Sed is just overkill here, and besides it doesn't work as written on OS X. And the new version is shorter by 12 bytes, too. :) -- _| ( ) |-| |\| Sorry, but something happened when I created the diff patch for one of the files. The two attached here should be the correct patch files (I actually double-checked them this time :)

Thanks, applied in r17013.

Vincent

Reply by email

Vincent Snijders
to Henry Vermaak: 2008/10/15 John Stoneham : and what if bash is a symlink to something else? it's not…
Henry Vermaak wrote 14 lines
2008/10/15 John Stoneham : > On Wed, Oct 15, 2008 at 3:25 PM, Henry Vermaak > wrote: >> yes, i know about that way, since i use bash, but i thought it was >> bash specific? have you tested with other shells? you can also use >> "basename" to remove suffixes. > Well, the script invokes bash to run itself (the she-bang on the first line > causes this), so it doesn't matter if the user is calling it from some other > shell. and what if bash is a symlink to something else? it's not uncommon at all to have different shells point at the one that's installed. certain versions of osx runs zsh (luckily that also supports ${name%pattern}).

If there is a symlink from bash to something else, it better support all bash syntax....

Vincent

Reply by email