Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use deprecated find_executable #1000

Merged
merged 4 commits into from
Oct 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pytensor/configdefaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import os
import platform
import re
import shutil
import socket
import sys
import textwrap
from pathlib import Path

import numpy as np
from setuptools._distutils.spawn import find_executable

import pytensor
from pytensor.configparser import (
Expand Down Expand Up @@ -349,7 +349,7 @@ def add_compile_configvars():

# Try to find the full compiler path from the name
if param != "":
newp = find_executable(param)
newp = shutil.which(param)
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be slightly different between windows v linux v unix.

Also does shutil reference any aliases? Is that necessary?

Copy link
Contributor

Choose a reason for hiding this comment

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

(not blocking just curious)

Copy link
Member Author

Choose a reason for hiding this comment

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

No idea tbh, I only followed the deprecation recommendation

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll have to check how it handles aliases, but shutil.which is supposed to handle symlinks besides regular files, and it should also be able to work with executable extensions. The difference between path handling between windows and unix systems doesn't look to be too bad.

if newp is not None:
param = newp
del newp
Expand Down
Loading