File: compile_pathlib.py

package info (click to toggle)
doit 0.36.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,704 kB
  • sloc: python: 11,863; makefile: 33; ansic: 14; javascript: 3; sh: 1
file content (14 lines) | stat: -rw-r--r-- 498 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from pathlib import Path

def task_compile():
    working_directory = Path('.')
    # Path.glob returns an iterator so turn it into a list
    headers = list(working_directory.glob('*.h'))
    for source_file in working_directory.glob('*.c'):
        object_file = source_file.with_suffix('.o')
        yield {
            'name': object_file.name,
            'actions': [['cc', '-c', source_file]],
            'file_dep': [source_file] + headers,
            'targets': [object_file],
        }