[Patches] [ python-Patches-450710 ] 2.2a1 Bug fixes and UnixWare 7 port

noreply@sourceforge.net noreply@sourceforge.net
Thu, 16 Aug 2001 22:23:39 -0700


Patches item #450710, was opened at 2001-08-13 23:10
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=450710&group_id=5470

Category: Build
Group: None
Status: Open
Resolution: Out of Date
Priority: 5
Submitted By: Billy G. Allie (ballie01)
Assigned to: Nobody/Anonymous (nobody)
Summary: 2.2a1 Bug fixes and UnixWare 7 port

Initial Comment:
The attached patches fixes the followin problems and 
updates the UnixWare 7.0
port as follows:

Problems:
---------

1.  The code to build the readline module in setup.py
did not work if the
    termcap library did not exist in /usr/lib/termcap. 
It will now search
    for the curses libarary or the termcap library and
used the first one
    found.

2.  The code in distutils/ccompiler.py makes an invalid
assumption about the
    runtime libraries -- it assumes that each runtime
library generates a
    seperate command line arguement, the same as the
library_dirs element does.
    That choice is best made by the particular compiler
implementation.  The
    changed code now passes the entire list to
runtime_library_dir_option(),
    where the decision of how to process the list is
best made.

3.  The code for runtime_library_dir_option() in
distutils/unixccompiler.py
    was changed to accept a list of directories instead
of a string.  It now
    returns a single option string in the form
'-Rdir1:dir2:dir2...' instead
    of multiple options (i.e. '-Rdir1 -Rdir2 -Rdir3
...').

4.  In the socket module, accept() would return an
error if the accept()
    call was interrupted.  The code was changed so that
the accept call is
    made again if the accept() failed because it was
interrupted.

UnixWare 7 specific changes:
----------------------------
1.  LD_RUN_PATH no longer needs to be set.  -R is used
supply the executable
    and dynamically loaded modules with the runtime
directory search path.
    Both configure.in and setup.py now set the
appropiate -R options when
    building.

2.  -Kpthread is used instead of -Kthread.

3.  Code was added to work around two know bugs in SCO
UnixWare 7:
    a) A bug in accept() does not set the sa_family
value correctly for the
       AF_UNIX family.
    b) atan2() does returns pi instead of zero for
atan2(0, x).

    This code is enabled by defining SCO_ACCEPT_BUG and
SCO_ATAN2_BUG.

4.  The python library is still built as a shared
library.

When building on UnixWare, it now only necessary to add
a period (.) to
the LD_LIBRARY_PATH environment variable.  This is only
necessary when
building Python so that the shared library
(libpythonX.Y.so) is found
during the './python setup.py build' phase.  Once
python is installed, it
does not require LD_RUN_PATH or LD_LIBRARY_PATH to be
set.

NOTE:  If item #2 and #3 in the Problems section are
not implemented, do
       not apply the any of UnixWare specific changes
in setup.py as those
       change depend on the changes to ccompiler.py and
unixccompiler.py.


----------------------------------------------------------------------

>Comment By: Billy G. Allie (ballie01)
Date: 2001-08-16 22:23

Message:
Logged In: YES 
user_id=8500

The attached patch (uw7-20011018.patch) makes the following
changes:

configure.in:
-------------
1.  Updates $OPT for the UnixWare port to define the macros
that controls
    the conditional compilation of code to work around
UnixWare's known
    bugs.  The macros are SCO_ACCEPT_BUG and SCO_ATAN2_BUG.

Note:   I did not modify configure to generate a shared
Python library
        pending discussion on how to best allow for the user
to tell
        configure which type of library to generate.  I did,
however,
        modify setup.py and some of the distutil modules to
generate (if
        needed) the option needed to add runtime library
search paths to
        any loadable modules that uses third party shared
libraries (in my
        case, ssl, tcl, tk, and readline).  I believe that
the modification
        I made will not break anything, but I do not have
all the possible
        systems available to me so I can test that.

setup.py:
---------
1.  Changed the function, find_library_file, to return a
tuple containing
    two (2) lists.  The first (possibly empty) list
containing the
    directory where the library is located.  The second
(possibly empty)
    list contains the directories that will have to be added
to the runtime
    directory search list, runtime_library_dirs.  The second
list can only
    have an item when the located library is a shared
library.

2.  Change the code where find_library_file was called to
handle the new
    return value and to set runtime_library_dirs as
appropriate.

3.  Added '/usr/ccs/lib' to the lib_dirs variable.  This
directory is common
    on System V operating systems (UnixWare, Solaris, etc.)

