Skip to content

Commit 26e2ae8

Browse files
hugovkgvanrossumadalke
committed
Python 0.9.1p1
Reconstructed by Andrew Dalke from alt.sources archive on Google Groups. http://www.dalkescientific.com/writings/diary/archive/2009/03/27/python_0_9_1p1.html Co-authored-by: Guido van Rossum <[email protected]> Co-authored-by: Andrew Dalke <[email protected]>
0 parents  commit 26e2ae8

File tree

296 files changed

+47393
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

296 files changed

+47393
-0
lines changed

README

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
This is Python, an extensible interpreted programming language that
2+
combines remarkable power with very clear syntax.
3+
4+
This is version 0.9 (the first beta release), patchlevel 1.
5+
6+
Python can be used instead of shell, Awk or Perl scripts, to write
7+
prototypes of real applications, or as an extension language of large
8+
systems, you name it. There are built-in modules that interface to
9+
the operating system and to various window systems: X11, the Mac
10+
window system (you need STDWIN for these two), and Silicon Graphics'
11+
GL library. It runs on most modern versions of UNIX, on the Mac, and
12+
I wouldn't be surprised if it ran on MS-DOS unchanged. I developed it
13+
mostly on an SGI IRIS workstation (using IRIX 3.1 and 3.2) and on the
14+
Mac, but have tested it also on SunOS (4.1) and BSD 4.3 (tahoe).
15+
16+
Building and installing Python is easy (but do read the Makefile).
17+
A UNIX style manual page and extensive documentation (in LaTeX format)
18+
are provided. (In the beta release, the documentation is still under
19+
development.)
20+
21+
Please try it out and send me your comments (on anything -- the
22+
language design, implementation, portability, installation,
23+
documentation) and the modules you wrote for it, to make the first
24+
real release better. If you needed to hack the source to get it to
25+
compile and run on a particular machine, send me the fixes -- I'll try
26+
to incorporate them into the next patch. If you can't get it to work
27+
at all, send me a *detailed* description of the problem and I may look
28+
into it.
29+
30+
If you want to profit of the X11 or Mac window interface, you'll need
31+
STDWIN. This is a portable window system interface by the same
32+
author. The versions of STDWIN floating around on some archives are
33+
not sufficiently up-to-date for use with Python. I will distribute
34+
the latest and greatest STDWIN version at about the same time as Python.
35+
36+
I am the author of Python:
37+
38+
Guido van Rossum
39+
CWI, dept. CST
40+
Kruislaan 413
41+
1098 SJ Amsterdam
42+
The Netherlands
43+
44+
45+
46+
The Python source is copyrighted, but you can freely use and copy it
47+
as long as you don't change or remove the copyright:
48+
49+
/***********************************************************
50+
Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
51+
Netherlands.
52+
53+
All Rights Reserved
54+
55+
Permission to use, copy, modify, and distribute this software and its
56+
documentation for any purpose and without fee is hereby granted,
57+
provided that the above copyright notice appear in all copies and that
58+
both that copyright notice and this permission notice appear in
59+
supporting documentation, and that the names of Stichting Mathematisch
60+
Centrum or CWI not be used in advertising or publicity pertaining to
61+
distribution of the software without specific, written prior permission.
62+
63+
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
64+
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
65+
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
66+
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
67+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
68+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
69+
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
70+
71+
******************************************************************/

