Skip to content

Conversation

@gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Jul 20, 2023

This restores a corner case: when the generator is run with working directory set to Tools/cases_generator, the source filenames listed in the generated provenance header should be relative to the repo root directory.

def from_source_files(self) -> str:
paths = f"\n{self.out.comment} ".join(
prettify_filename(filename)
prettify_filename(os.path.relpath(filename, ROOT))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests fail again with ValueError: path is on mount 'C:', start on mount 'D:' because of tempdir location.

I think we can solve this by using something like:

try:
    filename = os.path.relpath(filename, ROOT))
except ValueError:
    # This can happen if `filename` and `ROOT` are on different disks on Win:
    pass

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will do.

@gvanrossum gvanrossum merged commit 1218910 into python:main Jul 20, 2023
@gvanrossum gvanrossum deleted the add-relpath branch July 20, 2023 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants