Commit Graph

182 Commits

Author SHA1 Message Date
Guido van Rossum 7dab2426ca - New builtin function enumerate(x), from PEP 279. Example:
enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c").
  The argument can be an arbitrary iterable object.
2002-04-26 19:40:56 +00:00
Neil Schemenauer fd1030e166 pgen now needs pymalloc 2002-04-22 03:05:25 +00:00
Martin v. Löwis 2d7e264762 Eliminate use of LIBOBJS which is an error in autoconf 2.53. 2002-04-05 16:50:53 +00:00
Guido van Rossum 77f6a65eb0 Add the 'bool' type and its values 'False' and 'True', as described in
PEP 285.  Everything described in the PEP is here, and there is even
some documentation.  I had to fix 12 unit tests; all but one of these
were printing Boolean outcomes that changed from 0/1 to False/True.
(The exception is test_unicode.py, which did a type(x) == type(y)
style comparison.  I could've fixed that with a single line using
issubtype(x, type(y)), but instead chose to be explicit about those
places where a bool is expected.

Still to do: perhaps more documentation; change standard library
modules to return False/True from predicates.
2002-04-03 22:41:51 +00:00
Martin v. Löwis 1142de3f5b Patch #527027: Allow building python as shared library. 2002-03-29 16:28:31 +00:00
Tim Peters 1221c0a435 Build obmalloc.c directly instead of #include'ing from object.c.
Also move all _PyMalloc_XXX entry points into obmalloc.c.

The Windows build works fine.
The Unix build is changed here (Makefile.pre.in), but not tested.
No other platform's build process has been fiddled.
2002-03-23 00:20:15 +00:00
Guido van Rossum c948966fc4 SF patch #524005 by Paul Eggert.
Use posixly correct sort args.

Bugfix candidate.
2002-02-28 19:26:08 +00:00
Jack Jansen 246debbbc2 Two OSX fixes related to switching Python versions in an existing sourcetree:
- Create the Python.framework/Versions/$(VERSION) dir if it doesn't exist
- Override existing symlinks in the framework.
2002-02-12 21:30:53 +00:00
Martin v. Löwis 9741dc96f3 Use BLDLIBRARY to build extension modules. Fixes #504252.
2.2.1 candidate.
2002-01-17 12:30:12 +00:00
Jack Jansen 0d1536654d When running regen for the plat directories we should use the BUILDEXT
extension, not the EXT one, as regen uses the python binary in the build
directory. Fixes #493959.
2001-12-19 09:24:40 +00:00
Jack Jansen 1999ef4973 Test wether we are building on a case-insensitive filesystem (such
as OSX HFS+) and if so add an extension to the python executable, but
only in the build directory, not on the installed python.
2001-12-06 21:47:20 +00:00
Guido van Rossum f227252c21 The parser now also needs to link with mysnprintf.o. 2001-12-04 03:54:08 +00:00
Tim Peters 1ca1296157 The parser doesn't need its own implementation of assert, and having its
own interfered with including Python.h.  Remove Python's assert.h.
2001-12-04 03:18:48 +00:00
Barry Warsaw f4c20d354c LIBSUBDIRS: Add test/data so it gets installed and test_email.py can
pass.  Closes SF # 485080
2001-12-03 18:51:41 +00:00
Martin v. Löwis 06f15bbcc4 Compute thread headers through shell expansion in configure.
Fixes #485679.
2001-12-02 13:02:32 +00:00
Martin v. Löwis 2b4d580a41 Add hotshot to LIBSUBDIRS. Fixes #484642. 2001-11-24 09:39:05 +00:00
Fred Drake 41a1b07636 Now that Misc/Makefile.pre.in is gone, do not attempt to install it. 2001-10-26 19:48:06 +00:00
Guido van Rossum 67b2659046 Patch from SF bug #473150: configure weaknesses on HP-UX (Michael Piotrowski)
1. configure doesn't handle HP-UX release numbers
    (e.g., B.11.00), resulting in MACHDEP = "hpuxB".

    2. After checking for wchar.h, configure doesn't
    include it when checking the size of wchar_t.

    (Python 2.2b1 on HP-UX 11.00)
2001-10-20 14:21:45 +00:00
Guido van Rossum 98bf58f1c6 SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
This is a big one, touching lots of files.  Some of the platforms
aren't tested yet.  Briefly, this changes the return value of the
os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the
time functions localtime(), gmtime(), and strptime() from tuples into
pseudo-sequences.  When accessed as a sequence, they behave exactly as
before.  But they also have attributes like st_mtime or tm_year.  The
stat return value, moreover, has a few platform-specific attributes
that are not available through the sequence interface (because
everybody expects the sequence to have a fixed length, these couldn't
be added there).  If your platform's struct stat doesn't define
st_blksize, st_blocks or st_rdev, they won't be accessible from Python
either.

(Still missing is a documentation update.)
2001-10-18 20:34:25 +00:00
Guido van Rossum b33e789cb8 SF patch #471894: Makefile installs pydoc incorrectly
Add --install-scripts=$(BINDIR) argument to "setup.py install"
invocation.
2001-10-17 06:26:53 +00:00
Fred Drake 502ed82125 Add dependencies for the weakref object. 2001-10-05 21:56:02 +00:00
Guido van Rossum bb29b9c952 Clarify the warning about the relative dates of Setup.dist and Setup;
Jeremy had seen the warning but not realized what he should do about
it.  Add the hint "Usually, copying Setup.dist to Setup will work."
2001-09-29 00:42:19 +00:00
Andrew M. Kuchling 76d62b4e79 Install the new compiler and email packages 2001-09-28 20:29:15 +00:00
Guido van Rossum 427ce80df6 Sort the headers in PYTHON_HEADERS alphabetically. Add
structmember.h, which was missing (and caused me a snide comment by
Tim when he fixed something I missed because of the missed dependency
:-).
2001-09-18 02:40:21 +00:00
Guido van Rossum 1140cb2b9e When MAKEFLAGS contains '-s', invoke setup.py with '-q', to silence
its normally chatty nature.

(This completes a side project to make "make -s" truly silent unless
errors occur.)
2001-09-12 18:59:25 +00:00
Jack Jansen 127e56e5e8 When frameworks are not enabled don't put an empty target in the Makefile.
Older make's can apparently choke on this.
2001-09-11 14:41:54 +00:00
Neil Schemenauer 9c63e6d682 Always compile gcmodule. 2001-08-29 23:44:38 +00:00
Guido van Rossum 9454ad7263 Add dependencies for Python/thread.c on all of the header files that
it may depend on.  It's really annoying that thread.o doesn't get
rebuilt when the .h file is changed! :-)

The dependency is on *all* the Python/thread_*.h files -- that should
be sufficient and rarely cause unneeded recompilations.
2001-08-18 21:08:22 +00:00
Jack Jansen a8278cc37e The OSX framework Headers symlink pointed the wrong way. Fixed.
Bill Fancher found this one.
2001-08-17 22:37:02 +00:00
Martin v. Löwis 339d0f720e Patch #445762: Support --disable-unicode
- Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled
- check for Py_USING_UNICODE in all places that use Unicode functions
- disables unicode literals, and the builtin functions
- add the types.StringTypes list
- remove Unicode literals from most tests.
2001-08-17 18:39:25 +00:00
Guido van Rossum 7cb32ae7bf Strip trailing whitespace, including two lines containing only one or
more tabs that XEmacs Makefile mode found suspicious.
2001-08-17 15:32:31 +00:00
Jack Jansen b6e9cad34c Lots of changes in the framework support:
- Made framework builds work for MacOSX. The configure arg is now
  "--enable-framework".
- Added an install target frameworkinstall which installs the framework.
- Ripped out Next/OpenStep support, which was broken anyway.
- Made the MacOSX toolbox glue dependant on a --enable-toolbox-glue
  configure arg. This should make naked darwin build work again (untested).

A few targets have been added to Makefile.pre.in, and on inspection they
look harmless to non-MacOSX machines, but it is worth checking.

