[gnome-builder] build: avoid beautifying pathalogically long lines



commit a03a5cf3b9d796e69706c46e40b6eab9f5436dac
Author: Christian Hergert <chergert redhat com>
Date:   Fri Feb 24 13:41:54 2017 -0800

    build: avoid beautifying pathalogically long lines
    
    If the line is super long, we don't really want to ruin everything to
    match that line. So just ignore it. Tweak _MAX_LENGTH to adjust the
    hueristic.

 build/autotools/align_makefile.py                  |    6 +-
 .../autotools_templates/resources/Makefile.am      |   58 ++++----
 tests/Makefile.am                                  |  152 ++++++++++----------
 3 files changed, 110 insertions(+), 106 deletions(-)
---
diff --git a/build/autotools/align_makefile.py b/build/autotools/align_makefile.py
index 070e5bb..4f3c5ec 100755
--- a/build/autotools/align_makefile.py
+++ b/build/autotools/align_makefile.py
@@ -8,6 +8,8 @@ line and then reformat all lines to match the proper tailing whitespace.
 import os
 import sys
 
+_MAX_LENGTH = 120
+
 filenames = sys.argv[1:]
 
 def count_prefix_tabs(line):
@@ -35,7 +37,9 @@ for path in filenames:
             if line.endswith('\\\n'):
                 line = line[:-2].rstrip()
                 length = count_visual_chars(line)
-                longest = max(longest, length)
+                # if the line length is pathalogical, ignore it
+                if length < _MAX_LENGTH:
+                    longest = max(longest, length)
 
     # Now rewrite the file with the line modifications
     with open(path + '.tmp', 'w') as stream:
diff --git a/plugins/autotools-templates/autotools_templates/resources/Makefile.am 
b/plugins/autotools-templates/autotools_templates/resources/Makefile.am
index 16daa8f..9060070 100644
--- a/plugins/autotools-templates/autotools_templates/resources/Makefile.am
+++ b/plugins/autotools-templates/autotools_templates/resources/Makefile.am
@@ -3,16 +3,16 @@ SUBDIRS = data{{if enable_c}} src{{end}}{{if enable_python}} {{name_}} bin{{end}
 EXTRA_DIST = AUTHORS
 
 AUTHORS:
-       $(AM_V_GEN)if test -d "$(srcdir)/.git";                                                               
                    \
-       then                                                                                                  
                    \
-               echo Creating $@ &&                                                                           
                    \
-               ( cd "$(top_srcdir)" &&                                                                       
                    \
-                 echo '# Generated by Makefile. Do not edit.'; echo;                                         
                    \
-                 git log --no-merges --pretty=format:"%an" $(SUBDIRS)                                        
                    \
-                 | sort | uniq ) > $@.tmp                                                                    
                    \
-               && mv -f $@.tmp $@                                                                            
                    \
-               || ( rm -f $@.tmp ;                                                                           
                    \
-                    echo Failed to generate $@ >&2 );                                                        
                    \
+       $(AM_V_GEN)if test -d "$(srcdir)/.git";                        \
+       then                                                           \
+               echo Creating $@ &&                                    \
+               ( cd "$(top_srcdir)" &&                                \
+                 echo '# Generated by Makefile. Do not edit.'; echo;  \
+                 git log --no-merges --pretty=format:"%an" $(SUBDIRS) \
+                 | sort | uniq ) > $@.tmp                             \
+               && mv -f $@.tmp $@                                     \
+               || ( rm -f $@.tmp ;                                    \
+                    echo Failed to generate $@ >&2 );                 \
        else touch $@; fi
 
 # Generate the ChangeLog.
@@ -24,30 +24,30 @@ pycheck_dirs = bin {{name_}}
 
 check-local:
        @echo "  CHECK  Pyflakes" $(pycheck_dirs)
-       @if type pyflakes >/dev/null 2>&1; then                                                               
                    \
-               (cd $(abs_top_srcdir) && pyflakes $(pycheck_dirs) );                                          
                    \
-       else echo "skipped, pyflakes not installed";                                                          
                    \
+       @if type pyflakes >/dev/null 2>&1; then                        \
+               (cd $(abs_top_srcdir) && pyflakes $(pycheck_dirs) );   \
+       else echo "skipped, pyflakes not installed";                   \
        fi
-       @if test -z "$$SKIP_PEP8"; then                                                                       
                    \
-               echo "  CHECK  PEP8";                                                                         
                    \
-               if type pep8 >/dev/null 2>&1; then                                                            
                    \
+       @if test -z "$$SKIP_PEP8"; then                                \
+               echo "  CHECK  PEP8";                                  \
+               if type pep8 >/dev/null 2>&1; then                     \
                        (cd $(abs_top_srcdir) && pep8 --ignore=E501,E123,E124,E402,E731 --repeat 
--show-source $(pycheck_dirs) ); \
-               else echo "skipped, pep8 not installed";                                                      
                    \
-               fi;                                                                                           
                    \
+               else echo "skipped, pep8 not installed";               \
+               fi;                                                    \
        fi
 {{end}}
 
-GITIGNOREFILES =                                                                                             
                     \
-       **/*.swp                                                                                              
                    \
-       *.o                                                                                                   
                    \
-       aclocal.m4                                                                                            
                    \
-       build-aux                                                                                             
                    \
-       ChangeLog                                                                                             
                    \
-       config                                                                                                
                    \
-       config.h.in                                                                                           
                    \
-       gtk-doc.m4                                                                                            
                    \
-       gtk-doc.make                                                                                          
                    \
-       INSTALL                                                                                               
                    \
+GITIGNOREFILES =                                                       \
+       **/*.swp                                                       \
+       *.o                                                            \
+       aclocal.m4                                                     \
+       build-aux                                                      \
+       ChangeLog                                                      \
+       config                                                         \
+       config.h.in                                                    \
+       gtk-doc.m4                                                     \
+       gtk-doc.make                                                   \
+       INSTALL                                                        \
        $(NULL)
 
 -include $(top_srcdir)/git.mk
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8c9d93d..a0b9477 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,87 +3,87 @@
 
 EXTRA_DIST =
 
-egg_cflags =                                                                                                 
                                            \
-       $(DEBUG_CFLAGS)                                                                                       
                                           \
-       $(LIBIDE_CFLAGS)                                                                                      
                                           \
-       -I$(top_srcdir)/contrib/egg                                                                           
                                           \
-       -DTEST_DATA_DIR="\"$(abs_srcdir)/data\""                                                              
                                           \
+egg_cflags =                                                    \
+       $(DEBUG_CFLAGS)                                         \
+       $(LIBIDE_CFLAGS)                                        \
+       -I$(top_srcdir)/contrib/egg                             \
+       -DTEST_DATA_DIR="\"$(abs_srcdir)/data\""                \
        $(NULL)
 
-egg_libs =                                                                                                   
                                            \
-       $(LIBIDE_LIBS)                                                                                        
                                           \
-       $(top_builddir)/contrib/egg/libegg-private.la                                                         
                                           \
+egg_libs =                                                      \
+       $(LIBIDE_LIBS)                                          \
+       $(top_builddir)/contrib/egg/libegg-private.la           \
        $(NULL)
 
-rg_cflags =                                                                                                  
                                            \
-       $(DEBUG_CFLAGS)                                                                                       
                                           \
-       $(RG_CFLAGS)                                                                                          
                                           \
-       -I$(top_srcdir)/contrib/egg                                                                           
                                           \
-       -I$(top_srcdir)/contrib/rg                                                                            
                                           \
+rg_cflags =                                                     \
+       $(DEBUG_CFLAGS)                                         \
+       $(RG_CFLAGS)                                            \
+       -I$(top_srcdir)/contrib/egg                             \
+       -I$(top_srcdir)/contrib/rg                              \
        $(NULL)
 
-rg_libs =                                                                                                    
                                            \
-       $(top_builddir)/contrib/egg/libegg-private.la                                                         
                                           \
-       $(top_builddir)/contrib/rg/librg.la                                                                   
                                           \
-       $(RG_LIBS)                                                                                            
                                           \
+rg_libs =                                                       \
+       $(top_builddir)/contrib/egg/libegg-private.la           \
+       $(top_builddir)/contrib/rg/librg.la                     \
+       $(RG_LIBS)                                              \
        $(NULL)
 
-jsonrpc_cflags =                                                                                             
                                            \
-       $(DEBUG_CFLAGS)                                                                                       
                                           \
-       $(JSONRPC_CFLAGS)                                                                                     
                                           \
-       -I$(top_srcdir)/contrib/jsonrpc-glib                                                                  
                                           \
+jsonrpc_cflags =                                                \
+       $(DEBUG_CFLAGS)                                         \
+       $(JSONRPC_CFLAGS)                                       \
+       -I$(top_srcdir)/contrib/jsonrpc-glib                    \
        $(NULL)
 
-jsonrpc_libs =                                                                                               
                                            \
-       $(top_builddir)/contrib/jsonrpc-glib/libjsonrpc-glib.la                                               
                                           \
-       $(JSONRPC_LIBS)                                                                                       
                                           \
+jsonrpc_libs =                                                  \
+       $(top_builddir)/contrib/jsonrpc-glib/libjsonrpc-glib.la \
+       $(JSONRPC_LIBS)                                         \
        $(NULL)
 
-search_cflags =                                                                                              
                                            \
-       $(DEBUG_CFLAGS)                                                                                       
                                           \
-       $(SEARCH_CFLAGS)                                                                                      
                                           \
-       -I$(top_srcdir)/contrib/search                                                                        
                                           \
-       -I$(top_srcdir)/libide/util                                                                           
                                           \
+search_cflags =                                                 \
+       $(DEBUG_CFLAGS)                                         \
+       $(SEARCH_CFLAGS)                                        \
+       -I$(top_srcdir)/contrib/search                          \
+       -I$(top_srcdir)/libide/util                             \
        $(NULL)
 
-search_libs =                                                                                                
                                            \
-       $(SEARCH_LIBS)                                                                                        
                                           \
-       $(top_builddir)/contrib/search/libsearch.la                                                           
                                           \
-       $(top_builddir)/libide/libide-1.0.la                                                                  
                                           \
-       $(top_builddir)/contrib/egg/libegg-private.la                                                         
                                           \
+search_libs =                                                   \
+       $(SEARCH_LIBS)                                          \
+       $(top_builddir)/contrib/search/libsearch.la             \
+       $(top_builddir)/libide/libide-1.0.la                    \
+       $(top_builddir)/contrib/egg/libegg-private.la           \
        $(NULL)
 
-tests_cflags =                                                                                               
                                            \
-       $(egg_cflags)                                                                                         
                                           \
-       $(LIBIDE_CFLAGS)                                                                                      
                                           \
-       -I$(top_srcdir)/libide                                                                                
                                           \
-       -I$(top_builddir)/libide                                                                              
                                           \
-       -I$(top_srcdir)/contrib/pnl                                                                           
                                           \
-       -I$(top_builddir)/contrib/pnl                                                                         
                                           \
+tests_cflags =                                                  \
+       $(egg_cflags)                                           \
+       $(LIBIDE_CFLAGS)                                        \
+       -I$(top_srcdir)/libide                                  \
+       -I$(top_builddir)/libide                                \
+       -I$(top_srcdir)/contrib/pnl                             \
+       -I$(top_builddir)/contrib/pnl                           \
        $(NULL)
 
-tests_libs =                                                                                                 
                                            \
-       $(LIBIDE_LIBS)                                                                                        
                                           \
-       $(top_builddir)/libide/libide-1.0.la                                                                  
                                           \
-       $(top_builddir)/contrib/egg/libegg-private.la                                                         
                                           \
+tests_libs =                                                    \
+       $(LIBIDE_LIBS)                                          \
+       $(top_builddir)/libide/libide-1.0.la                    \
+       $(top_builddir)/contrib/egg/libegg-private.la           \
        $(NULL)
 
-tests_ldflags =                                                                                              
                                            \
-       -export-dynamic                                                                                       
                                           \
+tests_ldflags =                                                 \
+       -export-dynamic                                         \
        $(NULL)
 
 misc_programs =
 
-TESTS_ENVIRONMENT=                                                                                           
                                            \
+TESTS_ENVIRONMENT=                                              \
        
GI_TYPELIB_PATH="$(top_builddir)/libide:$(top_builddir)/contrib/tmpl:$(top_builddir)/contrib/egg:$(top_builddir)/contrib/pnl:$(GI_TYPELIB_PATH)"
 \
-       GB_IN_TREE_PLUGINS=1                                                                                  
                                           \
-       G_TEST_SRCDIR="$(abs_srcdir)"                                                                         
                                           \
-       G_TEST_BUILDDIR="$(abs_builddir)"                                                                     
                                           \
-       G_DEBUG=gc-friendly                                                                                   
                                           \
-       GSETTINGS_BACKEND=memory                                                                              
                                           \
-       GTK_IM_METHOD=none                                                                                    
                                           \
-       PYTHONDONTWRITEBYTECODE=yes                                                                           
                                           \
-       MALLOC_CHECK_=2                                                                                       
                                           \
+       GB_IN_TREE_PLUGINS=1                                    \
+       G_TEST_SRCDIR="$(abs_srcdir)"                           \
+       G_TEST_BUILDDIR="$(abs_builddir)"                       \
+       G_DEBUG=gc-friendly                                     \
+       GSETTINGS_BACKEND=memory                                \
+       GTK_IM_METHOD=none                                      \
+       PYTHONDONTWRITEBYTECODE=yes                             \
+       MALLOC_CHECK_=2                                         \
        MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
 
 LOG_COMPILER = $(top_srcdir)/build/autotools/tap-test
@@ -164,10 +164,10 @@ test_ide_uri_LDADD = $(tests_libs)
 
 #TESTS += test-c-parse-helper
 #test_c_parse_helper_SOURCES = test-c-parse-helper.c
-#test_c_parse_helper_CFLAGS =                                                                                
                                            \
-#      $(tests_cflags)                                                                                       
                                                  \
-#      -include $(top_srcdir)/libide/c/c-parse-helper.c                                                      
                                                  \
-#      -include $(top_srcdir)/libide/c/c-parse-helper.h                                                      
                                                  \
+#test_c_parse_helper_CFLAGS =                                   \
+#      $(tests_cflags)                                                \
+#      -include $(top_srcdir)/libide/c/c-parse-helper.c               \
+#      -include $(top_srcdir)/libide/c/c-parse-helper.h               \
 #      $(NULL)
 #test_c_parse_helper_LDADD = $(tests_libs)
 
@@ -223,12 +223,12 @@ misc_programs += test-egg-menu-manager
 test_egg_menu_manager_SOURCES = test-egg-menu-manager.c
 test_egg_menu_manager_CFLAGS = $(egg_cflags)
 test_egg_menu_manager_LDADD = $(egg_libs)
-EXTRA_DIST +=                                                                                                
                                            \
-       menus-exten-1.ui                                                                                      
                                           \
-       menus-exten-2.ui                                                                                      
                                           \
-       menus-exten-3.ui                                                                                      
                                           \
-       menus-exten-4.ui                                                                                      
                                           \
-       menus-exten-5.ui                                                                                      
                                           \
+EXTRA_DIST +=                                                   \
+       menus-exten-1.ui                                        \
+       menus-exten-2.ui                                        \
+       menus-exten-3.ui                                        \
+       menus-exten-4.ui                                        \
+       menus-exten-5.ui                                        \
        menus.ui
 
 
@@ -280,16 +280,16 @@ endif
 
 check_PROGRAMS = $(TESTS) $(misc_programs)
 
-EXTRA_DIST +=                                                                                                
                                            \
-       data/project1/.editorconfig                                                                           
                                           \
-       data/project1/.you-dont-git-me                                                                        
                                           \
-       data/project1/autogen.sh                                                                              
                                           \
-       data/project1/build-aux/m4/.keep                                                                      
                                           \
-       data/project1/configure.ac                                                                            
                                           \
-       data/project1/project1.c                                                                              
                                           \
-       data/project1/project1.doap                                                                           
                                           \
-       data/project1/tags                                                                                    
                                           \
-       data/project2/.you-dont-git-me                                                                        
                                           \
+EXTRA_DIST +=                                                   \
+       data/project1/.editorconfig                             \
+       data/project1/.you-dont-git-me                          \
+       data/project1/autogen.sh                                \
+       data/project1/build-aux/m4/.keep                        \
+       data/project1/configure.ac                              \
+       data/project1/project1.c                                \
+       data/project1/project1.doap                             \
+       data/project1/tags                                      \
+       data/project2/.you-dont-git-me                          \
        $(NULL)
 
 run-%: %


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]