Skip to content
Snippets Groups Projects
trailing_space_clean_config.py 1.05 KiB
Newer Older
  • Learn to ignore specific revisions
  • 
    import os
    PATHS = (
    
        "build_files/build_environment/cmake",
        "build_files/cmake",
    
        "doc/python_api",
    
        "intern/cycles",
    
        "intern/ghost",
    
        "intern/guardedalloc",
    
        "intern/memutil",
    
        "release/scripts/modules",
    
    SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.normpath(
        os.path.join(os.path.dirname(__file__), "..", "..", ".."))))
    
    
    PATHS = tuple(
        os.path.join(SOURCE_DIR, p.replace("/", os.sep))
        for p in PATHS
    )
    
    def files(path, test_fn):
        for dirpath, dirnames, filenames in os.walk(path):
            # skip '.git'
            dirnames[:] = [d for d in dirnames if not d.startswith(".")]
            for filename in filenames:
                if test_fn(filename):
                    filepath = os.path.join(dirpath, filename)
                    yield filepath
    
    
    PATHS = PATHS + tuple(
        files(
            os.path.join(SOURCE_DIR),
            lambda filename: filename in {"CMakeLists.txt"} or filename.endswith((".cmake"))
        )
    )