Fred Drake | 522af3a | 1999-01-06 16:28:34 +0000 | [diff] [blame] | 1 | """Provide access to Python's configuration information. The specific names |
| 2 | defined in the module depend heavily on the platform and configuration. |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 3 | |
| 4 | Written by: Fred L. Drake, Jr. |
| 5 | Email: <fdrake@acm.org> |
| 6 | Initial date: 17-Dec-1998 |
| 7 | """ |
| 8 | |
Greg Ward | 82d71ca | 2000-06-03 00:44:30 +0000 | [diff] [blame] | 9 | __revision__ = "$Id$" |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 10 | |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 11 | import os |
| 12 | import re |
| 13 | import string |
| 14 | import sys |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 15 | |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 16 | from errors import DistutilsPlatformError |
Greg Ward | a0ca3f2 | 2000-02-02 00:05:14 +0000 | [diff] [blame] | 17 | |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 18 | |
Greg Ward | cf6bea3 | 2000-04-10 01:15:06 +0000 | [diff] [blame] | 19 | PREFIX = os.path.normpath(sys.prefix) |
| 20 | EXEC_PREFIX = os.path.normpath(sys.exec_prefix) |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 21 | |
| 22 | |
Greg Ward | d38e6f7 | 2000-04-10 01:17:49 +0000 | [diff] [blame] | 23 | def get_python_inc(plat_specific=0, prefix=None): |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 24 | """Return the directory containing installed Python header files. |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 25 | |
| 26 | If 'plat_specific' is false (the default), this is the path to the |
| 27 | non-platform-specific header files, i.e. Python.h and so on; |
| 28 | otherwise, this is the path to platform-specific header files |
| 29 | (namely config.h). |
| 30 | |
Greg Ward | d38e6f7 | 2000-04-10 01:17:49 +0000 | [diff] [blame] | 31 | If 'prefix' is supplied, use it instead of sys.prefix or |
| 32 | sys.exec_prefix -- i.e., ignore 'plat_specific'. |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 33 | """ |
Greg Ward | d38e6f7 | 2000-04-10 01:17:49 +0000 | [diff] [blame] | 34 | if prefix is None: |
| 35 | prefix = (plat_specific and EXEC_PREFIX or PREFIX) |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 36 | if os.name == "posix": |
Greg Ward | cf6bea3 | 2000-04-10 01:15:06 +0000 | [diff] [blame] | 37 | return os.path.join(prefix, "include", "python" + sys.version[:3]) |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 38 | elif os.name == "nt": |
Greg Ward | cf6bea3 | 2000-04-10 01:15:06 +0000 | [diff] [blame] | 39 | return os.path.join(prefix, "Include") # include or Include? |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 40 | elif os.name == "mac": |
Greg Ward | cf6bea3 | 2000-04-10 01:15:06 +0000 | [diff] [blame] | 41 | return os.path.join(prefix, "Include") |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 42 | else: |
| 43 | raise DistutilsPlatformError, \ |
| 44 | ("I don't know where Python installs its C header files " + |
| 45 | "on platform '%s'") % os.name |
| 46 | |
| 47 | |
Greg Ward | d38e6f7 | 2000-04-10 01:17:49 +0000 | [diff] [blame] | 48 | def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 49 | """Return the directory containing the Python library (standard or |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 50 | site additions). |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 51 | |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 52 | If 'plat_specific' is true, return the directory containing |
| 53 | platform-specific modules, i.e. any module from a non-pure-Python |
| 54 | module distribution; otherwise, return the platform-shared library |
| 55 | directory. If 'standard_lib' is true, return the directory |
| 56 | containing standard Python library modules; otherwise, return the |
| 57 | directory for site-specific modules. |
| 58 | |
Greg Ward | d38e6f7 | 2000-04-10 01:17:49 +0000 | [diff] [blame] | 59 | If 'prefix' is supplied, use it instead of sys.prefix or |
| 60 | sys.exec_prefix -- i.e., ignore 'plat_specific'. |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 61 | """ |
Greg Ward | d38e6f7 | 2000-04-10 01:17:49 +0000 | [diff] [blame] | 62 | if prefix is None: |
| 63 | prefix = (plat_specific and EXEC_PREFIX or PREFIX) |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 64 | |
| 65 | if os.name == "posix": |
Greg Ward | cf6bea3 | 2000-04-10 01:15:06 +0000 | [diff] [blame] | 66 | libpython = os.path.join(prefix, |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 67 | "lib", "python" + sys.version[:3]) |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 68 | if standard_lib: |
| 69 | return libpython |
| 70 | else: |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 71 | return os.path.join(libpython, "site-packages") |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 72 | |
| 73 | elif os.name == "nt": |
| 74 | if standard_lib: |
Greg Ward | cf6bea3 | 2000-04-10 01:15:06 +0000 | [diff] [blame] | 75 | return os.path.join(PREFIX, "Lib") |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 76 | else: |
Greg Ward | cf6bea3 | 2000-04-10 01:15:06 +0000 | [diff] [blame] | 77 | return prefix |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 78 | |
| 79 | elif os.name == "mac": |
Greg Ward | dc9fe8a | 2000-08-02 01:49:40 +0000 | [diff] [blame] | 80 | if plat_specific: |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 81 | if standard_lib: |
Greg Ward | cf6bea3 | 2000-04-10 01:15:06 +0000 | [diff] [blame] | 82 | return os.path.join(EXEC_PREFIX, "Mac", "Plugins") |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 83 | else: |
| 84 | raise DistutilsPlatformError, \ |
| 85 | "OK, where DO site-specific extensions go on the Mac?" |
| 86 | else: |
| 87 | if standard_lib: |
Greg Ward | cf6bea3 | 2000-04-10 01:15:06 +0000 | [diff] [blame] | 88 | return os.path.join(PREFIX, "Lib") |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 89 | else: |
| 90 | raise DistutilsPlatformError, \ |
| 91 | "OK, where DO site-specific modules go on the Mac?" |
| 92 | else: |
| 93 | raise DistutilsPlatformError, \ |
| 94 | ("I don't know where Python installs its library " + |
| 95 | "on platform '%s'") % os.name |
| 96 | |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 97 | # get_python_lib() |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 98 | |
| 99 | |
Greg Ward | bb7baa7 | 2000-06-25 02:09:14 +0000 | [diff] [blame] | 100 | def customize_compiler (compiler): |
| 101 | """Do any platform-specific customization of the CCompiler instance |
| 102 | 'compiler'. Mainly needed on Unix, so we can plug in the information |
| 103 | that varies across Unices and is stored in Python's Makefile. |
| 104 | """ |
| 105 | if compiler.compiler_type == "unix": |
| 106 | cc_cmd = CC + ' ' + OPT |
| 107 | compiler.set_executables( |
| 108 | preprocessor=CC + " -E", # not always! |
| 109 | compiler=cc_cmd, |
| 110 | compiler_so=cc_cmd + ' ' + CCSHARED, |
| 111 | linker_so=LDSHARED, |
| 112 | linker_exe=CC) |
| 113 | |
| 114 | compiler.shared_lib_extension = SO |
| 115 | |
| 116 | |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 117 | def get_config_h_filename(): |
Fred Drake | 522af3a | 1999-01-06 16:28:34 +0000 | [diff] [blame] | 118 | """Return full pathname of installed config.h file.""" |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 119 | inc_dir = get_python_inc(plat_specific=1) |
| 120 | return os.path.join(inc_dir, "config.h") |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 121 | |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 122 | |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 123 | def get_makefile_filename(): |
Fred Drake | 522af3a | 1999-01-06 16:28:34 +0000 | [diff] [blame] | 124 | """Return full pathname of installed Makefile from the Python build.""" |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 125 | lib_dir = get_python_lib(plat_specific=1, standard_lib=1) |
| 126 | return os.path.join(lib_dir, "config", "Makefile") |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 127 | |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 128 | |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 129 | def parse_config_h(fp, g=None): |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 130 | """Parse a config.h-style file. |
| 131 | |
| 132 | A dictionary containing name/value pairs is returned. If an |
| 133 | optional dictionary is passed in as the second argument, it is |
| 134 | used instead of a new dictionary. |
Fred Drake | 522af3a | 1999-01-06 16:28:34 +0000 | [diff] [blame] | 135 | """ |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 136 | if g is None: |
| 137 | g = {} |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 138 | define_rx = re.compile("#define ([A-Z][A-Z0-9_]+) (.*)\n") |
| 139 | undef_rx = re.compile("/[*] #undef ([A-Z][A-Z0-9_]+) [*]/\n") |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 140 | # |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 141 | while 1: |
| 142 | line = fp.readline() |
| 143 | if not line: |
| 144 | break |
| 145 | m = define_rx.match(line) |
| 146 | if m: |
| 147 | n, v = m.group(1, 2) |
Greg Ward | 3c8e54b | 1998-12-22 12:42:04 +0000 | [diff] [blame] | 148 | try: v = string.atoi(v) |
| 149 | except ValueError: pass |
| 150 | g[n] = v |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 151 | else: |
| 152 | m = undef_rx.match(line) |
| 153 | if m: |
| 154 | g[m.group(1)] = 0 |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 155 | return g |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 156 | |
Greg Ward | 3fff8d2 | 2000-09-15 00:03:13 +0000 | [diff] [blame^] | 157 | def parse_makefile(fn, g=None): |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 158 | """Parse a Makefile-style file. |
| 159 | |
| 160 | A dictionary containing name/value pairs is returned. If an |
| 161 | optional dictionary is passed in as the second argument, it is |
| 162 | used instead of a new dictionary. |
| 163 | |
Fred Drake | 522af3a | 1999-01-06 16:28:34 +0000 | [diff] [blame] | 164 | """ |
Greg Ward | 3fff8d2 | 2000-09-15 00:03:13 +0000 | [diff] [blame^] | 165 | from distutils.text_file import TextFile |
| 166 | fp = TextFile(fn, strip_comments=1, join_lines=1) |
| 167 | |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 168 | if g is None: |
| 169 | g = {} |
Greg Ward | 3fff8d2 | 2000-09-15 00:03:13 +0000 | [diff] [blame^] | 170 | variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)") |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 171 | done = {} |
| 172 | notdone = {} |
Greg Ward | 3fff8d2 | 2000-09-15 00:03:13 +0000 | [diff] [blame^] | 173 | |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 174 | while 1: |
| 175 | line = fp.readline() |
Greg Ward | 3fff8d2 | 2000-09-15 00:03:13 +0000 | [diff] [blame^] | 176 | if line is None: |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 177 | break |
| 178 | m = variable_rx.match(line) |
| 179 | if m: |
| 180 | n, v = m.group(1, 2) |
Greg Ward | 3c8e54b | 1998-12-22 12:42:04 +0000 | [diff] [blame] | 181 | v = string.strip(v) |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 182 | if "$" in v: |
| 183 | notdone[n] = v |
| 184 | else: |
Greg Ward | 3c8e54b | 1998-12-22 12:42:04 +0000 | [diff] [blame] | 185 | try: v = string.atoi(v) |
| 186 | except ValueError: pass |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 187 | done[n] = v |
| 188 | |
| 189 | # do variable interpolation here |
| 190 | findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)") |
| 191 | findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}") |
| 192 | while notdone: |
| 193 | for name in notdone.keys(): |
| 194 | value = notdone[name] |
| 195 | m = findvar1_rx.search(value) |
| 196 | if not m: |
| 197 | m = findvar2_rx.search(value) |
| 198 | if m: |
| 199 | n = m.group(1) |
| 200 | if done.has_key(n): |
| 201 | after = value[m.end():] |
| 202 | value = value[:m.start()] + done[n] + after |
| 203 | if "$" in after: |
| 204 | notdone[name] = value |
| 205 | else: |
Greg Ward | 3c8e54b | 1998-12-22 12:42:04 +0000 | [diff] [blame] | 206 | try: value = string.atoi(value) |
| 207 | except ValueError: pass |
| 208 | done[name] = string.strip(value) |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 209 | del notdone[name] |
| 210 | elif notdone.has_key(n): |
| 211 | # get it on a subsequent round |
| 212 | pass |
| 213 | else: |
| 214 | done[n] = "" |
| 215 | after = value[m.end():] |
| 216 | value = value[:m.start()] + after |
| 217 | if "$" in after: |
| 218 | notdone[name] = value |
| 219 | else: |
Greg Ward | 3c8e54b | 1998-12-22 12:42:04 +0000 | [diff] [blame] | 220 | try: value = string.atoi(value) |
| 221 | except ValueError: pass |
| 222 | done[name] = string.strip(value) |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 223 | del notdone[name] |
| 224 | else: |
Greg Ward | 3c8e54b | 1998-12-22 12:42:04 +0000 | [diff] [blame] | 225 | # bogus variable reference; just drop it since we can't deal |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 226 | del notdone[name] |
| 227 | |
| 228 | # save the results in the global dictionary |
| 229 | g.update(done) |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 230 | return g |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 231 | |
| 232 | |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 233 | def _init_posix(): |
Fred Drake | 522af3a | 1999-01-06 16:28:34 +0000 | [diff] [blame] | 234 | """Initialize the module as appropriate for POSIX systems.""" |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 235 | g = globals() |
Greg Ward | a0ca3f2 | 2000-02-02 00:05:14 +0000 | [diff] [blame] | 236 | # load the installed Makefile: |
Greg Ward | a570c05 | 2000-05-23 23:14:00 +0000 | [diff] [blame] | 237 | try: |
| 238 | filename = get_makefile_filename() |
Greg Ward | 3fff8d2 | 2000-09-15 00:03:13 +0000 | [diff] [blame^] | 239 | parse_makefile(filename, g) |
Greg Ward | a570c05 | 2000-05-23 23:14:00 +0000 | [diff] [blame] | 240 | except IOError, msg: |
| 241 | my_msg = "invalid Python installation: unable to open %s" % filename |
| 242 | if hasattr(msg, "strerror"): |
| 243 | my_msg = my_msg + " (%s)" % msg.strerror |
| 244 | |
| 245 | raise DistutilsPlatformError, my_msg |
| 246 | |
Greg Ward | 4f88028 | 2000-06-27 01:59:06 +0000 | [diff] [blame] | 247 | |
| 248 | # On AIX, there are wrong paths to the linker scripts in the Makefile |
| 249 | # -- these paths are relative to the Python source, but when installed |
| 250 | # the scripts are in another directory. |
Greg Ward | b231e1a | 2000-06-27 01:59:43 +0000 | [diff] [blame] | 251 | if sys.platform == 'aix4': # what about AIX 3.x ? |
Greg Ward | 4f88028 | 2000-06-27 01:59:06 +0000 | [diff] [blame] | 252 | # Linker script is in the config directory, not in Modules as the |
| 253 | # Makefile says. |
| 254 | python_lib = get_python_lib(standard_lib=1) |
| 255 | ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') |
| 256 | python_exp = os.path.join(python_lib, 'config', 'python.exp') |
| 257 | |
| 258 | g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp) |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 259 | |
Greg Ward | 66e966f | 2000-09-01 01:23:26 +0000 | [diff] [blame] | 260 | if sys.platform == 'beos': |
| 261 | |
| 262 | # Linker script is in the config directory. In the Makefile it is |
| 263 | # relative to the srcdir, which after installation no longer makes |
| 264 | # sense. |
| 265 | python_lib = get_python_lib(standard_lib=1) |
| 266 | linkerscript_name = os.path.basename(string.split(g['LDSHARED'])[0]) |
| 267 | linkerscript = os.path.join(python_lib, 'config', linkerscript_name) |
| 268 | |
| 269 | # XXX this isn't the right place to do this: adding the Python |
| 270 | # library to the link, if needed, should be in the "build_ext" |
| 271 | # command. (It's also needed for non-MS compilers on Windows, and |
| 272 | # it's taken care of for them by the 'build_ext.get_libraries()' |
| 273 | # method.) |
| 274 | g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % |
| 275 | (linkerscript, sys.prefix, sys.version[0:3])) |
| 276 | |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 277 | |
Greg Ward | 4d74d73 | 1999-06-08 01:58:36 +0000 | [diff] [blame] | 278 | def _init_nt(): |
| 279 | """Initialize the module as appropriate for NT""" |
Fred Drake | 69e2c6e | 2000-02-08 15:55:42 +0000 | [diff] [blame] | 280 | g = globals() |
Greg Ward | 4d74d73 | 1999-06-08 01:58:36 +0000 | [diff] [blame] | 281 | # set basic install directories |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 282 | g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1) |
| 283 | g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1) |
Greg Ward | 4d74d73 | 1999-06-08 01:58:36 +0000 | [diff] [blame] | 284 | |
Greg Ward | 32162e8 | 1999-08-29 18:22:13 +0000 | [diff] [blame] | 285 | # XXX hmmm.. a normal install puts include files here |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 286 | g['INCLUDEPY'] = get_python_inc(plat_specific=0) |
Greg Ward | 32162e8 | 1999-08-29 18:22:13 +0000 | [diff] [blame] | 287 | |
Fred Drake | 69e2c6e | 2000-02-08 15:55:42 +0000 | [diff] [blame] | 288 | g['SO'] = '.pyd' |
Greg Ward | 82d71ca | 2000-06-03 00:44:30 +0000 | [diff] [blame] | 289 | g['EXE'] = ".exe" |
Greg Ward | 1d526dd | 2000-08-02 01:09:11 +0000 | [diff] [blame] | 290 | g['exec_prefix'] = EXEC_PREFIX |
Greg Ward | 82d71ca | 2000-06-03 00:44:30 +0000 | [diff] [blame] | 291 | |
Fred Drake | 69e2c6e | 2000-02-08 15:55:42 +0000 | [diff] [blame] | 292 | |
Greg Ward | 0eff87a | 2000-03-07 03:30:09 +0000 | [diff] [blame] | 293 | def _init_mac(): |
| 294 | """Initialize the module as appropriate for Macintosh systems""" |
| 295 | g = globals() |
Greg Ward | 0eff87a | 2000-03-07 03:30:09 +0000 | [diff] [blame] | 296 | # set basic install directories |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 297 | g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1) |
| 298 | g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1) |
Greg Ward | 0eff87a | 2000-03-07 03:30:09 +0000 | [diff] [blame] | 299 | |
| 300 | # XXX hmmm.. a normal install puts include files here |
Fred Drake | c1ee39a | 2000-03-09 15:54:52 +0000 | [diff] [blame] | 301 | g['INCLUDEPY'] = get_python_inc(plat_specific=0) |
Greg Ward | 0eff87a | 2000-03-07 03:30:09 +0000 | [diff] [blame] | 302 | |
| 303 | g['SO'] = '.ppc.slb' |
Greg Ward | cf6bea3 | 2000-04-10 01:15:06 +0000 | [diff] [blame] | 304 | g['exec_prefix'] = EXEC_PREFIX |
| 305 | print sys.prefix, PREFIX |
Greg Ward | 7d73b9e | 2000-03-09 03:16:05 +0000 | [diff] [blame] | 306 | |
| 307 | # XXX are these used anywhere? |
Greg Ward | cf6bea3 | 2000-04-10 01:15:06 +0000 | [diff] [blame] | 308 | g['install_lib'] = os.path.join(EXEC_PREFIX, "Lib") |
| 309 | g['install_platlib'] = os.path.join(EXEC_PREFIX, "Mac", "Lib") |
Greg Ward | 0eff87a | 2000-03-07 03:30:09 +0000 | [diff] [blame] | 310 | |
| 311 | |
Greg Ward | 9ddaaa1 | 1999-01-06 14:46:06 +0000 | [diff] [blame] | 312 | try: |
| 313 | exec "_init_" + os.name |
| 314 | except NameError: |
| 315 | # not needed for this platform |
| 316 | pass |
| 317 | else: |
| 318 | exec "_init_%s()" % os.name |
| 319 | |
Fred Drake | 69e2c6e | 2000-02-08 15:55:42 +0000 | [diff] [blame] | 320 | |
Greg Ward | 1190ee3 | 1998-12-18 23:46:33 +0000 | [diff] [blame] | 321 | del _init_posix |
Greg Ward | 4d74d73 | 1999-06-08 01:58:36 +0000 | [diff] [blame] | 322 | del _init_nt |
Greg Ward | 0eff87a | 2000-03-07 03:30:09 +0000 | [diff] [blame] | 323 | del _init_mac |