tannewt / embedded

Python toolkit for building (aka compiling and linking) embedded projects
MIT License
4 stars 1 forks source link

Does embedded require python 3.12 ? ( pathlib walk_up ) #2

Open d-c-d opened 5 months ago

d-c-d commented 5 months ago

When running python 3.11

running python build.py I get

... 
  File "/home/dcd/git/StemmaG0-Template/venv/lib/python3.11/site-packages/embedded/compiler.py", line 37, in compile
    await build.run_command([self.c_compiler, *cpu_flags, "-MMD", "-c", source_file, *flags, "-o", output_file], description=f"Compile {source_file.relative_to(cwd)} -> {output_file.relative_to(cwd)}", working_directory=caller_directory)
  File "/home/dcd/git/StemmaG0-Template/venv/lib/python3.11/site-packages/embedded/build/__init__.py", line 47, in run_command
    part = part.relative_to(working_directory, walk_up=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@capture_caller_directory
async def run_command(command, description=None, caller_directory=None, working_directory=None):
    if working_directory is None:
        working_directory = caller_directory
    if isinstance(command, list):
        for i, part in enumerate(command):
            if isinstance(part, pathlib.Path):
                part = part.relative_to(working_directory, walk_up=True)
            # if isinstance(part, list):

            command[i] = str(part)
        command = " ".join(command)

Note: the error does not happen when compiling and running with

 python --version
Python 3.12.3
tannewt commented 5 months ago

Yes, I'm targeting 3.12. I think asyncio.TaskGroup() is also 3.12+.