README.reconstructed

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Reconstructed by Andrew Dalke from alt.sources archive on Google Groups.
2+
The original posts were dated 21 Feb 1991 and titled:
3+
Python 0.9.1 part 01/21
4+
...
5+
Python 0.9.1 part 21/21
6+
7+
although part 02 was retracted and is not needed. I also applied
8+
the patch titled "Python 0.9 official patch #1" (22 Feb 1991).
9+
I could not get patch to understand it so I applied the changes
10+
manually.
11+
12+
My download from Google groups lost embedded tabs in the Makefile,
13+
which I fixed by hand. My download also added a space at the end
14+
of every line, so I wrote script to remove all trailing whitespace
15+
before the newline.
16+
17+
Some of the code did not compile under gcc-4.0 on my Mac. These
18+
are in the files import.c, listobject.c, and regexpmodule.c. I
19+
added the right prototypes to make it work and put a comment
20+
in the text. I also commented out the inclusion of the Python-
21+
supplied implementation of strerror in the Makefile.
22+
23+
Some of the files may have extra or fewer blank lines than
24+
the original source.
25+
26+
To compile, "cd src; make". The result is a "./python" in
27+
that src directory.
28+
29+
Some quick differences from modern Python I found when
30+
using the resulting binary:
31+
32+
- classes must have the (), as in
33+
class Spam():
34+
pass
35+
36+
- There is no '__init__' function for instances. The
37+
classes in the library by convention use 'Create()'
38+
and that must be explicitly called.
39+
40+
- The library code does not consistently use 'self'.
41+
42+
- Only single quote strings 'like this' are allowed. "Double quoted"
43+
strings are not allowed.
44+
45+
Enjoy!
46+
Andrew Dalke
47+
48+
27 March 2009

demo/README

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
This directory contains various demonstrations of what you can do with
2+
Python. The demos are grouped sub(sub*)directories according to
3+
required optional built-in modules.
4+
5+
scripts Some useful Python scripts that I put in my bin
6+
directory. No optional built-in modules meeded.
7+
8+
sgi Demos that only run on Silicon Graphics machines.
9+
Require the built-in modules 'audio' and/or 'gl'.
10+
11+
stdwin Demos that use the STDWIN library. Require the 'stdwin'
12+
built-in module.
13+
14+
WARNING: some scripts are executable and have a first line saying
15+
16+
#! /ufs/guido/bin/sgi/python
17+
18+
This is unlikely to give good results anywhere else except in my
19+
office. Edit the first line before installing such scripts; to try
20+
them out, you can just say "python file.py". (The .py suffix is not
21+
necessary in this case, but makes it possible to debug the modules
22+
interactively by importing them.)

demo/scripts/findlinksto.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#! /ufs/guido/bin/sgi/python
2+
3+
# findlinksto
4+
#
5+
# find symbolic links to a given path
6+
7+
import posix, path, sys
8+
9+
def visit(pattern, dirname, names):
10+
if path.islink(dirname):
11+
names[:] = []
12+
return
13+
if path.ismount(dirname):
14+
print 'descend into', dirname
15+
n = len(pattern)
16+
for name in names:
17+
name = path.cat(dirname, name)
18+
try:
19+
linkto = posix.readlink(name)
20+
if linkto[:n] = pattern:
21+
print name, '->', linkto
22+
except posix.error:
23+
pass
24+
25+
def main(pattern, args):
26+
for dirname in args:
27+
path.walk(dirname, visit, pattern)
28+
29+
main(sys.argv[1], sys.argv[2:])

demo/scripts/mkreal.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#! /ufs/guido/bin/sgi/python
2+
3+
# mkreal
4+
#
5+
# turn a symlink to a directory into a real directory
6+
7+
import sys
8+
import posix
9+
import path
10+
from stat import *
11+
12+
cat = path.cat
13+
14+
error = 'mkreal error'
15+
16+
BUFSIZE = 32*1024
17+
18+
def mkrealfile(name):
19+
st = posix.stat(name) # Get the mode
20+
mode = S_IMODE(st[ST_MODE])
21+
linkto = posix.readlink(name) # Make sure again it's a symlink
22+
f_in = open(name, 'r') # This ensures it's a file
23+
posix.unlink(name)
24+
f_out = open(name, 'w')
25+
while 1:
26+
buf = f_in.read(BUFSIZE)
27+
if not buf: break
28+
f_out.write(buf)
29+
del f_out # Flush data to disk before changing mode
30+
posix.chmod(name, mode)
31+
32+
def mkrealdir(name):
33+
st = posix.stat(name) # Get the mode
34+
mode = S_IMODE(st[ST_MODE])
35+
linkto = posix.readlink(name)
36+
files = posix.listdir(name)
37+
posix.unlink(name)
38+
posix.mkdir(name, mode)
39+
posix.chmod(name, mode)
40+
linkto = cat('..', linkto)
41+
#
42+
for file in files:
43+
if file not in ('.', '..'):
44+
posix.symlink(cat(linkto, file), cat(name, file))
45+
46+
def main():
47+
sys.stdout = sys.stderr
48+
progname = path.basename(sys.argv[0])
49+
args = sys.argv[1:]
50+
if not args:
51+
print 'usage:', progname, 'path ...'
52+
sys.exit(2)
53+
status = 0
54+
for name in args:
55+
if not path.islink(name):
56+
print progname+':', name+':', 'not a symlink'
57+
status = 1
58+
else:
59+
if path.isdir(name):
60+
mkrealdir(name)
61+
else:
62+
mkrealfile(name)
63+
sys.exit(status)
64+
65+
main()

