]> git.lyx.org Git - features.git/blobdiff - lib/configure.py
configure.py: Be more explicit why file could not be removed.
[features.git] / lib / configure.py
index e9b789085e76caa5372eb06a8efba6001266ea98..f13dcbe711c2ad46798c042187bd130b045c76b7 100644 (file)
@@ -9,7 +9,7 @@
 # Full author contact details are available in file CREDITS.
 
 from __future__ import print_function
-import glob, logging, os, re, shutil, subprocess, sys, stat
+import glob, logging, os, errno, re, shutil, subprocess, sys, stat
 
 # set up logging
 logging.basicConfig(level = logging.DEBUG,
@@ -52,8 +52,13 @@ def removeFiles(filenames):
         try:
             os.remove(file)
             logger.debug('Removing file %s' % file)
-        except:
-            logger.debug('Failed to remove file %s' % file)
+        except OSError as e:
+            if e.errno == errno.ENOENT: # no such file or directory
+                logger.debug('No need to remove file %s (it does not exists)' % file)
+            elif e.errno == errno.EISDIR: # is a directory
+                logger.debug('Failed to remove file %s (it is a directory)' % file)
+            else:
+                logger.debug('Failed to remove file %s' % file)
             pass
 
 
@@ -592,6 +597,10 @@ def checkModule(module):
       return False
 
 
+texteditors = ['xemacs', 'gvim', 'kedit', 'kwrite', 'kate',
+               'nedit', 'gedit', 'geany', 'leafpad', 'mousepad',
+               'xed', 'notepad', 'WinEdt', 'WinShell', 'PSPad']
+
 def checkFormatEntries(dtl_tools):
     ''' Check all formats (\Format entries) '''
     checkViewerEditor('a Tgif viewer and editor', ['tgif'],
@@ -636,9 +645,7 @@ def checkFormatEntries(dtl_tools):
         ['gimp-remote', 'gimp'], rc_entry = [imageformats])
     addToRC(imageformats % ((iv, ie)*10))
     #
-    checkViewerEditor('a text editor',
-        ['xemacs', 'gvim', 'kedit', 'kwrite', 'kate',
-         'nedit', 'gedit', 'geany', 'leafpad', 'mousepad', 'xed', 'notepad'],
+    checkViewerEditor('a text editor', texteditors,
         rc_entry = [r'''\Format asciichess asc    "Plain text (chess output)"  "" ""   "%%"    ""      ""
 \Format docbook    sgml    DocBook                B  ""        "%%"    "document,menu=export"  ""
 \Format docbook-xml xml   "DocBook (XML)"         "" ""        "%%"    "document,menu=export"  "application/docbook+xml"
@@ -651,7 +658,6 @@ def checkFormatEntries(dtl_tools):
 \Format r          R      "R/S code"              "" "" "%%"   "document,menu=export"  ""
 \Format knitr      Rnw    "Rnw (knitr)"           "" "" "%%"   "document,menu=export"  ""
 \Format knitr-ja   Rnw    "Rnw (knitr, Japanese)" "" "" "%%"   "document,menu=export"  ""
-\Format lilypond   ly     "LilyPond music"        "" ""        "%%"    "vector"        "text/x-lilypond"
 \Format lilypond-book    lytex "LilyPond book (LaTeX)"   "" "" "%%"    "document,menu=export"  ""
 \Format lilypond-book-ja lytex "LilyPond book (pLaTeX)"   "" ""        "%%"    "document,menu=export"  ""
 \Format latex      tex    "LaTeX (plain)"         L  ""        "%%"    "document,menu=export"  "text/x-tex"
@@ -665,6 +671,10 @@ def checkFormatEntries(dtl_tools):
 \Format text4      txt    "Plain text (catdvi)"   "" ""        "%%"    "document"      ""
 \Format textparagraph txt "Plain Text, Join Lines" "" ""       "%%"    "document"      ""
 \Format beamer.info pdf.info   "Info (Beamer)"         "" ""   "%%"    "document,menu=export"  ""''' ])
+   #Lilypond files have special editors, but fall back to plain text editors
+    checkViewerEditor('a lilypond editor',
+        ['frescobaldi'] + texteditors,
+        rc_entry = [r'''\Format lilypond   ly     "LilyPond music"        "" ""        "%%"    "vector"        "text/x-lilypond"''' ])
    #Spreadsheets using ssconvert from gnumeric
     checkViewer('gnumeric spreadsheet software', ['gnumeric'],
       rc_entry = [r'''\Format gnumeric gnumeric "Gnumeric spreadsheet" "" ""    "%%"   "document"      "application/x-gnumeric"
@@ -678,10 +688,8 @@ def checkFormatEntries(dtl_tools):
  #
     checkEditor('a BibTeX editor', ['jabref', 'JabRef',
         'pybliographic', 'bibdesk', 'gbib', 'kbib',
-        'kbibtex', 'sixpack', 'bibedit', 'tkbibtex'
-        'xemacs', 'gvim', 'kedit', 'kwrite', 'kate',
-        'jedit', 'TeXnicCenter', 'WinEdt', 'WinShell', 'PSPad',
-        'nedit', 'gedit', 'notepad', 'geany', 'leafpad', 'mousepad'],
+        'kbibtex', 'sixpack', 'bibedit', 'tkbibtex', 'TeXnicCenter'] +
+        texteditors,
         rc_entry = [r'''\Format bibtex bib    "BibTeX"         "" ""   "%%"    ""      "text/x-bibtex"''' ])
     #
     #checkProg('a Postscript interpreter', ['gs'],