microchip-pic-avr-tools / pymcuprog

a Python utility for programming various Microchip MCU devices using Microchip CMSIS-DAP based debuggers
MIT License
96 stars 22 forks source link

Add build script for pymcuprog executable #18

Closed kristofmulier closed 2 years ago

kristofmulier commented 2 years ago

1. Why a build script?

Not all computers have Python installed (especially Windows). Even if Python is available, people often don't like to install extra modules in their default installation. Virtual environments are of course a solution, but that requires skills and setup efforts. In short: a simple executable is a good idea to make your tool more easily available.

 

2. Result of the build

I've written a build script that invokes CX_Freeze to create an executable file. On Windows, the build output looks like this:

On Linux it looks very similar. I don't have a MAC, so I can't test it there. I only had the opportunity to test it on Windows 10, Windows 11, Ubuntu and Debian.

 

3. How to invoke the build script

My build script is very easy to invoke. Just make sure you have CX_Freeze installed. Then navigate to the toplevel pymcuprog folder and run the build script like so:

$ python3 pymcuprog_build.py

To clean the output, just run:

$ python3 pymcuprog_build.py --clean

 

4. Notes

Please note I added a file named pymcuprog_execute.py. It just serves as the target for CX_Freeze. The file simply imports the pymcuprog module and runs its main() function.