[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: improvement for trunk/src/en/tools/find-xsl.p

From: Toralf Förster <toralf.foerster_at_gmx.de>
Date: 2005-03-19 14:10:35 CET

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.

Received on Sat Mar 19 14:13:00 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.