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

python: merged offline changes.

Location:
python/trunk/Lib/distutils
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.