demo/scripts/ptags.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#! /ufs/guido/bin/sgi/python
2+
3+
# ptags
4+
#
5+
Create a tags file for Python programs
6+
# Tagged are:
7+
# - functions (even inside other defs or classes)
8+
# - classes
9+
# - filenames
10+
# Warns about files it cannot open.
11+
# No warnings about duplicate tags.
12+
13+
import sys
14+
import posix
15+
import path
16+
import string
17+
18+
keywords = ['def', 'class'] # If you add keywords, update starts!!!
19+
starts = 'dc' # Starting characters of keywords
20+
21+
whitespace = string.whitespace
22+
identchars = string.letters + string.digits + '_'
23+
24+
tags = [] # Modified!
25+
26+
def main():
27+
args = sys.argv[1:]
28+
for file in args: treat_file(file)
29+
if tags:
30+
fp = open('tags', 'w')
31+
tags.sort()
32+
for s in tags: fp.write(s)
33+
34+
def treat_file(file):
35+
try:
36+
fp = open(file, 'r')
37+
except:
38+
print 'Cannot open', file
39+
return
40+
base = path.basename(file)
41+
if base[-3:] = '.py': base = base[:-3]
42+
s = base + '\t' + file + '\t' + '1\n'
43+
tags.append(s)
44+
while 1:
45+
line = fp.readline()
46+
if not line: break
47+
maketag(line, file)
48+
49+
def maketag(line, file):
50+
i = 0
51+
while line[i:i+1] in whitespace: i = i+1
52+
if line[i:i+1] not in starts: return
53+
n = len(line)
54+
j = i
55+
while i < n and line[i] not in whitespace: i = i+1
56+
if line[j:i] not in keywords: return
57+
while i < n and line[i] in whitespace: i = i+1
58+
j = i
59+
while i < n and line[i] in identchars: i = i+1
60+
name = line[j:i]
61+
while i < n and line[i] in whitespace: i = i+1
62+
if i < n and line[i] = '(': i = i+1
63+
s = name + '\t' + file + '\t' + '/^' + line[:i] + '/\n'
64+
tags.append(s)
65+
66+
main()

demo/scripts/suff.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#! /ufs/guido/bin/sgi/python
2+
3+
# suff
4+
#
5+
# show different suffixes amongst arguments
6+
7+
import sys
8+
9+
def main():
10+
files = sys.argv[1:]
11+
suffixes = {}
12+
for file in files:
13+
suff = getsuffix(file)
14+
if not suffixes.has_key(suff):
15+
suffixes[suff] = []
16+
suffixes[suff].append(file)
17+
keys = suffixes.keys()
18+
keys.sort()
19+
for suff in keys:
20+
print `suff`, len(suffixes[suff])
21+
22+
def getsuffix(file):
23+
suff = ''
24+
for i in range(len(file)):
25+
if file[i] = '.':
26+
suff = file[i:]
27+
return suff
28+
29+
main()

0 commit comments

Comments
 (0)