NAPYR - Not A Python Runtime
NAPYR is an acronym for "Not a Python runtime". Well, it isn't, but it comes close.
So, what is it?
If you are a end-user: it is a setup of common python DLLs to a
special folder on your system, which defaults to %Program
Files%\NAPYR
. You need to have NAPYR installed to use a
NAPYR-enabled application.
If you are a developer: it is a setup of common python DLLs, so you don't need to package them in your installer.
What does it include?
It includes the python runtime DLL, the win32all runtime DLLs and wxPython runtime DLLs. It comes with a nice installer, and an uninstaller, courtesy of the fine NSIS.
Restrictions
NAPYR currently runs only on Windows NT/Windows 2000/Windows XP. It does NOT run on Windows 95/Windows 98/Windows ME.
Download and Installation
You can download the single-file installer here. You can also download the source separately, here.
Licenses
This setup contains parts covered by different licenses. Man, do I hate that lawyer stuff! Anyway, here we go:
- Python is copyrighted by the Python License.
- The Win32all Extensions are copyrighted by Marc Hammond.
- wxWindows is copyrighted by wxwindows.org, and, to everyones surprise, wxPython is copyrighted by wxpython.org.
- py2exe is copyrighted by Thomas Heller.
- My own code - which accounts for not much in this package - is freeware. Enjoy!
Usage for end-users
Nothing, really. All you have to do is install NAPYR, if you want to use a NAPYR-enabled application.
Usage for developers
NAPYR uses a patched version of py2exe to do its magic. Its not very impressing magic, granted, but it works. The McMillan Installer is currently not supported. OK, how does it work?
- You must have py2exe installed, version 0.4.1. (Otherwise, you might have to finetune the patch described below).
- Download and extract the NAPYR source.
- Copy
py2exe-patch/support.py
to your\python22\Lib\site-packages\py2exe\support.py
. See a description of the patch below - Recompile with the updated py2exe distutils. You can now safely remove the files from your setup that are already part of NAPYR.
The py2exe-patch
The patch is simple, really. If the .pyd cannot be found in the
local directory, the environment variable NAPYR_PATH
is
looked up. It must point to a directory where the .pyd can be found.
I told you it was simple, didn't I? But you want the details, so here we go: the original code
has this line:
# Should catch IOError and convert into ImportError ??
fp = open(pathname, desc[1])
which will be replaced by this block:
fp = None
try:
fp = open(pathname, desc[1])
except IOError:
import nt
pathname = "%s\\%s" % (nt.environ["NAPYR_PATH"], oldpathname)
fp = open(pathname, desc[1])
dict['__file__'] = pathname
return 0, imp.load_module(fqname, fp, pathname, desc), dict
Why Windows NT/2K/XP only?
Because I don't want to modify the path on Windows 9x - that
involves patching the autoexec.bat
, which I don't have
enough willpower to do.