Deployment

From IronPython Cookbook

Revision as of 13:46, 19 June 2007 by Dodiggitydag (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)

This article aims to provide complete information about how to deploy IronPython scripts to client computers.

Contents

Requirements

Both the IronPython interpreter and runtime are made of Microsoft Intermediate Language (MSIL), meaning that it is bytecode like all .NET programs. Therefore it requires the IronPython binaries and either the .NET Framework 2.0 (Windows) or Mono (*nix). All files from the IronPython distribution are not required to run IronPython scripts on Windows. Therefore the following must be true about the machine.

  • Windows
    • .NET 2.0 or 3.0 installed
    • IronPython binaries exist in the same folder anywhere within the file system
      • ipy.exe
      • IronPython.dll
      • IronMath.dll
  • *nix (Linux, Unix, Macintosh)
    • Mono installed
    • FePy Binaries

Python Libary

The standard CPython library may be installed on the target machines if the libary is used. A clear give-away is when the following code exists in any of the python files:

# If this code appears in an IronPython file, the file
# requires the standard CPython library to be installed.
sys.path.append("C:\\Python24\\Lib")

Please refer to Using the Python Standard Library for more information on when and how the standard Python library is used.

.NET 3.0

The .NET 3.0 framework is required on the target computer whenever any of the enclosed classes are used. If the author uses the words Windows Communication Foundation (WF), Windows Workflow Foundation (WWF), Windows CardSpace (WCS), Windows Presentation Foundation (WPF), or XAML then the file is likely to require the .NET Framework 3.0.

Some examples of statements which require .NET 3.0:

# If any of the following statements exist within an IronPython file,
# it requires the .NET 3.0 framework to be installed.
clr.AddReference("PresentationCore")	# WPF
# To be appended:	# references for WCF, WCF, WWF

File Associations

File associations can be created so that whenever a .py script is double-clicked, it will call the IronPython interpreter. You should think twice about modifying any file associations if the standard CPython library has been installed as you may break some standard Python programs.

You can set up file associations in Windows XP by following these instructions:

  1. Double-click "My Computer" on the desktop.
  2. Click on the "Tools" menu.
  3. Choose "Folder Options"
  4. Click the "File Types" tab, it may take a few moments to load.
  5. Scroll down to the "PY" extension, if it does not exist then you can add it to the list by hitting the "New" button.
  6. If an association already exists then click the "Change" button to change it.
  7. In either case point to the "ipy.exe" IronPython interpreter.
TOOLBOX
LANGUAGES