4.  Changed the readline build so that termcap does not have
to exist in
    /usr/local/termcap, and to use the curses or terminfo
libraries if
    available.

Lib/distutils/ccompiler.py:
---------------------------
1.  Changed runtime_library_dir_option() so that the default
implementation
    is to return an empty list instead of raising the not
implemented
    exception.  The reason for this change is that it is
possible that
    runtime_library_dirs can contain a non-empty list of
directories to
    search even if there is no need to specify a runtime
directory search
    path.  For example, on Linux the default compiler does
not use any
    options to set the runtime directory search path.  It is
handled by an
    external file (ld.so.conf).  In this manner, systems
that need to
    specify a runtime directory search path can do so using
the value in
    runtime_library_dirs, while other systems that don't can
just ignore
    the runtime_library_dirs, and return an empty list from
    runtime_library_dir_option().

2.  Added a new compiler, USLCCompiler.  This module is a
sub-class of the
    UnixCCompiler.  This module supports Unix System Labs
style compilers
    common on System V Unix.  It basically implements the
required
    generation of the -R option for setting the runtime
directory search
    path.

3.  Changed how runtime_library_dir_option() is called.  It
now is passed a
    list of directories and returns a list of options.  This
was done so
    that the decision of how to implement the runtime
directory search
    option.  The previous code assumed that generating
multiple -R options,
    one per directory was correct.  This assumption is false
for at least
    the UnixWare system which wants only one (1) -R option
followed by a
    colon separated list of directories to search.  This
change lets the
    compiler decide, which is where the decision should
reside.

Lib/distutils/mvccompiler.py:
-----------------------------
1.  Removed it's implementation of
runtime_library__dir_option() so that
    the CCompiler implementation will be used (i.e. an empty
list is
    returned).

Lib/distutils/mwerkscompiler.py:
--------------------------------
1.  Changed code so that having a non-empty
runtime_library_dirs list
    prints a warning instead of raising an exception.

Lib/distutils/unixccompiler.py:
-------------------------------
1.  Removed it's implementation of
runtime_library_dir_option() so that an
    empty list is returned (via
CCompiler.runtime_library_dir_option()) if
    it is called.

Lib/distutils/uslccompiler.py:
------------------------------
This is a new file.  It provides support for Unix System
Labs style
compilers usually found on System V Unix.

Note:   I believe that Solaris systems using Sun's compiler
will have to use
=====   the USLCCompiler class.  Unfortunately, I no longer
have access to a
        Solaris system on which I can test that belief.

Modules/_cursesmodule.c:
------------------------
1.  Added code to set STRICT_SYSV_CURSES for UnixWare
systems.

Modules/addrinfo.h:
-------------------
1.  Removed the enclosing "#ifndef HAVE_GETADDRINFO ...
#endif".  This
    caused problems on systems that have getaddreinfo() but
still needed to
    have struct sockaddr_storage defined (i.e. UnixWare). 
This does not
    cause a problem because everything else in the file has
it's own
    individual "#ifndef ... #endif" wrapper.

Modules/cmathmodule.c:
Modules/mathmodule.c:
Objects/complexobject.c:
------------------------
1.  Added code to work around the UnixWare atan2() bug. 
This code will
    only be compiled in if the macro, SCO_ATAN2_BUG, is
defined.

Modules/socketmodule.c
----------------------
1.  Added code to work around the UnixWare accept() bug. 
This code will
    only be compiled in if the macro, SCO_ACCEPT_BUG is
defined.

2.  Changed code so that accept() call will be re-started if
accept fails
    because the system call was interrupted.


----------------------------------------------------------------------

Comment By: Billy G. Allie (ballie01)
Date: 2001-08-14 09:43

Message:
Logged In: YES 
user_id=8500

I will obtain the latest CVS files and re-make the patches.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-08-14 07:15

Message:
Logged In: YES 
user_id=21627

Both the configure.in and the mathmodule patch fail to
apply, since the code has significantly changed since 2.2a1.
In particular, libpython is not build as a shared library
anymore on Unixware, so the addition of -R does not apply
anymore.

Of the remaining changes, I think the setup.py changes that
specifically mention unixware7 should not be applied.
Instead, it should be researched whether there is a larger
class of operating systems that could make use of such
changes.

Please indicate whether you want to provide an updated
patch. If so, I'd strongly advise to have it operate against
the current CVS; waiting for 2.2a2 might result in the patch
not being available early enough before the release.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=450710&group_id=5470