summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PC/setup_nt/readme.txt49
-rw-r--r--PC/setup_nt/setup.bat1
-rw-r--r--PC/setup_nt/setup.py254
3 files changed, 304 insertions, 0 deletions
diff --git a/PC/setup_nt/readme.txt b/PC/setup_nt/readme.txt
new file mode 100644
index 0000000..4b9bccc
--- /dev/null
+++ b/PC/setup_nt/readme.txt
@@ -0,0 +1,49 @@
+Python 1.4beta3 for Windows NT 3.5
+==================================
+
+The zip file pyth14b3.zip contains a preliminary binary release of
+Python 1.4beta3 for Windows NT 3.5, with Tcl/Tk support. The
+installation has not been tested on Windows '95 or Windows 3.1 with
+Win32s. For general information on Python, see http://www.python.org/.
+
+To install:
+
+Unzip the archive in the root of a file system with enough space. It
+will create a directory \Python1.4b3 containing subdirectories Bin and
+Lib and files setup.bat and setup.py. (If you don't have a zip
+program that supports long filenames, get the file winzip95.exe and
+install it -- this is WinZip 6.1 for 32-bit Windows systems.)
+
+Run the SETUP.BAT file found in directory just created. When it is
+done, press Enter.
+
+To use:
+
+Python runs in a console (DOS) window. From the File Manager, run the
+file python.exe found in the Bin subdirectory. You can also drag it
+to a program group of your choice for easier access. Opening any file
+ending in .py from the file manager should run it.
+
+To use with Tkinter:
+
+Get the file win41p1.exe from here or from ftp site ftp.sunlabs.com,
+directory /pub/tcl/. This is a self-extracting archive containing the
+Tcl/Tk distribution for Windows NT. Don't use an older version.
+
+Using the control panel, set the TCL_LIBRARY and TK_LIBRARY
+environment variables. E.g. if you installed Tcl/Tk in C:\TCL (the
+default suggested by the installer), set TCL_LIBRARY to
+"C:\TCL\lib\tcl7.5" and set TK_LIBRARY to "C:\TCL\lib\tk4.1".
+
+Once Tcl/Tk is installed, you should be able to type the following
+commands in Python:
+
+ >>> import Tkinter
+ >>> Tkinter._test()
+
+This creates a simple test dialog box (you may have to move the Python
+window a bit to see it). Click on OK to get the Python prompt back.
+
+August 30, 1996
+
+--Guido van Rossum (home page: http://www.python.org/~guido/)
diff --git a/PC/setup_nt/setup.bat b/PC/setup_nt/setup.bat
new file mode 100644
index 0000000..2c6effc
--- /dev/null
+++ b/PC/setup_nt/setup.bat
@@ -0,0 +1 @@
+bin\python.exe -i .\setup.py
diff --git a/PC/setup_nt/setup.py b/PC/setup_nt/setup.py
new file mode 100644
index 0000000..3f8b117
--- /dev/null
+++ b/PC/setup_nt/setup.py
@@ -0,0 +1,254 @@
+"""Setup script for Windows NT 3.5 until we have a proper installer.
+
+Run this with the current directory set to the Python ``root''.
+"""
+
+import sys
+import strop
+
+del sys.path[1:]
+
+try:
+ import nt
+except ImportError:
+ print "This script should only be run on a Windows (NT or '95) system."
+ sys.exit(1)
+
+try:
+ sys.winver
+ print "This Python version appears to be", sys.winver
+except NameError:
+ print "Huh? sys.winver is not defined!"
+ sys.exit(1)
+
+# Try to import a common module that *should* work.
+print "Looking for Python root directory..."
+while 1:
+ pwd = nt.getcwd()
+ ##print "Could it be", `pwd`, "?"
+ try:
+ open("Lib\\os.py").close()
+ ##print "It appears so."
+ break
+ except IOError:
+ ##print "Hm, it doesn't appear to be. Try the parent directory."
+ try:
+ opwd = pwd
+ nt.chdir("..")
+ pwd = nt.getcwd()
+ if opwd == pwd:
+ ##print "Seems like we're in the root already."
+ raise nt.error
+ except nt.error:
+ ##print "Can't chdir to the parent -- we're stuck."
+ pass
+ else:
+ ##print "Try again one level higher."
+ continue
+ print "Hey, would you like to help?"
+ print "Please enter the pathname of the Python root."
+ while 1:
+ try:
+ dirname = raw_input("Python root: ")
+ except EOFError:
+ print "OK, I give up."
+ sys.exit(1)
+ if not dirname:
+ continue
+ try:
+ nt.chdir(dirname)
+ except nt.error:
+ print "That directory doesn't seem to exist."
+ print "Please try again."
+ else:
+ break
+pwd = nt.getcwd()
+print "Python root directory is", pwd
+sys.path[1:] = [".\\Lib", ".\\Lib\win", ".\\Bin", ".\\vc40"]
+
+# Now we should be in a position to import win32api and win32con
+
+try:
+ import win32api
+except ImportError:
+ print "Blech. We *still* can't import win32api."
+ print "Giving up."
+ sys.exit(1)
+try:
+ import win32con
+except ImportError:
+ print "Beh. We have win32api but not win32con."
+ print "Making do with a dummy."
+ class win32con:
+ REG_NOTIFY_CHANGE_ATTRIBUTES = 0x00000002L
+ REG_NOTIFY_CHANGE_SECURITY = 0x00000008L
+ REG_RESOURCE_REQUIREMENTS_LIST = 10
+ REG_NONE = 0
+ REG_SZ = 1
+ REG_EXPAND_SZ = 2
+ REG_BINARY = 3
+ REG_DWORD = 4
+ REG_DWORD_LITTLE_ENDIAN = 4
+ REG_DWORD_BIG_ENDIAN = 5
+ REG_LINK = 6
+ REG_MULTI_SZ = 7
+ REG_RESOURCE_LIST = 8
+ REG_FULL_RESOURCE_DESCRIPTOR = 9
+ HKEY_CLASSES_ROOT = 0x80000000
+ HKEY_CURRENT_USER = 0x80000001
+ HKEY_LOCAL_MACHINE = 0x80000002
+ HKEY_USERS = 0x80000003
+ HKEY_PERFORMANCE_DATA = 0x80000004
+ HKEY_PERFORMANCE_TEXT = 0x80000050
+ HKEY_PERFORMANCE_NLSTEXT = 0x80000060
+
+
+def listtree(handle, level=0):
+ i = 0
+ while 1:
+ try:
+ key = win32api.RegEnumKey(handle, i)
+ except win32api.error:
+ break
+ try:
+ value = win32api.RegQueryValue(handle, key)
+ except win32api.error, msg:
+ try:
+ msg = msg[2]
+ except:
+ pass
+ value = "*** Error: %s" % str(msg)
+ print " "*level + "%s: %s" % (key, value)
+ subhandle = win32api.RegOpenKey(handle, key)
+ listtree(subhandle, level+1)
+ win32api.RegCloseKey(subhandle)
+ i = i+1
+
+roothandle = win32con.HKEY_LOCAL_MACHINE
+pythonkey = "Software\\Python"
+try:
+ pythonhandle = win32api.RegOpenKey(roothandle, pythonkey)
+except win32api.error:
+ pythonhandle = win32api.RegCreateKey(roothandle, pythonkey)
+
+## listtree(pythonhandle)
+## try:
+## handle = win32api.RegOpenKey(pythonhandle, "JustTesting")
+## except win32api.error, msg:
+## try: msg = msg[2]
+## except: pass
+## ##print "Error opening, try creating instead:", msg
+## handle = win32api.RegCreateKey(pythonhandle, "JustTesting")
+## win32api.RegSetValue(handle, "test1", win32con.REG_SZ, "NO!")
+## win32api.RegSetValue(handle, "test2", win32con.REG_SZ, "YES!")
+## win32api.RegDeleteKey(handle, "test1")
+## win32api.RegDeleteKey(handle, "test2")
+## win32api.RegCloseKey(handle)
+## win32api.RegDeleteKey(pythonhandle, "JustTesting")
+## listtree(pythonhandle)
+
+print "Setting PythonPath..."
+corekey = "PythonCore\\%s" % sys.winver
+try:
+ corehandle = win32api.RegOpenKey(pythonhandle, corekey)
+except win32api.error, msg:
+ corehandle = win32api.RegCreateKey(pythonhandle, corekey)
+path = []
+pwd = nt.getcwd()
+for i in ["Bin",
+ "Lib",
+ "Lib\\win",
+ "Lib\\tkinter",
+ "Lib\\test",
+ "Lib\\dos_8x3"]:
+ i = pwd + "\\" + i
+ path.append(i)
+sys.path[1:] = path
+pathvalue = strop.join(path, ";")
+#print "Setting PythonPath to", pathvalue
+win32api.RegSetValue(corehandle, "PythonPath", win32con.REG_SZ, pathvalue)
+win32api.RegCloseKey(corehandle)
+#listtree(pythonhandle)
+win32api.RegCloseKey(pythonhandle)
+
+print "Registering Python Interpreter as shell for *.py files..."
+pwd = nt.getcwd()
+interpreter = '"' + pwd + '\\Bin\\python.exe" -i %1'
+print "Interpreter command is", interpreter
+root = win32con.HKEY_CLASSES_ROOT
+sz = win32con.REG_SZ
+win32api.RegSetValue(root, ".py", sz, "Python.Script")
+win32api.RegSetValue(root , "Python.Script", sz, "Python Script")
+win32api.RegSetValue(root , "Python.Script\\Shell\\Open\\Command", sz,
+ interpreter)
+
+import compileall
+print "Compiling all library modules..."
+compileall.main()
+
+print "Installation complete."
+
+envkeys = map(strop.upper, nt.environ.keys())
+if 'PYTHONPATH' in envkeys:
+ print """
+**********************************************************************
+WARNING!
+You have set the environment variable PYTHONPATH.
+This will override the default Python module search path
+and probably cause you to use an old or broken Python installation.
+Go into your control panel *now* and delete PYTHONPATH!
+**********************************************************************
+"""
+
+raw_input("Press Enter to exit: ")
+sys.exit(0)
+
+
+registry_doc = """Summary of the Win32 API Registry interfaces.
+
+Concepts:
+ A _directory_ is a collection of key/value pairs.
+ You need a _handle_ for a directory to do anything with it.
+ There are some predefined keys, e.g. HKEY_LOCAL_MACHINE.
+ A _key_ is an ASCII string; NT file system conventions apply.
+ A _value_ has a type and some data; there are predefined types
+ (e.g. REG_SZ is a string, REG_DWORD is a 4-byte integer).
+ There's some fishiness in that in fact multiple, named values
+ can appear under each key, but this seems little used (in this
+ case, the value is best seen as a structured value).
+ A key can also refer to a _subdirectory_. In this case the
+ associated value is typically empty. To get a handle for a
+ subdirectory, use RegOpenKey(handle, key). The key can also
+ be a backslash-separated path, so you can go directly from one of
+ the predefined keys to the directory you are interested in.
+
+Most common functions:
+ RegOpenKey(handle, keypath) -> handle
+ Get a handle for an existing subdirectory
+ RegCreateKey(handle, keypath) -> handle
+ Get a handle for a new subdirectory
+ RegCloseKey(handle)
+ Close a handle
+ RegGetValue(handle, subkey) -> string
+ Get the (unnamed) value stored as key in handle
+ RegSetValue(handle, subkey, type, value)
+ Set the (unnamed) value stored as key in handle, with given
+ type; type should be REG_SZ
+ RegSetValueEx(handle, name, reserved, type, value)
+ Set the value with given name to the given type and value;
+ currently reserved is ignored and type should be REG_SZ
+
+Functions to list directory contents (start counting at 0, fail if done):
+ RegEnumKey(handle, i)
+ Return the i'th subkey
+ RegEnumValue(handle, i)
+ Return the i'th name and value
+
+Lesser used functions:
+ RegFlushKey(handle)
+ Flush the changes to the handle to disk (like Unix sync())
+ RegSaveKey(handle, filename, reserved)
+ Save the contents to a disk file (broken?!)
+ RegLoadKey(handle, keypath, filename)
+ Load the contents from a disk file (lots of restrictions!)
+"""