[ooo-build-commit] .: bin/add_acor.py bin/add_acor.py.in bin/fixguard.py bin/fixguard.py.in configure.in

Fridrich Strba fridrich at kemper.freedesktop.org
Mon Oct 4 14:52:10 PDT 2010


 bin/add_acor.py    |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 bin/add_acor.py.in |   84 -----------------------------------------------------
 bin/fixguard.py    |   27 +++++++++++++++++
 bin/fixguard.py.in |   27 -----------------
 configure.in       |    2 -
 5 files changed, 111 insertions(+), 113 deletions(-)

New commits:
commit 216ee40314d9efb0f6f32af21b0f8c9999fd99ed
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Mon Oct 4 23:51:47 2010 +0200

    None of the python files is needed for build

diff --git a/bin/add_acor.py b/bin/add_acor.py
new file mode 100755
index 0000000..4874e1d
--- /dev/null
+++ b/bin/add_acor.py
@@ -0,0 +1,84 @@
+#!/usr/bin/python
+
+import zipfile
+import xml.dom.minidom
+import os
+import csv
+import sys
+
+
+def read_list( file ):
+    langs = dict();
+
+    file_hd = open( file )
+    reader = csv.reader( file_hd )
+    reader.next( ) # Skip the headers line
+    for row in reader:
+        locale = row[0]
+        if locale == "":
+            locale = 'all'
+        values = []
+        if locale in langs:
+            values = langs[locale]
+        values.append( ( row[1], unicode( row[2], "utf-8" ) ) )
+        langs[locale] = values
+    return langs
+
+def extract_items( data, locale ):
+    entries = []
+    if 'all' in data:
+        entries = entries + data['all']
+    if locale in data:
+        entries = entries + data[locale]
+    return entries
+
+def update_zip( file, items ):
+    tmpname = file + ".new"
+
+    # First open the dat to extract the existing Documentlist.xml file
+    inFile = zipfile.ZipFile( file, "r" )
+    content = inFile.read( "DocumentList.xml" )
+
+    xmlDoc = xml.dom.minidom.parseString( content )
+
+    # Actually add the elements in the XML file
+    for pair in items:
+        node = xmlDoc.createElement( "block-list:block" )
+        node.setAttribute( "block-list:abbreviated-name", pair[0] )
+        node.setAttribute( "block-list:name", pair[1] )
+        xmlDoc.documentElement.appendChild( node )
+
+    # Open the dat file for writing now
+    outFile = zipfile.ZipFile( tmpname, "w" )
+    data = xmlDoc.toxml().encode( "utf-8" )
+    for name in inFile.namelist( ):
+        if name != "DocumentList.xml":
+            outFile.writestr( name, inFile.read( name ) )
+
+    outFile.writestr( "DocumentList.xml", data )
+    inFile.close()
+    outFile.close()
+
+    # Rename the new file
+    os.rename( tmpname, file )
+
+def main():
+    if ( len( sys.argv ) == 3 ):
+        builddir = sys.argv[1]
+        datafile = sys.argv[2]
+    else:
+        print "arguments: build-dir data-file.csv"
+        sys.exit( 1 )
+
+    data = read_list( datafile )
+    for root, dirs, files in os.walk( os.path.join( builddir, "extras", "source", "autotext", "lang" ) ):
+        for f in files:
+            if ( f.endswith( ".dat" ) ):
+                locale = os.path.basename( root )
+                items = extract_items( data, locale )
+                if len( items ) > 0:
+                    print "Updating: " + os.path.join( root, f )
+                    update_zip( os.path.join( root, f ), items )
+
+if __name__ == '__main__':
+    main( )
diff --git a/bin/add_acor.py.in b/bin/add_acor.py.in
deleted file mode 100755
index c628dd8..0000000
--- a/bin/add_acor.py.in
+++ /dev/null
@@ -1,84 +0,0 @@
-#!@PYTHON@
-
-import zipfile
-import xml.dom.minidom
-import os
-import csv
-import sys
-
-
-def read_list( file ):
-    langs = dict();
-
-    file_hd = open( file )
-    reader = csv.reader( file_hd )
-    reader.next( ) # Skip the headers line
-    for row in reader:
-        locale = row[0]
-        if locale == "":
-            locale = 'all'
-        values = []
-        if locale in langs:
-            values = langs[locale]
-        values.append( ( row[1], unicode( row[2], "utf-8" ) ) )
-        langs[locale] = values
-    return langs
-
-def extract_items( data, locale ):
-    entries = []
-    if 'all' in data:
-        entries = entries + data['all']
-    if locale in data:
-        entries = entries + data[locale]
-    return entries
-
-def update_zip( file, items ):
-    tmpname = file + ".new"
-
-    # First open the dat to extract the existing Documentlist.xml file
-    inFile = zipfile.ZipFile( file, "r" )
-    content = inFile.read( "DocumentList.xml" )
-
-    xmlDoc = xml.dom.minidom.parseString( content )
-
-    # Actually add the elements in the XML file
-    for pair in items:
-        node = xmlDoc.createElement( "block-list:block" )
-        node.setAttribute( "block-list:abbreviated-name", pair[0] )
-        node.setAttribute( "block-list:name", pair[1] )
-        xmlDoc.documentElement.appendChild( node )
-
-    # Open the dat file for writing now
-    outFile = zipfile.ZipFile( tmpname, "w" )
-    data = xmlDoc.toxml().encode( "utf-8" )
-    for name in inFile.namelist( ):
-        if name != "DocumentList.xml":
-            outFile.writestr( name, inFile.read( name ) )
-
-    outFile.writestr( "DocumentList.xml", data )
-    inFile.close()
-    outFile.close()
-
-    # Rename the new file
-    os.rename( tmpname, file )
-
-def main():
-    if ( len( sys.argv ) == 3 ):
-        builddir = sys.argv[1]
-        datafile = sys.argv[2]
-    else:
-        print "arguments: build-dir data-file.csv"
-        sys.exit( 1 )
-
-    data = read_list( datafile )
-    for root, dirs, files in os.walk( os.path.join( builddir, "extras", "source", "autotext", "lang" ) ):
-        for f in files:
-            if ( f.endswith( ".dat" ) ):
-                locale = os.path.basename( root )
-                items = extract_items( data, locale )
-                if len( items ) > 0:
-                    print "Updating: " + os.path.join( root, f )
-                    update_zip( os.path.join( root, f ), items )
-
-if __name__ == '__main__':
-    main( )
diff --git a/bin/fixguard.py b/bin/fixguard.py
new file mode 100755
index 0000000..0451224
--- /dev/null
+++ b/bin/fixguard.py
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+import sys
+import re
+import os
+import shutil
+import tempfile
+
+exp = '#ifndef.*_(?:H|HXX|HRC|HPP)_*\s*\n(#include.*\n)#endif.*\n'
+
+filename = sys.argv[1]
+if not os.path.isfile(filename):
+    print "Error: File does not exist: " + filename
+    sys.exit(1)
+
+data = open(filename).read()
+
+temp_dir = tempfile.mkdtemp()
+temp_file = temp_dir + "/fixed"
+
+o = open(temp_file,"w")
+o.write( re.sub(exp,"\\1",data) )
+o.close()
+
+os.chmod(temp_file, 0644)
+shutil.move(temp_file, filename)
+
+os.removedirs(temp_dir)
diff --git a/bin/fixguard.py.in b/bin/fixguard.py.in
deleted file mode 100755
index 609bc4d..0000000
--- a/bin/fixguard.py.in
+++ /dev/null
@@ -1,27 +0,0 @@
-#!@PYTHON@
-import sys
-import re
-import os
-import shutil
-import tempfile
-
-exp = '#ifndef.*_(?:H|HXX|HRC|HPP)_*\s*\n(#include.*\n)#endif.*\n'
-
-filename = sys.argv[1]
-if not os.path.isfile(filename):
-    print "Error: File does not exist: " + filename
-    sys.exit(1)
-
-data = open(filename).read()
-
-temp_dir = tempfile.mkdtemp()
-temp_file = temp_dir + "/fixed"
-
-o = open(temp_file,"w")
-o.write( re.sub(exp,"\\1",data) )
-o.close()
-
-os.chmod(temp_file, 0644)
-shutil.move(temp_file, filename)
-
-os.removedirs(temp_dir)
diff --git a/configure.in b/configure.in
index 47098ae..7ad8ecb 100644
--- a/configure.in
+++ b/configure.in
@@ -506,8 +506,6 @@ AC_SUBST(PERL)
 INTLTOOL_PERL=$PERL
 AC_SUBST(INTLTOOL_PERL)
 
-AM_PATH_PYTHON
-
 AC_PATH_PROG(PKG_CONFIG, pkg-config)
 if test ! -x "$PKG_CONFIG" ; then
    AC_MSG_ERROR([


More information about the ooo-build-commit mailing list