Linux 2000 Logo Top Right Graphic
PythonCard standaloneBuilder tool
For when you love being in control
Latest News

October 24th 2007 - standaloneBuilder-0.3.1-4.tar.gz This release fixes some minor cosmetic issues in the UI and addresses some more bugs. Projects created on Windows were not being opened correctly under Linux. Fixed an obscure bug which caused the code to throw an exception when trying to change the project base directory on a project that had already been built more than once. Made the Inno compiler step optional under Windows - projects can be rebuilt without being forced to always call the Inno compiler, as running this can take some time.

Known issues in this release:

  1. The MacOS platform is not currently supported. As I don't own a Mac, this will have to be addressed by someone else!
  2. The build mechanism is still relatively simple-minded - a number of the more advanced features of pyInstaller and py2exe are not fully supported. In particular, it is unlikely that single file builds will ever be properly implemented.
  3. The program does not work too well when trying to use external programs other than the regular PythonCard tools, i.e. code editor and resource editor.
  4. There is a bizarre cosmetic bug (at least on Mandriva 2007.0, maybe on other Linux distros) where the list components stay greyed-out after opening a project file, even though they have been enabled in the code. This doesn't seem to have any adverse effect other than looking a bit wierd...

Plans for the next release include extending the build process to allow binaries to be produced for Linux platforms. Watch this space... :-)

May 10th 2006 - standaloneBuilder-0.2.0-1.tar.gz This will be the last v0.2.x snapshot release. Barring any further major bugs being found, this version will be incorporated into PythonCard 0.8.2, due to be released shortly.

May 8th 2006 - standaloneBuilder-0.1.4-4.tar.gz The component import checking has been enhanced so that the required import line can be placed on the Windows clipboard for pasting into the main script. Numerous bug fixes. The menu bar items now reflect the contents of the rest of the user interface. Some improvements to the error checking in the preferences dialog. Please see the changelog.txt file included in the tarball for a full list of changes.

May 2nd 2006 - standaloneBuilder-0.1.3-3.tar.gz This release adds improved error checking to the program - it can now tell if any of the external packages have changed/vanished since the last time the program was run. I have also added the ability to have the program scan all of the resource files for a project and auto-generate a 'from PythonCard.components import...' line which can be pasted into the main script so that the executable runs correctly. This function is accessed on the menu by clicking Tools --> Check component imports. The program will now correctly handle the scenario where the final executable has a different name to the main script file. Some cosmetic changes have been made to the preferences dialog.

April 11 2006 - standaloneBuilder-0.1.2-18.tar.gz The build mechanism has now been extended to include support for pyInstaller, the replacement for the old McMillan Installer. Whether to use this or py2exe can be set in the program preferences.

April 3 2006 - standaloneBuilder-0.1.1-16.tar.gz This release adds support for building executables using py2exe and also fixes several bugs which manifested themselves when running the program under windows.

Introduction

The process of converting a PythonCard project into a stand-alone application, complete with installer and un-install entry, is fairly tedious to do 'by hand'. Whilst writing some documentation (see here) to cover this, it became clear that there was a need for some application software (written using PythonCard, naturally!) to help automate the process. The standaloneBuilder tool is the result. The program offers the user the ability to manage the development and release of successive versions of an application project written using PythonCard.

Comments on this document and/or bug reports related to the standaloneBuilder tool may be posted to the PythonCard users mailing list, http://lists.sourceforge.net/lists/listinfo/pythoncard-users, for discussion.

Pre-Requisites

As well as Python, wxPython and PythonCard, you will need to have installed and configured pyInstaller and/or py2exe together with Inno Setup on your computer. These packages can be downloaded from the following locations as of the time of writing:

All packages come with comprehensive documentation - installation and setup should be painless.

The screenshots below show standaloneBuilder version 0.3.0 running under WindowsXP.

Configuring standaloneBuilder

When launching standaloneBuilder for the first time, it detects that the preferences need to be configured and drops you straight into the preferences dialog.

You can come back to this dialog at any time by clicking the preferences button on the main screen. All of the options have help buttons (marked with '?') associated with them, so you can (hopefully) figure out what each one is for without too much difficulty. The program will try to find as much information as it can, you should only need to tell it your name and where to find the directory you keep all your projects in.

After filling in any missing information, click the OK button to save your preferences for use In future projects.

Creating a new project

For the purposes of this document, we'll use the standaloneBuilder tool in conjunction with the application created in walkthrough #2, to illustrate the steps involved in the creation, development and distribution of a typical PythonCard program. We'll assume that you have already followed the walkthrough and you have the counter.py application fully functional.

To begin, click on the 'New' button to start the new project wizard and fill in the details as required:






After completing the new project wizard, the program will create the project and add in some default folders and template files. A 'save' dialog will then be presented to allow the project details to be written to disk. The main window will now appear as shown below:

Adding files to the project

The first step will be to define the main script file for the project. In this case, there is only one script, namely counter.py, so click the '...' button next to the main script file text field. Navigate to the sab-demo folder and select the 'counter.py' script. Click the Open button to add it to the project:


If standaloneBuilder finds a resource file with a name which matches the script you have just added, it will offer to add this for you as well:

Simply click the Yes button to have the resource file added into the project:

A note is probably in order at this point about the Script files box. Generally, pyInstaller is quite good at working out if there are any additional source files associated with the main script, simply by examining any import lines in the source code. This may appear to make the Script files box largely superfluous. If you intend to only ever build projects for Windows platforms, then you may well find that you never need to explicitly list any additional script files. If, however, you also want to distribute your project to Linux users, then things are slightly different. When running standaloneBuilder on Linux, the rebuild button simply builds a compressed tar file containing the items you have specified as making up your project. In this scenario, only those files that you have explicitly listed will be included in the tar file. Also, by including your script files explicitly, the usefulness of standaloneBuilder as a general purpose project manager comes into play. You can edit a given script file by simply selecting it in the list and clicking the Edit... button.

Having added the resource file, you can now open it in the resource editor simply by clicking on the Edit button on the main window. Files which are added in other sections of the main window can be edited in the same way. Script files will be opened using the program defined as the text editor in preferences. This defaults to the PythonCard code editor, but can be changed if required. Files listed under the Pixmaps section will be opened using whatever you specify as your default image editor in preferences,

Project properties

That pretty much covers the mechanics of adding and editing the files which make up your project. The project properties dialog provides a number of options which affect how the final standalone version of your program is built. To access this, click the Properties button on the main window:

The first few fields determine the folder layout within your project. All the paths used within standaloneBuilder are relative. For example, the default build directory is simply called 'build' - in practice, this folder would be created in whatever you specified as the base folder when the project was initially created, this would in turn be created as a sub folder of your top level 'projects' folder defined in the preferences. Thus, in this example:

  • Projects folder in preferences is P:\
  • The project was created in a folder called sab-demo
  • The build directory is called simply build

The full path to the build directory is therefore P:\sab-demo\build. Having all of the folder references relative to each other allows standaloneBuilder to maintain projects on both Windows and Linux platforms, with Python itself taking care of the differences in path separators.

The application publisher, application URL and application licence fields are used by Inno Setup when the final version of the program is built

The other options from Deployment type onwards correspond to the same options in the McMillan Installer. Note that new projects are always created with the Console option turned on - this is intended to aid with debugging. The build process generates a warning message to remind you to turn this off before making a release of your finished application.

Changelog & README buttons

Clicking the Changelog button launches the text editor defined in preferences and opens the project changelog file for further editing:

Additional entries can be made directly using this option. Alternatively, there is an 'add changelog entry' option on the 'tools' menu. This pops up a small text entry dialog like so:

The entry then gets added to the changelog. Entries are made so that the most recently added is at the top:

The README button does a similar thing, but instead uses the text editor to open a file called readme.txt in the project base folder

The Run Button

When clicked, the Run... button executes the main script of your project. It firstly pops up a small dialog wherein you can specify a number of useful command line options:

There must be a reason why this looks suspiciously like the run-time options dialog from the PythonCard resource editor, but I'm sure I couldn't even begin to guess what that reason might be... :-)

The Rebuild button

Clicking this button causes the standalone version of your application to be rebuilt. As sab-demo is a new project, it has been created with the console option switched on. The first thing standaloneBuilder does is to remind you about this:

The build then proceeds. If all is successful, the program will tell you where it has stored the installer for the project:

A scrolling text window is also displayed where you can see the output from the build process:

When the build has completed, the self extracting installer executable can be copied to another Windows machine ad run. The resulting setup wizard looks the same as virtually any other piece of 'professionally' produced software:

The executable itself looks and behaves exactly the same as any other program. This is the result of right-clicking the sab-demo.exe file and selecting 'Properties':

The Release button

When you are happy that you have thoroughly debugged your project and are ready to release it to the outside world, you should open the project in standaloneBuilder and click the Release button. Doing this puts the current release of the project into a frozen state, in which no further changes can be made until you have checked and confirmed that the release is okay.

The first thing that happens upon clicking the Release button is that a warning dialog pops up to give you the option of changing your mind:

Assuming that you click OK at this point, a number of things then happen to the project. Firstly, the status gets changed from Open to Frozen and the majority of the controls on the main window get disabled:

Secondly, the 'release date TBA' tag at the top of the project changelog gets replaced by the current date. At this point, only the Rebuild and buttons will work. You should carry out a final rebuild of your project under both Windows and Linux, if applicable. Under Linux, the Rebuild process simply produces a TAR archive of the files which make up your project, as opposed to a standalone binary executable.

When you are happy that everything has been rebuilt as you need it, you are ready to close off the current release and start the next version of your project. To do this, just click the Release button again. You will be presented with this dialog:

Click OK to confirm the release. You then have an opportunity to decide what the next version number of your project will be, with the option to override what the program offers as a deafult. In the example shown below I have decided that the next release of the sab-demo project should have a version number of 0.9.1:

The main window is then refreshed. The build number has been reset to 1 and a new changelog entry has been added to indicate the start of the release cycle for the new version number:


Right Side Graphic
Mandrake Linux
Made With Bluefish
Made With WML
W3C XHTML1.0
W3C CSS1 & CSS2

Linux user
#287730

 
Bottom Left Graphic  

I've done my best to ensure that the information given on this site is accurate. If you make any use of this information, however, you do so entirely at your own risk. If you lose your job, your house blows up or your dog dies, it's not my fault, okay? All trademarks and copyrights are owned by their respective companies. Linux is a trademark of Linus Torvalds. HTML coding done using Bluefish-0.7, together with wml-2.0.11 (19-Aug-2006) and graphics by The Gimp.
 
Copyright © 2004 Phil Edwards mailto: webmaster (at) linux2000.com
Last updated Wed Jun 30 14:07:14 2010