timsutton / brigadier

Fetch and install Boot Camp ESDs with ease.
MIT License
1.99k stars 198 forks source link

Python support 3.x #82

Open bandaid opened 1 year ago

bandaid commented 1 year ago

This is not so much of an issue, but mostly security. Since python 2.x has been phased out, has brigadier moved to support current versions of phython 3.x ?

In the Wiki:Readme:

you'll need Python for Windows (this was tested with the latest 2.7 release) in order to execute the script.

I'm looking to get the full functionality of the Magic Keyboard on a non-mac, non-apple, Microsoft Windows system. Additionally, read battery levels to determine why the Magic Keyboard is suddenly draining batteries in less than a day. Potentially a Microsoft update, though Bluetooth drivers have not changed nor anything else other than PowerToys.

https://www.bluetoothgoodies.com/info/apple-devices/ , also magicutilities but not in agreement with this particular developer.

mrded commented 1 year ago

In the meantime it's quite a challenge to get Python 2 running on a modern macOS. Even brew no longer supports it.

jaredstanko commented 1 year ago

First, I support the idea of migrating this to Python v3. But, I don't know how much extra time @timsutton has currently. There is an old PR for Python 3 support. I actually recommend pyenv for your primary Python. Apple is still shipping v3.9.6 from June 2021. Maybe the are backporting security fixes. But, I doubt it.

So while I suggest you make pyenv permanent, I will write these instructions so there is no permanent change to your system.

pyenv - Simple Python Version Management https://github.com/pyenv/pyenv

# Using Homebrew (assumes zsh)
#
# Install pyenv
brew install pyenv

# Temporarily point all python stuff to Pyenv
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

# Install the environment you want
pyenv install 2

# Make it the default for this shell session
pyenv shell 2

# View python version
python -V

# Go to the repo
cd brigadier/

# Make and activate a python virtual environment
python -m virtualenv venv
source venv/bin/activate

# Install the python requests modules 
python -m pip install requests

./brigadier

# Clean up
pyenv uninstall 2
brew uninstall pyenv
tomasi-o commented 10 months ago

@jaredstanko Thx a lot for the pyenv Install Guide! Just want to add that under MacOS 11.13 (High Sierra) with an iMac 12,2 (27", mid 2011) I got an error while trying to run this:

NameofComputer:brigadier username$ python -m virtualenv venv
/Users/username/.pyenv/versions/2.7.18/bin/python: No module named virtualenv

This was easy to solve, I just installed virtualenv via NameofComputer:brigadier username$ pip install virtualenv

After that I could run the brigadier script without any problems. Thank you so much @timsutton for writing this! Now I am a step further in reinstalling bootcamp :)