Changeset 10 for python/trunk/Lib


Ignore:
Timestamp:
Sep 3, 2010, 5:33:06 PM (15 years ago)
Author:
Yuri Dario
Message:

python: merged offline changes.

Location:
python/trunk/Lib
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • python/trunk/Lib/bsddb/dbshelve.py

    r2 r10  
    1 #!/bin/env python
     1#!/usr/bin/env python
    22#------------------------------------------------------------------------
    33#           Copyright (c) 1997-2001 by Total Control Software
  • python/trunk/Lib/cgi.py

    r2 r10  
    1 #! /usr/local/bin/python
     1#!/usr/bin/python
    22
    33# NOTE: the above "/usr/local/bin/python" is NOT a mistake.  It is
  • python/trunk/Lib/distutils/ccompiler.py

    r2 r10  
    983983    # compiler
    984984    ('cygwin.*', 'unix'),
     985    ('os2knix', 'emx'),
    985986    ('os2emx', 'emx'),
    986987
  • python/trunk/Lib/distutils/command/bdist_rpm.py

    r2 r10  
    200200                  "--python and --fix-python are mutually exclusive options"
    201201
    202         if os.name != 'posix':
     202        if os.name != 'posix' and os.name != 'os2':
    203203            raise DistutilsPlatformError, \
    204204                  ("don't know how to create RPM "
     
    323323        rpm_cmd = ['rpm']
    324324        if os.path.exists('/usr/bin/rpmbuild') or \
     325           os.path.exists('/usr/bin/rpmbuild.exe') or \
    325326           os.path.exists('/bin/rpmbuild'):
    326327            rpm_cmd = ['rpmbuild']
     
    346347        q_cmd = r"rpm -q --qf '%s %s\n' --specfile '%s'" % (
    347348            src_rpm, non_src_rpm, spec_path)
     349        if os.name == 'os2':
     350            q_cmd = q_cmd.replace( '%{', '%%{')
    348351
    349352        out = os.popen(q_cmd)
  • python/trunk/Lib/distutils/command/install.py

    r2 r10  
    284284
    285285        # Next, stuff that's wrong (or dubious) only on certain platforms.
    286         if os.name != "posix":
     286        if os.name != "posix" and os.name != "os2":
    287287            if self.exec_prefix:
    288288                self.warn("exec-prefix option ignored on this platform")
     
    299299        self.dump_dirs("pre-finalize_{unix,other}")
    300300
    301         if os.name == 'posix':
     301        if os.name == 'posix' or os.name == "os2":
    302302            self.finalize_unix()
    303303        else:
  • python/trunk/Lib/distutils/emxccompiler.py

    r2 r10  
    6464        # Hard-code GCC because that's what this is all about.
    6565        # XXX optimization, warnings etc. should be customizable.
    66         self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
    67                              compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
    68                              linker_exe='gcc -Zomf -Zmt -Zcrtdll',
    69                              linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll')
     66        self.set_executables(compiler='gcc -g -O2 -march=i386 -mtune=i686 -fomit-frame-pointer -Wall',
     67                             compiler_so='gcc -g -O2 -march=i386 -mtune=i686 -fomit-frame-pointer -Wall',
     68                             linker_exe='gcc -Zomf -Zexe',
     69                             linker_so='gcc -Zomf -Zdll')
    7070
    7171        # want the gcc library statically linked (so that we don't have
     
    139139                "EXPORTS"]
    140140            for sym in export_symbols:
    141                 contents.append('  "%s"' % sym)
     141                contents.append('  "_%s"' % sym)
    142142            self.execute(write_file, (def_file, contents),
    143143                         "writing %s" % def_file)
     
    209209    # to deal with file naming/searching differences
    210210    def find_library_file(self, dirs, lib, debug=0):
    211         shortlib = '%s.lib' % lib
    212         longlib = 'lib%s.lib' % lib    # this form very rare
     211        try_names = [lib + ".lib", lib + ".a", "lib" + lib + ".lib", "lib" + lib + ".a"]
    213212
    214213        # get EMX's default library directory search path
     
    218217            emx_dirs = []
    219218
     219        #print "dirs:",dirs
    220220        for dir in dirs + emx_dirs:
    221             shortlibp = os.path.join(dir, shortlib)
    222             longlibp = os.path.join(dir, longlib)
    223             if os.path.exists(shortlibp):
    224                 return shortlibp
    225             elif os.path.exists(longlibp):
    226                 return longlibp
     221            for name in try_names:
     222                libfile = os.path.join(dir, name)
     223                #print "libfile:",libfile
     224                if os.path.exists(libfile):
     225                    return libfile
    227226
    228227        # Oops, didn't find it in *any* of 'dirs'
  • python/trunk/Lib/distutils/sysconfig.py

    r2 r10  
    9191            return os.path.join(prefix, "Include")
    9292    elif os.name == "os2":
    93         return os.path.join(prefix, "Include")
     93        if python_build:
     94            base = os.path.dirname(os.path.abspath(sys.executable))
     95            if plat_specific:
     96                inc_dir = base
     97            else:
     98                inc_dir = os.path.join(base, "Include")
     99                if not os.path.exists(inc_dir):
     100                    inc_dir = os.path.join(os.path.dirname(base), "Include")
     101            return inc_dir
     102        return os.path.join(prefix, "include", "python" + get_python_version())
    94103    else:
    95104        raise DistutilsPlatformError(
     
    145154
    146155    elif os.name == "os2":
     156        libpython = os.path.join(prefix,
     157                                 "lib", "python" + get_python_version())
    147158        if standard_lib:
    148             return os.path.join(prefix, "Lib")
    149         else:
    150             return os.path.join(prefix, "Lib", "site-packages")
     159            return libpython
     160        else:
     161            return os.path.join(libpython, "site-packages")
    151162
    152163    else:
     
    491502    """Initialize the module as appropriate for OS/2"""
    492503    g = {}
     504    # load the installed Makefile:
     505    try:
     506        filename = get_makefile_filename()
     507        parse_makefile(filename, g)
     508    except IOError, msg:
     509        my_msg = "invalid Python installation: unable to open %s" % filename
     510        if hasattr(msg, "strerror"):
     511            my_msg = my_msg + " (%s)" % msg.strerror
     512
     513        raise DistutilsPlatformError(my_msg)
     514
     515    # load the installed pyconfig.h:
     516    try:
     517        filename = get_config_h_filename()
     518        parse_config_h(file(filename), g)
     519    except IOError, msg:
     520        my_msg = "invalid Python installation: unable to open %s" % filename
     521        if hasattr(msg, "strerror"):
     522            my_msg = my_msg + " (%s)" % msg.strerror
     523
     524        raise DistutilsPlatformError(my_msg)
     525
     526    # On AIX, there are wrong paths to the linker scripts in the Makefile
     527    # -- these paths are relative to the Python source, but when installed
     528    # the scripts are in another directory.
     529    if python_build:
     530        g['LDSHARED'] = g['BLDSHARED']
     531
     532    # OS/2 module
     533
    493534    # set basic install directories
    494535    g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
  • python/trunk/Lib/distutils/unixccompiler.py

    r2 r10  
    140140    dylib_lib_extension = ".dylib"
    141141    static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s"
    142     if sys.platform == "cygwin":
     142    if sys.platform == "cygwin" or sys.platform == "os2emx" or sys.platform == "os2knix":
    143143        exe_extension = ".exe"
    144144
     
    284284        # we use this hack.
    285285        compiler = os.path.basename(sysconfig.get_config_var("CC"))
    286         if sys.platform[:6] == "darwin":
     286        if sys.platform[:6] == "darwin" or sys.platform[:7] == "os2knix":
    287287            # MacOSX's linker doesn't understand the -R flag at all
    288288            return "-L" + dir
  • python/trunk/Lib/os.py

    r2 r10  
    7575    except ImportError:
    7676        pass
    77     if sys.version.find('EMX GCC') == -1:
     77    if sys.platform == 'os2knix':
     78        import os2knixpath as path
     79    elif sys.version.find('EMX GCC') == -1:
    7880        import ntpath as path
    7981    else:
  • python/trunk/Lib/popen2.py

    r2 r10  
    135135
    136136
    137 if sys.platform[:3] == "win" or sys.platform == "os2emx":
     137if sys.platform[:3] == "win" or sys.platform == "os2emx" or sys.platform == "os2knix":
    138138    # Some things don't make sense on non-Unix platforms.
    139139    del Popen3, Popen4
  • python/trunk/Lib/site.py

    r2 r10  
    232232        return os.path.expanduser(os.path.join(*args))
    233233
    234     #if sys.platform in ('os2emx', 'riscos'):
     234    #if sys.platform in ('os2emx', 'os2knix', 'riscos'):
    235235    #    # Don't know what to put here
    236236    #    USER_BASE = ''
     
    263263        seen.append(prefix)
    264264
    265         if sys.platform in ('os2emx', 'riscos'):
     265        if sys.platform in ('os2emx', 'os2knix', 'riscos'):
    266266            sitedirs.append(os.path.join(prefix, "Lib", "site-packages"))
    267267        elif os.sep == '/':
     
    495495    known_paths = addusersitepackages(known_paths)
    496496    known_paths = addsitepackages(known_paths)
    497     if sys.platform == 'os2emx':
     497    if sys.platform == 'os2emx' or sys.platform == 'os2knix':
     498        if (sys.path and os.path.basename(sys.path[-1]) == "Modules"):
     499            addbuilddir()
    498500        setBEGINLIBPATH()
    499501    setquit()
  • python/trunk/Lib/tempfile.py

    r2 r10  
    388388    # the wrapper to do anything special.  We still use it so that
    389389    # file.name is useful (i.e. not "(fdopen)") with NamedTemporaryFile.
    390     if _os.name != 'nt':
     390    if _os.name != 'nt' and _os.name != 'os2':
    391391        # Cache the unlinker so we don't get spurious errors at
    392392        # shutdown when the module-level "os" is None'd out.  Note
     
    446446    return _TemporaryFileWrapper(file, name, delete)
    447447
    448 if _os.name != 'posix' or _os.sys.platform == 'cygwin':
     448if _os.name != 'posix' or _os.sys.platform == 'cygwin' or _os.sys.platform == 'os2emx' or _os.sys.platform == 'os2knix':
    449449    # On non-POSIX and Cygwin systems, assume that we cannot unlink a file
    450450    # while it is open.
  • python/trunk/Lib/test/regrtest.py

    r2 r10  
    10371037        test_signal
    10381038        """,
     1039    'os2knix':
     1040        """
     1041        test_al
     1042        test_applesingle
     1043        test_audioop
     1044        test_bsddb185
     1045        test_bsddb3
     1046        test_cd
     1047        test_cl
     1048        test_commands
     1049        test_dl
     1050        test_gl
     1051        test_imgfile
     1052        test_linuxaudiodev
     1053        test_mhlib
     1054        test_mmap
     1055        test_nis
     1056        test_openpty
     1057        test_ossaudiodev
     1058        test_pty
     1059        test_resource
     1060        test_sqlite
     1061        test_startfile
     1062        test_sunaudiodev
     1063        """,
    10391064    'freebsd4':
    10401065        """
  • python/trunk/Lib/test/test_tempfile.py

    r2 r10  
    260260        mode = stat.S_IMODE(os.stat(file.name).st_mode)
    261261        expected = 0600
    262         if sys.platform in ('win32', 'os2emx', 'mac'):
     262        if sys.platform in ('win32', 'os2emx', 'os2knix', 'mac'):
    263263            # There's no distinction among 'user', 'group' and 'world';
    264264            # replicate the 'user' bits.
     
    479479            mode &= 0777 # Mask off sticky bits inherited from /tmp
    480480            expected = 0700
    481             if sys.platform in ('win32', 'os2emx', 'mac'):
     481            if sys.platform in ('win32', 'os2emx', 'os2knix', 'mac'):
    482482                # There's no distinction among 'user', 'group' and 'world';
    483483                # replicate the 'user' bits.
  • python/trunk/Lib/test/test_unicodedata.py

    r2 r10  
    7272        # but the other test cases will still be run
    7373        import unicodedata
    74         self.db = unicodedata
    7574
    7675    def tearDown(self):
  • python/trunk/Lib/urllib2.py

    r2 r10  
    12751275        host = req.get_host()
    12761276        file = req.get_selector()
     1277
     1278        # YD hack: add again drive name
     1279        if os.name == 'os2' and len(host)>2 and host[1] == ':':
     1280            file = host + file
     1281            host = ""
     1282
    12771283        localfile = url2pathname(file)
    12781284        try:
Note: See TracChangeset for help on using the changeset viewer.