Closed ChaselChiu closed 2 months ago
Those two executables in the scripts folder are automatically created by pip for the console scripts entry points (https://setuptools.pypa.io/en/latest/userguide/entry_point.html#console-scripts) listed in https://github.com/nightlark/swig-pypi/blob/bbcf58eff/pyproject.toml#L46-L48 and essentially just call the underlying Python module/function name listed in the entry point. The swig4.0 entry point was added to address an issue with CMake searching for a program named swig4.0 (https://github.com/nightlark/swig-pypi/pull/120).
What you described is correct, calling the swig.exe in the scripts folder (after ensuring it is in the env path by e.g. activating the virtual environment) then calls the swig function in the swig Python module (https://github.com/nightlark/swig-pypi/blob/main/src/swig/__init__.py), which is a simple Python script that calls the actual swig.exe file (with SWIG_LIB being set using the env argument).
Side note regarding virtual environments: I've often started to recommend using pipx
(https://github.com/pypa/pipx#on-windows) for installing Python apps, since pipx takes care of creating a fresh virtual environment for each installed app and the entry point scripts it creates automatically activate the virtual environment -- one less thing to remember to do. :smile:
Thanks for clarification and suggestion!
closing this topic.
Hello,
This is just Q & A, sorry that I might have overlooked some document somewhere, but I have been searching for a while. I noticed that after "pip install swig", there will be several swig.exe there (I'm using virtual python env): \python39\scripts\swig.exe \python39\scripts\swig4.0.exe \python39\site-packages\swig\data\bin\swig.exe <= (this is the same one from swigwin4.2.1.zip)
Could you share what's the purpose of those 2 more different swig.exe in scripts folder? It seems like we are supposedly to call swig.exe from scripts folder (by default only scripts folder in the env path) and somehow it will call to bin folder swig.exe to work with SWIG_LIB, but I'm not sure how to achieve this so would like to understand it for education of myself.
Thanks!