Closes bug #420601 and patch #450350.
2001-08-15 01:26:28 +00:00
Martin v. Löwis ab0cad520d Pass the Makefile's value of CC and LDSHARED to the environment of setup.py.
This fixes the problem reported in bug report #438786.
2001-08-10 20:18:26 +00:00
Jack Jansen 086d22fdb4 Removed special rule for Mac/Python/macglue.o, it is not needed anymore. 2001-08-08 13:18:36 +00:00
Martin v. Löwis d429ab6df9 Take MANDIR and INCLUDEDIR from configure. Fixes bug #446671. 2001-08-02 06:20:20 +00:00
Tim Peters 6d6c1a35e0 Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00
Marc-André Lemburg e5006ebc9d This patch turns the Python API mismatch notice into a standard
Python warning which can be catched by means of the Python warning
framework.

It also adds two new APIs which hopefully make it easier for Python
to switch to buffer overflow safe [v]snprintf() APIs for error
reporting et al. The two new APIs are PyOS_snprintf() and
PyOS_vsnprintf() and work just like the standard ones in many
C libs. On platforms which have snprintf(), the native APIs are used,
on all other an emulation with snprintf() tries to do its best.
2001-07-31 13:24:44 +00:00
Martin v. Löwis 4f1cd8bdcb Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774. 2001-07-26 13:41:06 +00:00
Neil Schemenauer 7d4bb9f179 Add -E command line switch (ignore environment variables like PYTHONHOME
and PYTHONPATH).
2001-07-23 16:30:27 +00:00
Guido van Rossum e31c2eeb41 Thomas, I don't care about unset either, but setting PYTHONHOME=
doesn't work -- it actually prevents the extensions from being built
properly.  So I'm changing the "sharedmods" target to what I presume
it was before:
	PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py build
2001-07-19 15:17:52 +00:00
Martin v. Löwis 130fb17578 Patch #418659: Fixes for UnixWare and ReliantUnix.
back-out 1.215 of configure.in and 1.34 of Makefile.pre.in
Check for -Kpthread compiler support, and use this as the sole option
for MT if available.
2001-07-19 11:00:41 +00:00
Thomas Wouters ee6a4a28ce Avoid the use of 'unset', which isn't available on all platforms. Fixes SF
bug #442627.
2001-07-19 09:34:09 +00:00
Jack Jansen c49e5b7386 Added a MACHDEP_OBJS to the python link. Use this on MacOSX to include
Mac/macglue.c into the core interpreter. This file contains the glue code that
allows extension modules for Mac toolboxes to live in different shared libraries
but still communicate with each other. The glue code is controlled by the
USE_MAC_TOOLBOX_GLUE define.
2001-06-19 15:00:23 +00:00
Guido van Rossum 1d88c59f75 Acknowledge the existence of the 'platform' file, generated by the
Makefile and used by the setup.py script.  Ignore it in .cvsignore;
remove it in "make clobber".
2001-06-06 17:51:57 +00:00
Neil Schemenauer 89e90d67aa Separate CFLAGS and CPPFLAGS. CFLAGS should not contain preprocessor
directives, which is the role of CPPFLAGS.  Closes SF patch #414991.
2001-06-02 06:16:02 +00:00
Guido van Rossum 59d1d2b434 Iterators phase 1. This comprises:
new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER
new C API PyObject_GetIter(), calls tp_iter
new builtin iter(), with two forms: iter(obj), and iter(function, sentinel)
new internal object types iterobject and calliterobject
new exception StopIteration
new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py)
new magic number for .pyc files
new special method for instances: __iter__() returns an iterator
iteration over dictionaries: "for x in dict" iterates over the keys
iteration over files: "for x in file" iterates over lines

TODO:

documentation
test suite
decide whether to use a different way to spell iter(function, sentinal)
decide whether "for key in dict" is a good idea
use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?)
speed tuning (make next() a slot tp_next???)
2001-04-20 19:13:02 +00:00
Jeremy Hylton 12b6457e24 Fix compileall.py so that it fails on SyntaxErrors
The changes cause compilation failures in any file in the Python
installation lib directory to cause the install to fail.  It looks
like compileall.py intended to behave this way, but a change to
py_compile.py and a separate bug defeated it.

Fixes SF bug #412436

This change affects the test suite, which contains several files that
contain intentional errors.  The solution is to extend compileall.py
with the ability to skip compilation of selected files.

