-
Notifications
You must be signed in to change notification settings - Fork 145
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
avrdude Python binding configuration improvement #1914
Comments
For cases where you do not want to build the swig/python/avrdude-gui things at all, my quick hack workaround is to run
before running |
I would love to see a clean solution for installing a software package into a custom PREFIX but some things needing to be installed into a well-known directory which is not inside PREFIX. In this case, this is about python sitedir, but the same thing acould also be bash completions dir, xdg icons dir, man page dir, etc. Some of these directories could be accommodated by setting environment variables like PYTHONPATH, MANPATH, etc., but that becomes cumbersome very quick and is not even possible for some things. Some things can be delegated to the person installing the package to do manually (or a OS package doing, like e.g. installing udev rules), but manually installing all the python files into the respective directories certainly is too much to ask. Anyway... looking for a nice way to handle such things. Please tell me if you know one. |
I think it is easier to use CMake command line option to disable the Python binding. Let me try and give an option later. As for installation of Python bindings, I think it is a tough topic especially under Windows (eg: MSVC), based on my experiences with libftdi project. So we would say to use manual instalation for Windows and try to automatic installation for other OS. Reference libftdi: FYI, I am kind of the Windows packager for libftdi binaries for Windows for a long time (2010 to 2020). Now MSYS2 mingw makes it simpler so it is not really needed any more. |
I was hoping |
@leventelist and @ndim I think there is kind of a bug here that the Python binding has kind of hard-coded path which does not honor CMAKE option:
|
The well known well-known directory problem. |
Interestingly, the |
Oh, and as the whole installation and the startup which finds the installed files etc is a bit unusual, we might be able to do something about working with a non-well-known install dir. Some changes to the cmake code will be required. |
@ndim The patch I included? |
@leventelist I was thinking more along the lines of installing to Then we just need to install a correctly adapted |
BTW, mostly Windows users using MSVC has to manually install the Python extension. I tend to believe it is the same for macOS Homebrew users. Homebrew avrdude formula does not enable Swig/Python at all. In fact, it is even missing libserialport support. |
Swig and Python detection may also need to be improved. The following is from my Mac Mini M1 running the latest macOS 15.0 and Homebrew. It detects the wrong default Python installation. My
|
I may have found a fix for that already. I need to look it up tomorrow. |
Yeah. Detecting python on a mac is another level. We ended up using pyenv at work.
|
@mcuee This did the trick for my "finding the wrong python" issues on Fedora 40: 2e7a620 (part of my improve-autotools-build-3 branch which is not a PR yet). # Find SWIG
find_package(SWIG 4.0 COMPONENTS python)
if(SWIG_FOUND)
+ # https://discourse.cmake.org/t/find-package-python3-is-not-finding-the-correct-python/10563/8
+ set(Python3_FIND_STRATEGY LOCATION)
+ set(Python3_FIND_UNVERSIONED_NAMES FIRST)
find_package(Python3 COMPONENTS Interpreter Development)
if(PYTHON3_FOUND)
set(HAVE_SWIG 1) It might help with your issues as well. If it does, it should be considered for general use. |
Unfortunately it does not work.
|
BTW, the Python detection problem under macOS also affect Homebrew formula if you want to build git main. The issue is a bit strange though.
|
@ndim
|
I think your change is useful for Python Virtual Environment. git main does not work but your branch works fine.
git main will fail.
|
I have a script that builds AVR toolchain, including avrdude. The sctipt installs the artifacts to a directory in my user's home. I've noticed that when I want to install v8.0, it directly targets /usr/local for installing some python module. Is there any workaround not doing it? I run my script as a normal user, and it keeps failing, as it is not writable by a non superuser.
I came up with this patch.
And call cmake with something like this: "-DPYTHON_SITE_PACKAGES=python"
The text was updated successfully, but these errors were encountered: