Commit Graph

23561 Commits

Author SHA1 Message Date
Tim Peters
30e0beab6d Remove cut 'n paste silliness. 2002-08-03 02:17:41 +00:00
Tim Peters
aa7d24319e Minor fiddling, including a simple class to implement a heap iterator
in the test file.  I have docs for heapq.heapify ready to check in, but
Jack appears to have left behind a stale lock in the Doc/lib directory.
2002-08-03 02:11:26 +00:00
Jack Jansen
0e0a479821 Added an icon for .pyw files. 2002-08-02 22:32:41 +00:00
Jack Jansen
2f8816fda6 An icon for .pyw files. Yes, it's lousy, I know.... 2002-08-02 22:18:05 +00:00
Guido van Rossum
fbb299226d Augment credits. 2002-08-02 22:01:37 +00:00
Tim Peters
28c25527c2 Hmm! I thought I checked this in before! Oh well.
Added new heapify() function, which transforms an arbitrary list into a
heap in linear time; that's a fundamental tool for using heaps in real
life <wink>.

Added heapyify() test.  Added a "less naive" N-best algorithm to the test
suite, and noted that this could actually go much faster (building on
heapify()) if we had max-heaps instead of min-heaps (the iterative method
is appropriate when all the data isn't known in advance, but when it is
known in advance the tradeoffs get murkier).
2002-08-02 21:48:06 +00:00
Jack Jansen
940dc922c0 Build the IDE last, as it may fail because of waste missing. 2002-08-02 21:46:40 +00:00
Jack Jansen
0fdaee7419 Added a lot more information on framework builds, the various .app's,
etc. Still not enough, probably, but better than what we had.
2002-08-02 21:45:27 +00:00
Jack Jansen
337f85d34f Updated for the new path to Python.app. 2002-08-02 21:05:16 +00:00
Jack Jansen
f80798b1ca When building the IDE check that waste is available, to forestall
surprises later (the IDE won't work without waste).
2002-08-02 21:04:46 +00:00
Guido van Rossum
4b48d6b37c Add a PEP-263-style encoding turd^H^H^H^Hdeclaration, because there's
a c-cedilla in one of the docstrings.
2002-08-02 20:23:56 +00:00
Fred Drake
610291cf5a Fix ref(), proxy() docstrings, based on comments from David Abrahams. 2002-08-02 20:23:40 +00:00
Tim Peters
62abc2f6ce heappop(): Added comments; simplified and sped the code. 2002-08-02 20:09:14 +00:00
Fred Drake
1acab695a7 Minor markup changes. 2002-08-02 19:46:42 +00:00
Tim Peters
a0b3a00bc5 heappop(): Use "while True" instead of "while 1". 2002-08-02 19:45:37 +00:00
Tim Peters
d2cf1ab0e2 check_invariant(): Use the same child->parent "formula" used by heapq.py. 2002-08-02 19:41:54 +00:00
Tim Peters
d9ea39db84 Don't use true division where int division was intended. For that matter,
don't use division at all.
2002-08-02 19:16:44 +00:00
Fred Drake
b481286504 Add a comment showing how one of the macros should be used. 2002-08-02 18:30:22 +00:00
Guido van Rossum
0b19178736 Adding the heap queue algorithm, per discussion in python-dev last
week.
2002-08-02 18:29:53 +00:00
Fred Drake
ad09bbfce3 Add heapq module docs to the dependency information. 2002-08-02 18:20:34 +00:00
Guido van Rossum
4a57c33dff Adding the heap queue algorithm, per discussion in python-dev last
week.
2002-08-02 18:05:20 +00:00
Guido van Rossum
975121664e Add docs for heapq.py. 2002-08-02 18:03:24 +00:00
Skip Montanaro
de994d9130 indicate that 'b' is added to the mode flag if not given 2002-08-02 17:20:46 +00:00
Skip Montanaro
71ffc5cc4b add #include branch for compilation with Berkeley DB 2002-08-02 17:13:01 +00:00
Skip Montanaro
404378f834 catch the situation where Berkeley DB is used to emulate dbm(3) library
functions.  In this case, calling dbm.open("foo", "c") actually creates a
file named "foo.db".
2002-08-02 17:12:15 +00:00
Skip Montanaro
13a5678a51 regression test for the whichdb module 2002-08-02 17:10:10 +00:00
Guido van Rossum
37c3b2788b Add Kevin O'Connor, author of the heapq code. 2002-08-02 16:50:58 +00:00
Guido van Rossum
0a82438859 Adding the heap queue algorithm, per discussion in python-dev last
week.
2002-08-02 16:44:32 +00:00
Skip Montanaro
f4433303a8 testGetServByName shouldn't check for getservbyname - the socket module
should always have it.
2002-08-02 15:52:30 +00:00
Jack Jansen
940e970f6e Also create BuildApplet. It's useful enough as a standalone application. 2002-08-02 15:32:12 +00:00
Jack Jansen
3e6c80bf5e Hmm, in some cases we don't seem to get our scriptname in argv[0].
Cater for that by working from sys.executable.
2002-08-02 15:31:25 +00:00
Jack Jansen
ba1c13db4f Final step in making applets first-class citizens: if the applet wants
argv emulation (i.e. if the end user drops files and folders on the
applets these will show up in sys.argv) BuildApplet will add the required
code to the applet bundle, in __rawmain__.pyc.

This code is compiled from appletrawmain.py, it creates sys.argv, cleans
up most of the mess and executes either __main__.py or __main__.pyc.
2002-08-02 14:57:43 +00:00
Jack Jansen
a9454e21a7 Oops, the -psn stuff is in argv[1], of course. 2002-08-02 14:54:46 +00:00
Jack Jansen
21ed16acbe Added one call to Py_Main(), for OSX framework builds only, that will get the
actual script to run in case we are running from an applet. If we are indeed
running an applet we skip the normal option processing leaving it all to the
applet code.

This allows us to get use the normal python binary in the Python.app bundle,
giving us all the normal command line options through PythonLauncher while
still allowing Python.app to be used as the template for building applets.

Consequently, pythonforbundle is gone, and Mac/Python/macmain.c isn't used
on OSX anymore.
2002-08-02 14:11:24 +00:00
Jack Jansen
94416e55d3 Got rid of a couple of OS9-isms. 2002-08-02 14:04:42 +00:00
Jack Jansen
2eb4b18f94 - Slightly better error message in case of syntax errors in the script.
- The applet .rsrc file should be called python.rsrc, it is not based on the
  applet name.
2002-08-02 14:04:15 +00:00
Michael W. Hudson
90b8e4d40c Fix for
[ 589427 ] standard include paths on command line
2002-08-02 13:55:50 +00:00
Jack Jansen
6e1986ba9c - Remove -psn-xxxx argument added by the Finder.
- "Open Document" appleevent is "odoc", not "open".
2002-08-02 12:56:21 +00:00
Jack Jansen
d5049e734f Replaced python.app target with osxapps (it builds more than
one .app nowadays) and fixed it to work.
2002-08-02 11:24:11 +00:00
Jack Jansen
f4f6d4859d Construct a sys.argv from the initial AppleEvent sent by the finder
during startup of a program. This module will replace the C code in
macgetargv.c so we can get rid of the special macmain.c for OSX
Python.app.
2002-08-02 11:12:15 +00:00
Jack Jansen
d05e18139f Slightly better error message in case of missing resources. 2002-08-02 11:03:19 +00:00
Tim Peters
d5f4359458 New test %sort. This takes a sorted list, picks 1% of the list positions
at random, and replaces the elements at those positions with new random
values.  I was pleasantly surprised by how fast this goes!  It's hard to
conceive of an algorithm that could special-case for this effectively.
Plus it's exactly what happens if a burst of gamma rays corrupts your
sorted database on disk <wink>.

 i    2**i  *sort  ...  %sort
15   32768   0.18  ...   0.03
16   65536   0.24  ...   0.04
17  131072   0.53  ...   0.08
18  262144   1.17  ...   0.16
19  524288   2.56  ...   0.35
20 1048576   5.54  ...   0.77
2002-08-02 05:46:09 +00:00
Mark Hammond
fe51c6d66e Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype
for Py_Main().

Thanks to Kalle Svensson and Skip Montanaro for the patches.
2002-08-02 02:27:13 +00:00
Skip Montanaro
d3c884d4ea modify testGetServByName so it tries a few different protocols. In this day
and age of rampant computer breakins I imagine there are plenty of systems
with telnet disabled.  Successful check of at least one getservbyname() call
is required for success
2002-08-02 02:19:46 +00:00
Jack Jansen
ea0c3828c0 - Get _environ through the NSEnviron call in a MacOSX framework. This allows
us to completely decouple the framework from the executable, so we
  can use a two-level namespace.
- Do framework builds with a twolevel namespace.
- Reorganized the code that creates the minimal framework in the build
  directory, to make it more robust against incomplete frameworks (from
  earlier aborted builds, or builds of previous Python versions).
2002-08-01 21:57:49 +00:00
Jack Jansen
be3e1f7a95 Python.app is now a hidden application, deep in the framework. It will
be invoked by PythonLauncher when needed.

Also changed the names of various variables in the Makefile to match
what the main Makefile has.
2002-08-01 21:14:06 +00:00
Jack Jansen
2fc993d16f Python.app no longer advertises that it can handle .py and .pyc files,
PythonLauncher.app has taken that responsibility over.
2002-08-01 21:12:36 +00:00
Guido van Rossum
b54c27c861 Fix for SF bug 570678 (can't flush read-only file on Mac OS X). 2002-08-01 21:12:35 +00:00
Guido van Rossum
f4be427c46 Tim found that once test_longexp has run, test_sort takes very much
longer to run than normal.  A profiler run showed that this was due to
PyFrame_New() taking up an unreasonable amount of time.  A little
thinking showed that this was due to the while loop clearing the space
available for the stack.  The solution is to only clear the local
variables (and cells and free variables), not the space available for
the stack, since anything beyond the stack top is considered to be
garbage anyway.  Also, use memset() instead of a while loop counting
backwards.  This should be a time savings for normal code too!  (By a
probably unmeasurable amount. :-)
2002-08-01 18:50:33 +00:00
Jack Jansen
0a3d6060d5 Only show the UI for selecting options if the ALT key was depressed while
dragging or double-clicking the script.
2002-08-01 15:07:00 +00:00