NB compileall.py is changed so that compile_dir() returns success only
if all recursive calls to compile_dir() also check success.
2001-04-18 01:20:21 +00:00
Guido van Rossum cd0ed971f2 Remove shared libraries as part of "make clean" rather than in "make
clobber".  This is done so that after a "make clean", setup.py will
also recompile all extensions.
2001-04-14 17:57:07 +00:00
Guido van Rossum 2242f2fbd0 Unixware 7 support by Billy G. Allie (SF patch 413011) 2001-04-11 20:58:20 +00:00
Neil Schemenauer 3f5cc20813 Use INSTALL_SCRIPT to install script files. INSTALL_PROGRAM may try to
strip them.  Closes patch #406287.
2001-04-10 23:03:35 +00:00
Guido van Rossum 4e6a7a626d Make on Alpha Tru64 5.1 (as installed on the SF compile farm) doesn't
think that a command starting with '#' is a comment, so move the one
comment in such a position (in the rule for building $(LIBRARY)) to a
harmless position.
2001-04-09 22:23:22 +00:00
Neil Schemenauer 64b1b686d1 - Remove WITH makefile variable. Its not used for anything.
- Add CONFIG_ARGS variable and use it to re-run configure rather than
  using config.status.  This prevents an infinite loop if configure
  dies while re-configuring.
2001-03-22 00:32:32 +00:00
Neil Schemenauer cf20d4f5ad Install the Python DLL with execute priviledge set. This is required for
Cygwin Python to startup correctly when in ntsec mode.  Cygwin operating in
this mode is probably not the only system with this requirement.
2001-03-16 11:50:43 +00:00
Fred Drake a1a84e7d4f Move all knowledge that $(MAINOBJ) is built in the Modules/ directory
into Makefile.pre.in; the configure script will only determine the basename
of the file.

