Command Line Build of DIA Projects
From Digi Developer
We highly recommend building DIA projects in Digi ESP (our Eclipse-based development environment), but there are times where that is not optimal:
- When you have a DIA driver that does not have the supporting files to integrate into ESP
- When you would like to automate the process in a script
- You just don't roll that way ;)
Doing a build at the command line is simple and efficient, and very flexible.
You will need Python 2.4.3 installed on your system to do the make process.
Windows or Mac
The easiest and most reliable way to get the correct Python environment on your build PC is to install ESP. It will install a compatible version of Python 2.4 and Python 2.6.
ESP can be downloaded from the Resources page on www.etherios.com/devicecloud. Login to your account, click on resources in the top right corner. You will see instructions as well as the ESP download there.
TIP: At least in the Windows installer, you will have the option to not install ESP, just the python binaries. If you are short on space, this is a good idea. I do recommend doing the full installation, if nothing else to get the DIA documentation (part of the Help system in ESP). Who knows, you might also find ESP a good way to do your projects.
Linux or Unix
This is a bit trickier, as most distributions no longer have Python 2.4 in their repositories. Use your favorite search engine and search for instructions ("Ubuntu python 2.4" for example). I was able to easily find instructions for Ubuntu, and there are several resources on the web as this is a common request.
How to get the build tree
The easiest way is to create a new "DIA Project" in ESP. In the first window, give your project a name, uncheck default location, enter a path that is easy for your to access, and check the "include DIA source code in project" checkbox.
Doing the Build
Now, the easy part!
From the root directory of the tree (you will see subdirectories such as src\, lib\, doc\, etc.) type:
C:\Python24\python.exe .\make.py cfg\MyCoolProject.yml
For X2e builds, use c:\Python27 instead.
The path to python.exe may need to modified to match your PC, but this is normally the correct path for Windows.
TIP: Though it is normal convention to name the file "dia.yml" it is not necessary when building this way. You can have a whole bunch of .yml files for different projects, point to them during the build process, and it will work just fine. The yml (no matter what the source yml filename is) is serialized and named "dia.pyr" in dia.zip during the make process (see the 6th line of output when running the make).
You will hopefully see something like this:
Project make started. Analyzing files... Compiling files... Zipping files... Finished writing archive 'bin\dia.zip' Transforming settings file 'cfg\MyCoolProject.yml' to 'pyr' format... Adding transformed settings as 'dia.pyr' to 'bin\dia.zip'... Project make completed successfully.
Your dia.zip (the built project) will be in the bin\ directory. Transfer that to the /WEB/python/ directory on your ConnectPort/ConnectCore gateway.
If you have not already done an ESP build from this version of DIA on your gateway, you will also need to copy dia.py (resides in the root directory of the build tree) to the same directory.