##// END OF EJS Templates
setup: don't fail when Python doesn't have the cygwinccompiler package...
Ludovic Chabant -
r23677:6bc1702e default
parent child Browse files
Show More
@@ -1,637 +1,646 b''
1 1 #
2 2 # This is the mercurial setup script.
3 3 #
4 4 # 'python setup.py install', or
5 5 # 'python setup.py --help' for more options
6 6
7 7 import sys, platform
8 8 if getattr(sys, 'version_info', (0, 0, 0)) < (2, 4, 0, 'final'):
9 9 raise SystemExit("Mercurial requires Python 2.4 or later.")
10 10
11 11 if sys.version_info[0] >= 3:
12 12 def b(s):
13 13 '''A helper function to emulate 2.6+ bytes literals using string
14 14 literals.'''
15 15 return s.encode('latin1')
16 16 printf = eval('print')
17 17 libdir_escape = 'unicode_escape'
18 18 else:
19 19 libdir_escape = 'string_escape'
20 20 def b(s):
21 21 '''A helper function to emulate 2.6+ bytes literals using string
22 22 literals.'''
23 23 return s
24 24 def printf(*args, **kwargs):
25 25 f = kwargs.get('file', sys.stdout)
26 26 end = kwargs.get('end', '\n')
27 27 f.write(b(' ').join(args) + end)
28 28
29 29 # Solaris Python packaging brain damage
30 30 try:
31 31 import hashlib
32 32 sha = hashlib.sha1()
33 33 except ImportError:
34 34 try:
35 35 import sha
36 36 sha.sha # silence unused import warning
37 37 except ImportError:
38 38 raise SystemExit(
39 39 "Couldn't import standard hashlib (incomplete Python install).")
40 40
41 41 try:
42 42 import zlib
43 43 zlib.compressobj # silence unused import warning
44 44 except ImportError:
45 45 raise SystemExit(
46 46 "Couldn't import standard zlib (incomplete Python install).")
47 47
48 48 # The base IronPython distribution (as of 2.7.1) doesn't support bz2
49 49 isironpython = False
50 50 try:
51 51 isironpython = (platform.python_implementation()
52 52 .lower().find("ironpython") != -1)
53 53 except AttributeError:
54 54 pass
55 55
56 56 if isironpython:
57 57 sys.stderr.write("warning: IronPython detected (no bz2 support)\n")
58 58 else:
59 59 try:
60 60 import bz2
61 61 bz2.BZ2Compressor # silence unused import warning
62 62 except ImportError:
63 63 raise SystemExit(
64 64 "Couldn't import standard bz2 (incomplete Python install).")
65 65
66 66 import os, stat, subprocess, time
67 67 import re
68 68 import shutil
69 69 import tempfile
70 70 from distutils import log
71 71 from distutils.core import setup, Command, Extension
72 72 from distutils.dist import Distribution
73 73 from distutils.command.build import build
74 74 from distutils.command.build_ext import build_ext
75 75 from distutils.command.build_py import build_py
76 76 from distutils.command.install_lib import install_lib
77 77 from distutils.command.install_scripts import install_scripts
78 78 from distutils.spawn import spawn, find_executable
79 from distutils import cygwinccompiler, file_util
79 from distutils import file_util
80 80 from distutils.errors import CCompilerError, DistutilsExecError
81 81 from distutils.sysconfig import get_python_inc, get_config_var
82 82 from distutils.version import StrictVersion
83 83
84 84 convert2to3 = '--c2to3' in sys.argv
85 85 if convert2to3:
86 86 try:
87 87 from distutils.command.build_py import build_py_2to3 as build_py
88 88 from lib2to3.refactor import get_fixers_from_package as getfixers
89 89 except ImportError:
90 90 if sys.version_info[0] < 3:
91 91 raise SystemExit("--c2to3 is only compatible with python3.")
92 92 raise
93 93 sys.path.append('contrib')
94 94 elif sys.version_info[0] >= 3:
95 95 raise SystemExit("setup.py with python3 needs --c2to3 (experimental)")
96 96
97 97 scripts = ['hg']
98 98 if os.name == 'nt':
99 99 scripts.append('contrib/win32/hg.bat')
100 100
101 101 # simplified version of distutils.ccompiler.CCompiler.has_function
102 102 # that actually removes its temporary files.
103 103 def hasfunction(cc, funcname):
104 104 tmpdir = tempfile.mkdtemp(prefix='hg-install-')
105 105 devnull = oldstderr = None
106 106 try:
107 107 try:
108 108 fname = os.path.join(tmpdir, 'funcname.c')
109 109 f = open(fname, 'w')
110 110 f.write('int main(void) {\n')
111 111 f.write(' %s();\n' % funcname)
112 112 f.write('}\n')
113 113 f.close()
114 114 # Redirect stderr to /dev/null to hide any error messages
115 115 # from the compiler.
116 116 # This will have to be changed if we ever have to check
117 117 # for a function on Windows.
118 118 devnull = open('/dev/null', 'w')
119 119 oldstderr = os.dup(sys.stderr.fileno())
120 120 os.dup2(devnull.fileno(), sys.stderr.fileno())
121 121 objects = cc.compile([fname], output_dir=tmpdir)
122 122 cc.link_executable(objects, os.path.join(tmpdir, "a.out"))
123 123 except Exception:
124 124 return False
125 125 return True
126 126 finally:
127 127 if oldstderr is not None:
128 128 os.dup2(oldstderr, sys.stderr.fileno())
129 129 if devnull is not None:
130 130 devnull.close()
131 131 shutil.rmtree(tmpdir)
132 132
133 133 # py2exe needs to be installed to work
134 134 try:
135 135 import py2exe
136 136 py2exe.Distribution # silence unused import warning
137 137 py2exeloaded = True
138 138 # import py2exe's patched Distribution class
139 139 from distutils.core import Distribution
140 140 except ImportError:
141 141 py2exeloaded = False
142 142
143 143 def runcmd(cmd, env):
144 144 if (sys.platform == 'plan9'
145 145 and (sys.version_info[0] == 2 and sys.version_info[1] < 7)):
146 146 # subprocess kludge to work around issues in half-baked Python
147 147 # ports, notably bichued/python:
148 148 _, out, err = os.popen3(cmd)
149 149 return str(out), str(err)
150 150 else:
151 151 p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
152 152 stderr=subprocess.PIPE, env=env)
153 153 out, err = p.communicate()
154 154 return out, err
155 155
156 156 def runhg(cmd, env):
157 157 out, err = runcmd(cmd, env)
158 158 # If root is executing setup.py, but the repository is owned by
159 159 # another user (as in "sudo python setup.py install") we will get
160 160 # trust warnings since the .hg/hgrc file is untrusted. That is
161 161 # fine, we don't want to load it anyway. Python may warn about
162 162 # a missing __init__.py in mercurial/locale, we also ignore that.
163 163 err = [e for e in err.splitlines()
164 164 if not e.startswith(b('not trusting file')) \
165 165 and not e.startswith(b('warning: Not importing')) \
166 166 and not e.startswith(b('obsolete feature not enabled'))]
167 167 if err:
168 168 printf("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr)
169 169 printf(b('\n').join([b(' ') + e for e in err]), file=sys.stderr)
170 170 return ''
171 171 return out
172 172
173 173 version = ''
174 174
175 175 # Execute hg out of this directory with a custom environment which
176 176 # includes the pure Python modules in mercurial/pure. We also take
177 177 # care to not use any hgrc files and do no localization.
178 178 pypath = ['mercurial', os.path.join('mercurial', 'pure')]
179 179 env = {'PYTHONPATH': os.pathsep.join(pypath),
180 180 'HGRCPATH': '',
181 181 'LANGUAGE': 'C'}
182 182 if 'LD_LIBRARY_PATH' in os.environ:
183 183 env['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']
184 184 if 'SystemRoot' in os.environ:
185 185 # Copy SystemRoot into the custom environment for Python 2.6
186 186 # under Windows. Otherwise, the subprocess will fail with
187 187 # error 0xc0150004. See: http://bugs.python.org/issue3440
188 188 env['SystemRoot'] = os.environ['SystemRoot']
189 189
190 190 if os.path.isdir('.hg'):
191 191 cmd = [sys.executable, 'hg', 'log', '-r', '.', '--template', '{tags}\n']
192 192 numerictags = [t for t in runhg(cmd, env).split() if t[0].isdigit()]
193 193 hgid = runhg([sys.executable, 'hg', 'id', '-i'], env).strip()
194 194 if numerictags: # tag(s) found
195 195 version = numerictags[-1]
196 196 if hgid.endswith('+'): # propagate the dirty status to the tag
197 197 version += '+'
198 198 else: # no tag found
199 199 ltagcmd = [sys.executable, 'hg', 'parents', '--template',
200 200 '{latesttag}']
201 201 ltag = runhg(ltagcmd, env)
202 202 changessincecmd = [sys.executable, 'hg', 'log', '-T', 'x\n', '-r',
203 203 "only(.,'%s')" % ltag]
204 204 changessince = len(runhg(changessincecmd, env).splitlines())
205 205 version = '%s+%s-%s' % (ltag, changessince, hgid)
206 206 if version.endswith('+'):
207 207 version += time.strftime('%Y%m%d')
208 208 elif os.path.exists('.hg_archival.txt'):
209 209 kw = dict([[t.strip() for t in l.split(':', 1)]
210 210 for l in open('.hg_archival.txt')])
211 211 if 'tag' in kw:
212 212 version = kw['tag']
213 213 elif 'latesttag' in kw:
214 214 if 'changessincelatesttag' in kw:
215 215 version = '%(latesttag)s+%(changessincelatesttag)s-%(node).12s' % kw
216 216 else:
217 217 version = '%(latesttag)s+%(latesttagdistance)s-%(node).12s' % kw
218 218 else:
219 219 version = kw.get('node', '')[:12]
220 220
221 221 if version:
222 222 f = open("mercurial/__version__.py", "w")
223 223 f.write('# this file is autogenerated by setup.py\n')
224 224 f.write('version = "%s"\n' % version)
225 225 f.close()
226 226
227 227
228 228 try:
229 229 from mercurial import __version__
230 230 version = __version__.version
231 231 except ImportError:
232 232 version = 'unknown'
233 233
234 234 class hgbuild(build):
235 235 # Insert hgbuildmo first so that files in mercurial/locale/ are found
236 236 # when build_py is run next.
237 237 sub_commands = [('build_mo', None),
238 238
239 239 # We also need build_ext before build_py. Otherwise, when 2to3 is
240 240 # called (in build_py), it will not find osutil & friends,
241 241 # thinking that those modules are global and, consequently, making
242 242 # a mess, now that all module imports are global.
243 243
244 244 ('build_ext', build.has_ext_modules),
245 245 ] + build.sub_commands
246 246
247 247 class hgbuildmo(build):
248 248
249 249 description = "build translations (.mo files)"
250 250
251 251 def run(self):
252 252 if not find_executable('msgfmt'):
253 253 self.warn("could not find msgfmt executable, no translations "
254 254 "will be built")
255 255 return
256 256
257 257 podir = 'i18n'
258 258 if not os.path.isdir(podir):
259 259 self.warn("could not find %s/ directory" % podir)
260 260 return
261 261
262 262 join = os.path.join
263 263 for po in os.listdir(podir):
264 264 if not po.endswith('.po'):
265 265 continue
266 266 pofile = join(podir, po)
267 267 modir = join('locale', po[:-3], 'LC_MESSAGES')
268 268 mofile = join(modir, 'hg.mo')
269 269 mobuildfile = join('mercurial', mofile)
270 270 cmd = ['msgfmt', '-v', '-o', mobuildfile, pofile]
271 271 if sys.platform != 'sunos5':
272 272 # msgfmt on Solaris does not know about -c
273 273 cmd.append('-c')
274 274 self.mkpath(join('mercurial', modir))
275 275 self.make_file([pofile], mobuildfile, spawn, (cmd,))
276 276
277 277
278 278 class hgdist(Distribution):
279 279 pure = 0
280 280
281 281 global_options = Distribution.global_options + \
282 282 [('pure', None, "use pure (slow) Python "
283 283 "code instead of C extensions"),
284 284 ('c2to3', None, "(experimental!) convert "
285 285 "code with 2to3"),
286 286 ]
287 287
288 288 def has_ext_modules(self):
289 289 # self.ext_modules is emptied in hgbuildpy.finalize_options which is
290 290 # too late for some cases
291 291 return not self.pure and Distribution.has_ext_modules(self)
292 292
293 293 class hgbuildext(build_ext):
294 294
295 295 def build_extension(self, ext):
296 296 try:
297 297 build_ext.build_extension(self, ext)
298 298 except CCompilerError:
299 299 if not getattr(ext, 'optional', False):
300 300 raise
301 301 log.warn("Failed to build optional extension '%s' (skipping)",
302 302 ext.name)
303 303
304 304 class hgbuildpy(build_py):
305 305 if convert2to3:
306 306 fixer_names = sorted(set(getfixers("lib2to3.fixes") +
307 307 getfixers("hgfixes")))
308 308
309 309 def finalize_options(self):
310 310 build_py.finalize_options(self)
311 311
312 312 if self.distribution.pure:
313 313 if self.py_modules is None:
314 314 self.py_modules = []
315 315 for ext in self.distribution.ext_modules:
316 316 if ext.name.startswith("mercurial."):
317 317 self.py_modules.append("mercurial.pure.%s" % ext.name[10:])
318 318 self.distribution.ext_modules = []
319 319 else:
320 320 h = os.path.join(get_python_inc(), 'Python.h')
321 321 if not os.path.exists(h):
322 322 raise SystemExit('Python headers are required to build '
323 323 'Mercurial but weren\'t found in %s' % h)
324 324
325 325 def find_modules(self):
326 326 modules = build_py.find_modules(self)
327 327 for module in modules:
328 328 if module[0] == "mercurial.pure":
329 329 if module[1] != "__init__":
330 330 yield ("mercurial", module[1], module[2])
331 331 else:
332 332 yield module
333 333
334 334 class buildhgextindex(Command):
335 335 description = 'generate prebuilt index of hgext (for frozen package)'
336 336 user_options = []
337 337 _indexfilename = 'hgext/__index__.py'
338 338
339 339 def initialize_options(self):
340 340 pass
341 341
342 342 def finalize_options(self):
343 343 pass
344 344
345 345 def run(self):
346 346 if os.path.exists(self._indexfilename):
347 347 f = open(self._indexfilename, 'w')
348 348 f.write('# empty\n')
349 349 f.close()
350 350
351 351 # here no extension enabled, disabled() lists up everything
352 352 code = ('import pprint; from mercurial import extensions; '
353 353 'pprint.pprint(extensions.disabled())')
354 354 out, err = runcmd([sys.executable, '-c', code], env)
355 355 if err:
356 356 raise DistutilsExecError(err)
357 357
358 358 f = open(self._indexfilename, 'w')
359 359 f.write('# this file is autogenerated by setup.py\n')
360 360 f.write('docs = ')
361 361 f.write(out)
362 362 f.close()
363 363
364 364 class buildhgexe(build_ext):
365 365 description = 'compile hg.exe from mercurial/exewrapper.c'
366 366
367 367 def build_extensions(self):
368 368 if os.name != 'nt':
369 369 return
370 370 if isinstance(self.compiler, HackedMingw32CCompiler):
371 371 self.compiler.compiler_so = self.compiler.compiler # no -mdll
372 372 self.compiler.dll_libraries = [] # no -lmsrvc90
373 373 hv = sys.hexversion
374 374 pythonlib = 'python%d%d' % (hv >> 24, (hv >> 16) & 0xff)
375 375 f = open('mercurial/hgpythonlib.h', 'wb')
376 376 f.write('/* this file is autogenerated by setup.py */\n')
377 377 f.write('#define HGPYTHONLIB "%s"\n' % pythonlib)
378 378 f.close()
379 379 objects = self.compiler.compile(['mercurial/exewrapper.c'],
380 380 output_dir=self.build_temp)
381 381 dir = os.path.dirname(self.get_ext_fullpath('dummy'))
382 382 target = os.path.join(dir, 'hg')
383 383 self.compiler.link_executable(objects, target,
384 384 libraries=[],
385 385 output_dir=self.build_temp)
386 386
387 387 class hginstalllib(install_lib):
388 388 '''
389 389 This is a specialization of install_lib that replaces the copy_file used
390 390 there so that it supports setting the mode of files after copying them,
391 391 instead of just preserving the mode that the files originally had. If your
392 392 system has a umask of something like 027, preserving the permissions when
393 393 copying will lead to a broken install.
394 394
395 395 Note that just passing keep_permissions=False to copy_file would be
396 396 insufficient, as it might still be applying a umask.
397 397 '''
398 398
399 399 def run(self):
400 400 realcopyfile = file_util.copy_file
401 401 def copyfileandsetmode(*args, **kwargs):
402 402 src, dst = args[0], args[1]
403 403 dst, copied = realcopyfile(*args, **kwargs)
404 404 if copied:
405 405 st = os.stat(src)
406 406 # Persist executable bit (apply it to group and other if user
407 407 # has it)
408 408 if st[stat.ST_MODE] & stat.S_IXUSR:
409 409 setmode = 0755
410 410 else:
411 411 setmode = 0644
412 412 os.chmod(dst, (stat.S_IMODE(st[stat.ST_MODE]) & ~0777) |
413 413 setmode)
414 414 file_util.copy_file = copyfileandsetmode
415 415 try:
416 416 install_lib.run(self)
417 417 finally:
418 418 file_util.copy_file = realcopyfile
419 419
420 420 class hginstallscripts(install_scripts):
421 421 '''
422 422 This is a specialization of install_scripts that replaces the @LIBDIR@ with
423 423 the configured directory for modules. If possible, the path is made relative
424 424 to the directory for scripts.
425 425 '''
426 426
427 427 def initialize_options(self):
428 428 install_scripts.initialize_options(self)
429 429
430 430 self.install_lib = None
431 431
432 432 def finalize_options(self):
433 433 install_scripts.finalize_options(self)
434 434 self.set_undefined_options('install',
435 435 ('install_lib', 'install_lib'))
436 436
437 437 def run(self):
438 438 install_scripts.run(self)
439 439
440 440 if (os.path.splitdrive(self.install_dir)[0] !=
441 441 os.path.splitdrive(self.install_lib)[0]):
442 442 # can't make relative paths from one drive to another, so use an
443 443 # absolute path instead
444 444 libdir = self.install_lib
445 445 else:
446 446 common = os.path.commonprefix((self.install_dir, self.install_lib))
447 447 rest = self.install_dir[len(common):]
448 448 uplevel = len([n for n in os.path.split(rest) if n])
449 449
450 450 libdir = uplevel * ('..' + os.sep) + self.install_lib[len(common):]
451 451
452 452 for outfile in self.outfiles:
453 453 fp = open(outfile, 'rb')
454 454 data = fp.read()
455 455 fp.close()
456 456
457 457 # skip binary files
458 458 if b('\0') in data:
459 459 continue
460 460
461 461 data = data.replace(b('@LIBDIR@'), libdir.encode(libdir_escape))
462 462 fp = open(outfile, 'wb')
463 463 fp.write(data)
464 464 fp.close()
465 465
466 466 cmdclass = {'build': hgbuild,
467 467 'build_mo': hgbuildmo,
468 468 'build_ext': hgbuildext,
469 469 'build_py': hgbuildpy,
470 470 'build_hgextindex': buildhgextindex,
471 471 'install_lib': hginstalllib,
472 472 'install_scripts': hginstallscripts,
473 473 'build_hgexe': buildhgexe,
474 474 }
475 475
476 476 packages = ['mercurial', 'mercurial.hgweb', 'mercurial.httpclient',
477 477 'hgext', 'hgext.convert', 'hgext.highlight', 'hgext.zeroconf',
478 478 'hgext.largefiles']
479 479
480 480 pymodules = []
481 481
482 482 common_depends = ['mercurial/util.h']
483 483
484 484 extmodules = [
485 485 Extension('mercurial.base85', ['mercurial/base85.c'],
486 486 depends=common_depends),
487 487 Extension('mercurial.bdiff', ['mercurial/bdiff.c'],
488 488 depends=common_depends),
489 489 Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c'],
490 490 depends=common_depends),
491 491 Extension('mercurial.mpatch', ['mercurial/mpatch.c'],
492 492 depends=common_depends),
493 493 Extension('mercurial.parsers', ['mercurial/dirs.c',
494 494 'mercurial/parsers.c',
495 495 'mercurial/pathencode.c'],
496 496 depends=common_depends),
497 497 ]
498 498
499 499 osutil_ldflags = []
500 500
501 501 if sys.platform == 'darwin':
502 502 osutil_ldflags += ['-framework', 'ApplicationServices']
503 503
504 504 # disable osutil.c under windows + python 2.4 (issue1364)
505 505 if sys.platform == 'win32' and sys.version_info < (2, 5, 0, 'final'):
506 506 pymodules.append('mercurial.pure.osutil')
507 507 else:
508 508 extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'],
509 509 extra_link_args=osutil_ldflags,
510 510 depends=common_depends))
511 511
512 # the -mno-cygwin option has been deprecated for years
513 Mingw32CCompiler = cygwinccompiler.Mingw32CCompiler
512 try:
513 from distutils import cygwinccompiler
514
515 # the -mno-cygwin option has been deprecated for years
516 compiler = cygwinccompiler.Mingw32CCompiler
514 517
515 class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler):
516 def __init__(self, *args, **kwargs):
517 Mingw32CCompiler.__init__(self, *args, **kwargs)
518 for i in 'compiler compiler_so linker_exe linker_so'.split():
519 try:
520 getattr(self, i).remove('-mno-cygwin')
521 except ValueError:
522 pass
518 class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler):
519 def __init__(self, *args, **kwargs):
520 compiler.__init__(self, *args, **kwargs)
521 for i in 'compiler compiler_so linker_exe linker_so'.split():
522 try:
523 getattr(self, i).remove('-mno-cygwin')
524 except ValueError:
525 pass
523 526
524 cygwinccompiler.Mingw32CCompiler = HackedMingw32CCompiler
527 cygwinccompiler.Mingw32CCompiler = HackedMingw32CCompiler
528 except ImportError:
529 # the cygwinccompiler package is not available on some Python
530 # distributions like the ones from the optware project for Synology
531 # DiskStation boxes
532 class HackedMingw32CCompiler(object):
533 pass
525 534
526 535 packagedata = {'mercurial': ['locale/*/LC_MESSAGES/hg.mo',
527 536 'help/*.txt',
528 537 'default.d/*.rc',
529 538 'dummycert.pem']}
530 539
531 540 def ordinarypath(p):
532 541 return p and p[0] != '.' and p[-1] != '~'
533 542
534 543 for root in ('templates',):
535 544 for curdir, dirs, files in os.walk(os.path.join('mercurial', root)):
536 545 curdir = curdir.split(os.sep, 1)[1]
537 546 dirs[:] = filter(ordinarypath, dirs)
538 547 for f in filter(ordinarypath, files):
539 548 f = os.path.join(curdir, f)
540 549 packagedata['mercurial'].append(f)
541 550
542 551 datafiles = []
543 552 setupversion = version
544 553 extra = {}
545 554
546 555 if py2exeloaded:
547 556 extra['console'] = [
548 557 {'script':'hg',
549 558 'copyright':'Copyright (C) 2005-2010 Matt Mackall and others',
550 559 'product_version':version}]
551 560 # sub command of 'build' because 'py2exe' does not handle sub_commands
552 561 build.sub_commands.insert(0, ('build_hgextindex', None))
553 562
554 563 if os.name == 'nt':
555 564 # Windows binary file versions for exe/dll files must have the
556 565 # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535
557 566 setupversion = version.split('+', 1)[0]
558 567
559 568 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
560 569 version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()
561 570 if version:
562 571 version = version[0]
563 572 xcode4 = (version.startswith('Xcode') and
564 573 StrictVersion(version.split()[1]) >= StrictVersion('4.0'))
565 574 xcode51 = re.match(r'^Xcode\s+5\.1', version) is not None
566 575 else:
567 576 # xcodebuild returns empty on OS X Lion with XCode 4.3 not
568 577 # installed, but instead with only command-line tools. Assume
569 578 # that only happens on >= Lion, thus no PPC support.
570 579 xcode4 = True
571 580 xcode51 = False
572 581
573 582 # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
574 583 # distutils.sysconfig
575 584 if xcode4:
576 585 os.environ['ARCHFLAGS'] = ''
577 586
578 587 # XCode 5.1 changes clang such that it now fails to compile if the
579 588 # -mno-fused-madd flag is passed, but the version of Python shipped with
580 589 # OS X 10.9 Mavericks includes this flag. This causes problems in all
581 590 # C extension modules, and a bug has been filed upstream at
582 591 # http://bugs.python.org/issue21244. We also need to patch this here
583 592 # so Mercurial can continue to compile in the meantime.
584 593 if xcode51:
585 594 cflags = get_config_var('CFLAGS')
586 595 if cflags and re.search(r'-mno-fused-madd\b', cflags) is not None:
587 596 os.environ['CFLAGS'] = (
588 597 os.environ.get('CFLAGS', '') + ' -Qunused-arguments')
589 598
590 599 setup(name='mercurial',
591 600 version=setupversion,
592 601 author='Matt Mackall and many others',
593 602 author_email='mercurial@selenic.com',
594 603 url='http://mercurial.selenic.com/',
595 604 download_url='http://mercurial.selenic.com/release/',
596 605 description=('Fast scalable distributed SCM (revision control, version '
597 606 'control) system'),
598 607 long_description=('Mercurial is a distributed SCM tool written in Python.'
599 608 ' It is used by a number of large projects that require'
600 609 ' fast, reliable distributed revision control, such as '
601 610 'Mozilla.'),
602 611 license='GNU GPLv2 or any later version',
603 612 classifiers=[
604 613 'Development Status :: 6 - Mature',
605 614 'Environment :: Console',
606 615 'Intended Audience :: Developers',
607 616 'Intended Audience :: System Administrators',
608 617 'License :: OSI Approved :: GNU General Public License (GPL)',
609 618 'Natural Language :: Danish',
610 619 'Natural Language :: English',
611 620 'Natural Language :: German',
612 621 'Natural Language :: Italian',
613 622 'Natural Language :: Japanese',
614 623 'Natural Language :: Portuguese (Brazilian)',
615 624 'Operating System :: Microsoft :: Windows',
616 625 'Operating System :: OS Independent',
617 626 'Operating System :: POSIX',
618 627 'Programming Language :: C',
619 628 'Programming Language :: Python',
620 629 'Topic :: Software Development :: Version Control',
621 630 ],
622 631 scripts=scripts,
623 632 packages=packages,
624 633 py_modules=pymodules,
625 634 ext_modules=extmodules,
626 635 data_files=datafiles,
627 636 package_data=packagedata,
628 637 cmdclass=cmdclass,
629 638 distclass=hgdist,
630 639 options={'py2exe': {'packages': ['hgext', 'email']},
631 640 'bdist_mpkg': {'zipdist': False,
632 641 'license': 'COPYING',
633 642 'readme': 'contrib/macosx/Readme.html',
634 643 'welcome': 'contrib/macosx/Welcome.html',
635 644 },
636 645 },
637 646 **extra)
General Comments 0
You need to be logged in to leave comments. Login now