This fixes installation of a Python built using C++, reported by Greg
Wilson.
2001-03-06 05:52:16 +00:00
Barry Warsaw 4211925453 Added `memtest' target which excludes the quicktest modules plus
test_dl, test___all__, test_fork1, and test_longexp.  All these either
take way too long with Insure or crash it.
2001-03-03 04:14:21 +00:00
Guido van Rossum cd81ea1708 Use
find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f

to remove all .py[co] files before testing, rather than just those in
the Lib/test directory.  "find" is used all over the Makefile so I
suppose it's safe; how about xargs?
2001-03-01 00:36:53 +00:00
Jeremy Hylton 4db62b1e14 Improved __future__ parser; still more to do
Makefile.pre.in: add target future.o

Include/compile.h: define PyFutureFeaters and PyNode_Future()
                   add c_future slot to struct compiling

Include/symtable.h: add st_future slot to struct symtable

Python/future.c: implementation of PyNode_Future()

Python/compile.c: use PyNode_Future() for nested_scopes support

Python/symtable.c: include compile.h to pick up PyFutureFeatures decl
2001-02-27 19:07:02 +00:00
Neil Schemenauer cf9926ca8d Change EXEEXT back to EXE in the Makefile. Other tools may depend on the name.
The name in configure is still EXEEXT because that's what autoconf calls it.
Also, replace a few occurrences of "python" with "$(PYTHON)".
2001-02-27 18:50:56 +00:00
Neil Schemenauer a35c688055 Add Vladimir Marangozov's object allocator. It is disabled by default. This
closes SF patch #401229.
2001-02-27 04:45:05 +00:00
Neil Schemenauer 40417746fa Add missing dependents of graminit.h. 2001-02-27 02:45:36 +00:00
Neil Schemenauer 7cd124c7d2 Generate grammar source files in srcdir. Ignore the error if they cannot
be created (perhaps the source directory is read-only).
2001-02-27 02:19:16 +00:00
Neil Schemenauer c5cfcb4a48 Fix bug in clean target (closes SF patch 103864 and bug 132879). The clobber
target now removes some configure files (like it did before).
2001-02-19 04:35:11 +00:00
Andrew M. Kuchling 0eb24d9328 Set PYTHONPATH when running setup.py in order to override any ambient
value for it, as suggested in bug #129854.  This prevents an old
    PYTHONPATH confusing setup.py (say, if it results in Python finding
    an old version of the Distutils)
2001-02-17 05:33:50 +00:00
Neil Schemenauer 2b2681ac3e Remove confusing explaination about altinstall target and refer to
the README file.
2001-02-16 04:16:34 +00:00
Neil Schemenauer 92538fbf85 Build grammar files in their proper place rather than moving them. This should
allow building with a read-only source tree (although I haven't tried it).
2001-02-16 03:59:53 +00:00
Neil Schemenauer 75e33892f8 Simplify linking on BeOS. Rename some files. Closes SF patch #103679. 2001-02-16 03:36:53 +00:00
Neil Schemenauer 8d3274e053 Specify directory permissions properly. Closes SF patch #103717. 2001-02-10 20:07:38 +00:00
Jeremy Hylton cb17ae8b19 Relax the rules for using 'from ... import *' and exec in the presence
of nested functions.  Either is allowed in a function if it contains
no defs or lambdas or the defs and lambdas it contains have no free
variables.  If a function is itself nested and has free variables,
either is illegal.

Revise the symtable to use a PySymtableEntryObject, which holds all
the revelent information for a scope, rather than using a bunch of
st_cur_XXX pointers in the symtable struct.  The changes simplify the
internal management of the current symtable scope and of the stack.

Added new C source file: Python/symtable.c.  (Does the Windows build
process need to be updated?)

As part of these changes, the initial _symtable module interface
introduced in 2.1a2 is replaced.  A dictionary of
PySymtableEntryObjects are returned.
2001-02-09 22:22:18 +00:00
Neil Schemenauer ac959779f0 Install shared modules enabled by Setup* in $(DESTSHARED) not
$(DESTSHARED)/Modules.
2001-02-06 14:50:27 +00:00
Neil Schemenauer e0d435777c Tweak clean targets yet again. 2001-02-03 17:16:29 +00:00
Jeremy Hylton 96da8b6d88 add compile.h and symtable.h to list of header files 2001-02-02 19:54:23 +00:00
Jeremy Hylton 26d1f14433 Undo recent exclusion of test_fork1 and test_zlib. These tests don't
trigger my arbitrary exlusion rule, which is: takes more than 10
seconds of wall clock time on my machine.  If these tests are going to
be skipped, then a boatload of slower tests should be skipped, too.
2001-02-02 18:12:16 +00:00
Fred Drake 042f3137ba Added fork1, linuxaudiodev, sunaudiodev, and zlib to the tests skipped
by the quicktest target.
2001-02-02 03:03:33 +00:00
Jeremy Hylton 2a850d91bc add quicktest target -- runs test suite except for the eight slowest tests 2001-02-01 19:51:28 +00:00
Andrew M. Kuchling bddd878cd5 Restore the automatic use of the oldsharedmods and oldsharedinstall targets 2001-01-29 20:18:59 +00:00
Sjoerd Mullender 30be8708c5 Don't use $< in normal make rules: it's not portable. Using $< in
inference rules (e.g. .c.o) is fine.
2001-01-29 09:39:14 +00:00
Neil Schemenauer 188218232d - Fix buildno dependencies (I hope).
- Change one last EXE to EXEEXT.
2001-01-27 21:42:38 +00:00
Andrew M. Kuchling 03184e2815 Remaining single-line change from patch #102409: to install shared modules,
run setup.py with the --install-platlib flag so you can override
   'prefix' when running make (e.g. make prefix=/tmp/python/usr/local install)

Instead of using mkdir to create directories, use install -d (mkdir -p
   apparently isn't portable)

Emacs make-mode reported line 371 as suspicious; removed the whitespace from
   that line.
2001-01-26 22:52:45 +00:00
Neil Schemenauer 7ac954b7f6 - Add CFLAGSFORSHARED variable. configure sets this to CCSHARED if LDLIBRARY
is a shared library.
- Add PY_CFLAGS variable (flags used to compile the interpreter)
- clobber now just removes object files, libraries and binaries
2001-01-26 16:14:41 +00:00
Neil Schemenauer f65e500594 Make module objects from Setup depend on Python.h headers. 2001-01-25 20:07:50 +00:00
Jeremy Hylton fbd849f201 PEP 227 implementation
A cell contains a reference to a single PyObject.  It could be
implemented as a mutable, one-element sequence, but the separate type
has less overhead.
2001-01-25 20:04:14 +00:00
Neil Schemenauer 85515ad979 Flat makefile based on toplevel Makefile.in and makefiles in build
subdirectories.  Those other makefiles will go away eventually.
2001-01-24 17:11:43 +00:00