Customizing Movable PythonChanging Your Distribution![]() Introduction![]() There are lots of ways you can customize your Movable Python distribution. You might want to do any of the following things :
Item 5 is done through the GUI or the Quick Launch part of the Advanced Window. Items 3 and 4 can be done through editing the Special Files. This page discusses how you can do items 1 and 2. Caution! As you customize your distribution, don't change the executable names. Movable Python relies on the executable being called movpy.exe or movpyw.exe. Adding Extension ModulesIt is likely that you will want to add extension modules to your Movable Python distribution. These should be added to the lib [1] folder, which acts as the equivalent of the site-packages folder in your normal distribution. If the modules you want to add are pure Python modules, you can just copy them straight into this folder. If the module is a compiled extension module (.pyd or .dll) then it must be compiled for the version of Python your Movable Python distribution uses. The easiest way of doing this is to copy the files from a normal Python installation. If this isn't possible (you don't have that version of Python installed), then contact me. So long as the extension is freely available for that version of Python I can probably help. Note Some Python extension modules are distributed as .exe files. These use a zip compatible form, which means you can use a program like winrar to extract the files from the exectuable. You might still need to add a path to syspaths.pth. For example you might want to change the version of wxPython from the unicode version that comes with your distribution to the ANSI version. pth FilesSome extension modules create .pth files in site-packages when they are installed. This adds paths to sys.path, which Python uses to find modules. You can add the contents of these files to the syspaths.pth [2] Special File. If you don't do this then code will fail to find modules when it needs them. Reducing Distribution SizeA lot of space is taken up by the extension modules provided with Movable python. If you want to reduce the space taken up by the distribution, a lot of these files can be safely deleted. In the Distribution Contents section it tells you what packages are included, and gives you some information about dependencies. For example, ctypes and readline are used by IPython. Crypto is used by SPE for its debug mode. enchant is used for spell checking by Firedrop2. By far the biggest extension is wxPython. The wx-2.6-msw-unicode directory is almost seventeen megabytes. If you don't want wxPython, then you can also remove _spe, wax, and firedrop2; none of these will work without wxPython anyway. This will save about twenty one megabytes in total. enchant is nearly seven megabytes, and is used by the Spell Checker plugin for firedrop2. Caution! tcl is used by the GUI, which is written with Tkinter. If you delete this, the GUI will fail to run. Other than tcl, none of the sub-directories of the lib directory are required to run Movable Python. A minimal distribution can be creatd by removing SPE, wxPython and all the extension modules. If you remove all the docs as well, the final size (uncompressed) is about 16 megabytes. You can further reduce that by using UPX to compress the dlls and pyds. win32 ExtensionsThe win32 extensions take up around 4.75 megabytes. If you don't use them it's fine to delete them, although they're popular extensions and lots of other software does use them. pywintypes24.dll and pythoncom24.dll are both part of the win32 extensions and can be deleted if you aren't going to use them. The following directories are all part of the win32 extensions :
Note The win32api extension is needed under Windows 98. Other FilesIf your distribution will never run on a windows 98 computer, or never uses unicode, you can get rid of unicows.dll. On some computers you might not need the two other Microsoft dlls [3] - but a clean install of XP will need them, they're not part of the OS. The copy of docs_html in the movpy folder is the one launched by the About button on the GUI. If you delete this folder, the online version should be launched instead. UPX CompressionAnother way of reducing distribution size is to use UPX to compress dlls, pyds, and executables. It's not something I've tried - but lots of people recommend it. Return to Top |
|
|