macos symlink shenanigans

This commit is contained in:
Kevin Turcios 2025-09-27 23:21:15 -07:00
parent 84b4054b8f
commit c9cfaacaaa
4 changed files with 11 additions and 11 deletions

View file

@ -173,14 +173,14 @@ def get_qualified_name(module_name: str, full_qualified_name: str) -> str:
def module_name_from_file_path(file_path: Path, project_root_path: Path, *, traverse_up: bool = False) -> str:
try:
relative_path = file_path.relative_to(project_root_path)
relative_path = file_path.resolve().relative_to(project_root_path.resolve())
return relative_path.with_suffix("").as_posix().replace("/", ".")
except ValueError:
if traverse_up:
parent = file_path.parent
while parent not in (project_root_path, parent.parent):
try:
relative_path = file_path.relative_to(parent)
relative_path = file_path.resolve().relative_to(parent.resolve())
return relative_path.with_suffix("").as_posix().replace("/", ".")
except ValueError:
parent = parent.parent

View file

@ -334,7 +334,7 @@ def extract_code_markdown_context_from_files(
helpers_of_fto.get(file_path, set()) | helpers_of_helpers.get(file_path, set())
),
)
code_string_context = CodeString(code=code_context, file_path=file_path.relative_to(project_root_path))
code_string_context = CodeString(code=code_context, file_path=file_path.resolve().relative_to(project_root_path.resolve()))
code_context_markdown.code_strings.append(code_string_context)
# Extract code from file paths containing helpers of helpers
for file_path, helper_function_sources in helpers_of_helpers_no_overlap.items():
@ -365,7 +365,7 @@ def extract_code_markdown_context_from_files(
project_root=project_root_path,
helper_functions=list(helpers_of_helpers_no_overlap.get(file_path, set())),
)
code_string_context = CodeString(code=code_context, file_path=file_path.relative_to(project_root_path))
code_string_context = CodeString(code=code_context, file_path=file_path.resolve().relative_to(project_root_path.resolve()))
code_context_markdown.code_strings.append(code_string_context)
return code_context_markdown

View file

@ -85,7 +85,7 @@ def existing_tests_source_for(
):
print_optimized_runtime = format_time(optimized_tests_to_runtimes[filename][qualified_name])
print_original_runtime = format_time(original_tests_to_runtimes[filename][qualified_name])
print_filename = filename.relative_to(tests_root).as_posix()
print_filename = filename.resolve().relative_to(tests_root.resolve()).as_posix()
greater = (
optimized_tests_to_runtimes[filename][qualified_name]
> original_tests_to_runtimes[filename][qualified_name]
@ -192,9 +192,9 @@ def check_create_pr(
if pr_number is not None:
logger.info(f"Suggesting changes to PR #{pr_number} ...")
owner, repo = get_repo_owner_and_name(git_repo)
relative_path = explanation.file_path.relative_to(root_dir).as_posix()
relative_path = explanation.file_path.resolve().relative_to(root_dir.resolve()).as_posix()
build_file_changes = {
Path(p).relative_to(root_dir).as_posix(): FileDiffContent(
Path(p).resolve().relative_to(root_dir.resolve()).as_posix(): FileDiffContent(
oldContent=original_code[p], newContent=new_code[p]
)
for p in original_code
@ -243,10 +243,10 @@ def check_create_pr(
if not check_and_push_branch(git_repo, git_remote, wait_for_push=True):
logger.warning("⏭️ Branch is not pushed, skipping PR creation...")
return
relative_path = explanation.file_path.relative_to(root_dir).as_posix()
relative_path = explanation.file_path.resolve().relative_to(root_dir.resolve()).as_posix()
base_branch = get_current_branch()
build_file_changes = {
Path(p).relative_to(root_dir).as_posix(): FileDiffContent(
Path(p).resolve().relative_to(root_dir.resolve()).as_posix(): FileDiffContent(
oldContent=original_code[p], newContent=new_code[p]
)
for p in original_code

View file

@ -1820,7 +1820,7 @@ def get_system_details():
hashing_context = code_ctx.hashing_code_context
# The expected contexts
expected_read_write_context = f"""
```python:{main_file_path.relative_to(opt.args.project_root)}
```python:{main_file_path.resolve().relative_to(opt.args.project_root.resolve())}
import utility_module
class Calculator:
@ -2089,7 +2089,7 @@ def select_precision(precision, fallback_precision):
else:
return DEFAULT_PRECISION
```
```python:{main_file_path.relative_to(opt.args.project_root)}
```python:{main_file_path.resolve().relative_to(opt.args.project_root.resolve())}
import utility_module
class Calculator: