You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Toralf Förster <to...@gmx.de> on 2005/03/17 09:54:55 UTC
improvement for trunk/src/en/tools/find-xsl.p
Under gentoo the xsl is not located under the
dir /usr/share/sgml/docbook/xsl-stylesheets, it is stored under the dir
under /usr/share/sgml/docbook/xsl-stylesheets-<version>
eg /usr/share/sgml/docbook/xsl-stylesheets-1.66.1/.
--
Mit freundlichen Grüßen / Sincerely yours
Toralf Förster
_____________________________________________
Warning: potentially contains traces of nuts.
Re: improvement for trunk/src/en/tools/find-xsl.p
Posted by Toralf Förster <to...@gmx.de>.
On Thu, 2005-03-17 at 10:31 +0000, Max Bowsher wrote:
> Toralf Förster wrote:
> > Under gentoo the xsl is not located under the
> > dir /usr/share/sgml/docbook/xsl-stylesheets, it is stored under the dir
> > under /usr/share/sgml/docbook/xsl-stylesheets-<version>
> > eg /usr/share/sgml/docbook/xsl-stylesheets-1.66.1/.
>
> Patches welcome.
>
> Max.
>
tfoerste@nhh221 ~/pub/svnbook/trunk/src/tools $ svn diff find-xsl.py
Index: find-xsl.py
===================================================================
--- find-xsl.py (revision 1179)
+++ find-xsl.py (working copy)
@@ -2,12 +2,14 @@
import sys
import os
+import glob
#######################################################
candidate_xsldirs = (
'/usr/share/sgml/docbook/xsl-stylesheets',
'/usr/share/docbook-xsl',
# Please add your OS's location here if not listed!
+ # Gentoo: '/usr/share/sgml/docbook/xsl-stylesheets-<version>',
)
#######################################################
@@ -23,6 +25,17 @@
os.symlink(i, xsl_dir)
print "Found and linked %s" % (i,)
break
-else:
+
+if not os.path.exists(xsl_dir):
+ for i in candidate_xsldirs:
+ for j in glob.glob(i + '-*'):
+ if os.path.exists(os.path.join(j, 'html', 'docbook.xsl')):
+ os.symlink(j, xsl_dir)
+ print "Found and linked %s" % (j,)
+ break
+
+if not os.path.exists(xsl_dir):
sys.stderr.write('ERROR: Failed to find a DocBook XSL directory\n')
sys.exit(1)
+else:
+ sys.exit(0)
--
Mit freundlichen Grüßen / Sincerely yours
Toralf Förster
_____________________________________________
Warning: potentially contains traces of nuts.
Re: improvement for trunk/src/en/tools/find-xsl.p
Posted by Max Bowsher <ma...@ukf.net>.
Toralf Förster wrote:
> On Thu, 2005-03-17 at 10:31 +0000, Max Bowsher wrote:
>> Toralf Förster wrote:
>>> Under gentoo the xsl is not located under the
>>> dir /usr/share/sgml/docbook/xsl-stylesheets, it is stored under the dir
>>> under /usr/share/sgml/docbook/xsl-stylesheets-<version>
>>> eg /usr/share/sgml/docbook/xsl-stylesheets-1.66.1/.
>>
>> Patches welcome.
>>
>> Max.
>>
> My first Python experiences, don't cry, please :-)
>
[snip]
A patch (i.e. svn diff), not full text.
Max.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: improvement for trunk/src/en/tools/find-xsl.p
Posted by Toralf Förster <to...@gmx.de>.
On Thu, 2005-03-17 at 10:31 +0000, Max Bowsher wrote:
> Toralf Förster wrote:
> > Under gentoo the xsl is not located under the
> > dir /usr/share/sgml/docbook/xsl-stylesheets, it is stored under the dir
> > under /usr/share/sgml/docbook/xsl-stylesheets-<version>
> > eg /usr/share/sgml/docbook/xsl-stylesheets-1.66.1/.
>
> Patches welcome.
>
> Max.
>
My first Python experiences, don't cry, please :-)
#!/usr/bin/env python
import sys
import os
import glob
#######################################################
candidate_xsldirs = (
'/usr/share/sgml/docbook/xsl-stylesheets',
'/usr/share/docbook-xsl',
# Please add your OS's location here if not listed!
# Gentoo: '/usr/share/sgml/docbook/xsl-stylesheets-<version>',
)
#######################################################
tools_dir = os.path.dirname(sys.argv[0])
xsl_dir = os.path.join(tools_dir, 'xsl')
if os.path.exists(xsl_dir):
print "XSL directory %s already exists" % (xsl_dir,)
sys.exit(0)
for i in candidate_xsldirs:
if os.path.exists(os.path.join(i, 'html', 'docbook.xsl')):
os.symlink(i, xsl_dir)
print "Found and linked %s" % (i,)
break
else:
for j in glob.glob(i + '-*'):
if os.path.exists(os.path.join(j, 'html', 'docbook.xsl')):
os.symlink(j, xsl_dir)
print "Found and linked %s" % (j,)
break
if os.path.exists(xsl_dir):
sys.exit(0)
else:
sys.stderr.write('ERROR: Failed to find a DocBook XSL directory\n')
sys.exit(1)
--
Mit freundlichen Grüßen / Sincerely yours
Toralf Förster
_____________________________________________
Warning: potentially contains traces of nuts.
Re: improvement for trunk/src/en/tools/find-xsl.p
Posted by Max Bowsher <ma...@ukf.net>.
Toralf Förster wrote:
> Under gentoo the xsl is not located under the
> dir /usr/share/sgml/docbook/xsl-stylesheets, it is stored under the dir
> under /usr/share/sgml/docbook/xsl-stylesheets-<version>
> eg /usr/share/sgml/docbook/xsl-stylesheets-1.66.1/.
Patches welcome.
Max.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org