jelockwood / pinpoint

A script for finding your Mac
GNU General Public License v3.0
28 stars 5 forks source link

Python2 removal in macOS 12.3 #12

Closed kevinmcox closed 2 years ago

kevinmcox commented 2 years ago

Apple is removing python2 in macOS 12.3 next month. Pinpoint will need an update to read preferences in a different way if the goal is to continue to allow them to be set via configuration profile or defaults write:

https://github.com/jelockwood/pinpoint/blob/master/pinpoint.sh#L139

EDIT: Found a few other uses of python as well:

https://github.com/jelockwood/pinpoint/blob/master/pinpoint.sh#L201 https://github.com/jelockwood/pinpoint/blob/master/pinpoint.sh#L326 https://github.com/jelockwood/pinpoint/blob/master/pinpoint.sh#L327


MunkiReport 5.7.0 now requires MunkiReport-Python2 and changing Line 139 to use /usr/local/munkireport/munkireport-python2 does work.

However while this might be a solution for MunkiReport users, it'll only be temporary as MR version 6 will switch to Python 3 later this year.

jelockwood commented 2 years ago

@kevinmcox Thanks for pointing these out.

I think the uses on lines 201, 326 and 327 should be easy enough to convert to standard shell script alternatives but line 139 might be more of a problem.

I am however these days far too busy with work to look at this. If you are able to solve line 139 I could look at the others for you.

As a first guess at a possible solution, if one could detect the Python that MunkiReport will bundle and use, then the pinpoint script could be modified to look for that and utilise it. (As your added comment suggests.)

However this would at best make it then only work with MunkiReport whereas currently it can be used by itself e.g. for just Jamf Pro.

I personally regard Apple as having made a really bad move at failing to include Python3 as standard - clearly removing the obsolete Python2 is justified.

Feel free to submit a proposed change.

kevinmcox commented 2 years ago

I think I've already got 201, 326 and 327 figured out. I'll see what I can do for 139 and submit a PR when I have it all together.

kevinmcox commented 2 years ago

I think I've got this taken care of with PR #13 .

jelockwood commented 2 years ago

@kevinmcox Thanks, 201, 326 and 327 were the obvious changes so I have no problem with them.

I do have a question about 139. I see you are using osascript to run javascript. My query here is that newer macOS versions can cause requests for the user/admin to approve a script controlling a process. As an example I had major problems with a shell script using osascript to run an AppleScript which then controlled the Finder.

Have you verified whether your use triggers this? (Hopefully not.)

kevinmcox commented 2 years ago

It doesn't trigger any prompts in my testing including in 12.3 Beta 5.

https://scriptingosx.com/2021/11/the-unexpected-return-of-javascript-for-automation/

jelockwood commented 2 years ago

Thanks, I am merging your commits and then I will create a new installer package to match in releases.

kevinmcox commented 2 years ago

Sounds good.

jelockwood commented 2 years ago

@kevinmcox I have now added the new release and a matching installer package. I have not tried the installer myself yet as I don't have a suitable test Mac at home let me know if there is a problem.